Skip to content

Commit

Permalink
build/meson: use variables for ldflags and linker-script
Browse files Browse the repository at this point in the history
  • Loading branch information
thom311 committed Jan 11, 2018
1 parent 98b4653 commit 34cb6f9
Show file tree
Hide file tree
Showing 20 changed files with 59 additions and 125 deletions.
6 changes: 1 addition & 5 deletions clients/cli/meson.build
Expand Up @@ -31,10 +31,6 @@ cflags = clients_cflags + [
'-DNMCLI_LOCALEDIR="@0@"'.format(nm_localedir)
]

ldflags = [
'-Wl,--version-script,@0@'.format(linker_script_binary),
]

if enable_polkit_agent
sources += nm_polkit_listener

Expand All @@ -46,7 +42,7 @@ executable(
sources,
dependencies: deps,
c_args: cflags,
link_args: ldflags,
link_args: ldflags_linker_script_binary,
link_depends: linker_script_binary,
install: true
)
6 changes: 1 addition & 5 deletions clients/meson.build
Expand Up @@ -14,16 +14,12 @@ cflags = clients_cflags + [
'-DG_LOG_DOMAIN="@0@"'.format(name),
]

ldflags = [
'-Wl,--version-script,@0@'.format(linker_script_binary),
]

executable(
name,
name + '.c',
dependencies: deps,
c_args: cflags,
link_args: ldflags,
link_args: ldflags_linker_script_binary,
link_depends: linker_script_binary,
install: true
)
Expand Down
6 changes: 1 addition & 5 deletions clients/tui/meson.build
Expand Up @@ -61,16 +61,12 @@ deps += [
libnmt_newt_dep
]

ldflags = [
'-Wl,--version-script,@0@'.format(linker_script_binary),
]

executable(
name,
sources,
dependencies: deps,
c_args: cflags,
link_args: ldflags,
link_args: ldflags_linker_script_binary,
link_depends: linker_script_binary,
install: true
)
6 changes: 1 addition & 5 deletions dispatcher/meson.build
Expand Up @@ -54,17 +54,13 @@ sources += gnome.gdbus_codegen(
namespace: 'NMDBus'
)

ldflags = [
'-Wl,--version-script,@0@'.format(linker_script_binary),
]

executable(
name,
sources,
dependencies: deps,
c_args: cflags,
link_with: libnm_dispatcher_core,
link_args: ldflags,
link_args: ldflags_linker_script_binary,
link_depends: linker_script_binary,
install: true,
install_dir: nm_libexecdir
Expand Down
26 changes: 11 additions & 15 deletions libnm-glib/meson.build
Expand Up @@ -100,20 +100,18 @@ libnm_glib_vpn_enum = gnome.mkenums(

deps = common_deps + [libnm_util_dep]

symbol_map = join_paths(meson.current_source_dir(), 'libnm-glib-vpn.ver')

ldflags = [
'-Wl,--version-script,@0@'.format(symbol_map),
]
linker_script = join_paths(meson.current_source_dir(), 'libnm-glib-vpn.ver')

libnm_glib_vpn = shared_library(
'nm-glib-vpn',
sources: sources + libnm_glib_vpn_enum,
version: libnm_glib_vpn_version,
dependencies: deps,
c_args: cflags,
link_args: ldflags,
link_depends: symbol_map,
link_args: [
'-Wl,--version-script,@0@'.format(linker_script),
],
link_depends: linker_script,
install: true
)

Expand Down Expand Up @@ -192,11 +190,7 @@ deps = common_deps + [
libudev_dep
]

symbol_map = join_paths(meson.current_source_dir(), 'libnm-glib.ver')

ldflags = [
'-Wl,--version-script,@0@'.format(symbol_map),
]
linker_script = join_paths(meson.current_source_dir(), 'libnm-glib.ver')

libnm_glib = shared_library(
'nm-glib',
Expand All @@ -207,8 +201,10 @@ libnm_glib = shared_library(
'-DNMRUNDIR="@0@"'.format(nm_pkgrundir),
],
link_with: libdeprecated_nm_glib,
link_args: ldflags,
link_depends: symbol_map,
link_args: [
'-Wl,--version-script,@0@'.format(linker_script),
],
link_depends: linker_script,
install: true
)

Expand Down Expand Up @@ -273,7 +269,7 @@ executable(

run_target(
'check-local-exports-' + libnm_glib_name,
command: [check_exports, libnm_glib.full_path(), symbol_map],
command: [check_exports, libnm_glib.full_path(), linker_script],
depends: libnm_glib
)

Expand Down
14 changes: 6 additions & 8 deletions libnm-util/meson.build
Expand Up @@ -108,20 +108,18 @@ cflags = common_cflags + [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_util_name)
]

symbol_map = join_paths(meson.current_source_dir(), 'libnm-util.ver')

ldflags = [
'-Wl,--version-script,@0@'.format(symbol_map),
]
linker_script = join_paths(meson.current_source_dir(), 'libnm-util.ver')

libnm_util = shared_library(
'nm-util',
sources: sources + libnm_utils_enum,
version: libnm_util_version,
dependencies: deps,
c_args: cflags,
link_args: ldflags,
link_depends: symbol_map,
link_args: [
'-Wl,--version-script,@0@'.format(linker_script),
],
link_depends: linker_script,
install: true
)

Expand Down Expand Up @@ -170,7 +168,7 @@ endif

run_target(
'check-local-exports-' + libnm_util_name,
command: [check_exports, libnm_util.full_path(), symbol_map],
command: [check_exports, libnm_util.full_path(), linker_script],
depends: libnm_util
)

Expand Down
13 changes: 6 additions & 7 deletions libnm/meson.build
Expand Up @@ -143,11 +143,8 @@ deps = [
uuid_dep
]

symbol_map = join_paths(meson.current_source_dir(), 'libnm.ver')
linker_script = join_paths(meson.current_source_dir(), 'libnm.ver')

ldflags = [
'-Wl,--version-script,@0@'.format(symbol_map),
]

libnm = shared_library(
'nm',
Expand All @@ -158,8 +155,10 @@ libnm = shared_library(
c_args: cflags,
link_with: libnm_utils,
link_whole: libnm_core,
link_args: ldflags,
link_depends: symbol_map,
link_args: [
'-Wl,--version-script,@0@'.format(linker_script),
],
link_depends: linker_script,
install: true
)

Expand All @@ -185,7 +184,7 @@ pkg.generate(

run_target(
'check-local-exports-' + libnm_name,
command: [check_exports, libnm.full_path(), symbol_map],
command: [check_exports, libnm.full_path(), linker_script],
depends: libnm
)

Expand Down
8 changes: 6 additions & 2 deletions meson.build
Expand Up @@ -165,10 +165,14 @@ endif
add_project_arguments(common_flags, language: 'c')
add_project_link_arguments(common_ldflags, language: 'c')

linker_script_binary = join_paths(meson.source_root(), 'linker-script-binary.ver')
linker_script_devices = join_paths(meson.source_root(), 'linker-script-devices.ver')
linker_script_binary = join_paths(meson.source_root(), 'linker-script-binary.ver')
linker_script_devices = join_paths(meson.source_root(), 'linker-script-devices.ver')
linker_script_settings = join_paths(meson.source_root(), 'linker-script-settings.ver')

ldflags_linker_script_binary = [ '-Wl,--version-script,@0@'.format(linker_script_binary) ]
ldflags_linker_script_devices = [ '-Wl,--version-script,@0@'.format(linker_script_devices) ]
ldflags_linker_script_settings = [ '-Wl,--version-script,@0@'.format(linker_script_settings) ]

uuid_dep = dependency('uuid')
libelogind_dep = dependency('libelogind', version: '>= 219', required: false)
libudev_dep = dependency('libudev', version: '>= 175')
Expand Down
6 changes: 1 addition & 5 deletions src/devices/adsl/meson.build
Expand Up @@ -9,15 +9,11 @@ deps = [
nm_dep
]

ldflags = [
'-Wl,--version-script,@0@'.format(linker_script_devices),
]

libnm_device_plugin_adsl = shared_module(
'nm-device-plugin-adsl',
sources: sources,
dependencies: deps,
link_args: ldflags,
link_args: ldflags_linker_script_devices,
link_depends: linker_script_devices,
install: true,
install_dir: nm_pkglibdir
Expand Down
6 changes: 1 addition & 5 deletions src/devices/bluetooth/meson.build
Expand Up @@ -14,10 +14,6 @@ deps = [
nm_dep
]

ldflags = [
'-Wl,--version-script,@0@'.format(linker_script_devices),
]

if enable_bluez5_dun
sources += files('nm-bluez5-dun.c')

Expand All @@ -28,7 +24,7 @@ libnm_device_plugin_bluetooth = shared_module(
'nm-device-plugin-bluetooth',
sources: sources,
dependencies: deps,
link_args: ldflags,
link_args: ldflags_linker_script_devices,
link_depends: linker_script_devices,
install: true,
install_dir: nm_pkglibdir
Expand Down
6 changes: 1 addition & 5 deletions src/devices/ovs/meson.build
Expand Up @@ -12,16 +12,12 @@ deps = [
nm_dep
]

ldflags = [
'-Wl,--version-script,@0@'.format(linker_script_devices),
]

libnm_device_plugin_ovs = shared_module(
'nm-device-plugin-ovs',
sources: sources,
dependencies: deps,
c_args: '-DRUNSTATEDIR="@0@"'.format(nm_runstatedir),
link_args: ldflags,
link_args: ldflags_linker_script_devices,
link_depends: linker_script_devices,
install: true,
install_dir: nm_pkglibdir
Expand Down
6 changes: 1 addition & 5 deletions src/devices/team/meson.build
Expand Up @@ -10,15 +10,11 @@ deps = [
nm_dep
]

ldflags = [
'-Wl,--version-script,@0@'.format(linker_script_devices),
]

libnm_device_plugin_team = shared_module(
'nm-device-plugin-team',
sources: sources,
dependencies: deps,
link_args: ldflags,
link_args: ldflags_linker_script_devices,
link_depends: linker_script_devices,
install: true,
install_dir: nm_pkglibdir
Expand Down
6 changes: 1 addition & 5 deletions src/devices/wifi/meson.build
Expand Up @@ -21,15 +21,11 @@ deps = [
nm_dep
]

ldflags = [
'-Wl,--version-script,@0@'.format(linker_script_devices),
]

libnm_device_plugin_wifi = shared_module(
'nm-device-plugin-wifi',
sources: sources,
dependencies: deps,
link_args: ldflags,
link_args: ldflags_linker_script_devices,
link_depends: linker_script_devices,
install: true,
install_dir: nm_pkglibdir
Expand Down
20 changes: 7 additions & 13 deletions src/devices/wwan/meson.build
Expand Up @@ -14,18 +14,16 @@ if enable_ofono
sources += files('nm-modem-ofono.c')
endif

symbol_name = join_paths(meson.current_source_dir(), 'libnm-wwan.ver')

ldflags = [
'-Wl,--version-script,@0@'.format(symbol_name),
]
linker_script = join_paths(meson.current_source_dir(), 'libnm-wwan.ver')

libnm_wwan = shared_module(
'nm-wwan',
sources: sources,
dependencies: deps,
link_args: ldflags,
link_depends: symbol_name,
link_args: [
'-Wl,--version-script,@0@'.format(linker_script),
],
link_depends: linker_script,
install: true,
install_dir: nm_pkglibdir
)
Expand All @@ -39,7 +37,7 @@ core_plugins += libnm_wwan

run_target(
'check-wwan',
command: [check_exports, libnm_wwan.full_path(), symbol_name],
command: [check_exports, libnm_wwan.full_path(), linker_script],
depends: libnm_wwan
)

Expand All @@ -50,16 +48,12 @@ sources = files(

deps += libnmdbus_dep

ldflags = [
'-Wl,--version-script,@0@'.format(linker_script_devices),
]

libnm_device_plugin_wwan = shared_module(
'nm-device-plugin-wwan',
sources: sources,
dependencies: deps,
link_with: libnm_wwan,
link_args: ldflags,
link_args: ldflags_linker_script_devices,
link_depends: linker_script_devices,
install: true,
install_dir: nm_pkglibdir
Expand Down
6 changes: 1 addition & 5 deletions src/dhcp/meson.build
Expand Up @@ -6,16 +6,12 @@ cflags = [
'-DNMRUNDIR="@0@"'.format(nm_pkgrundir),
]

ldflags = [
'-Wl,--version-script,@0@'.format(linker_script_binary),
]

executable(
name,
name + '.c',
dependencies: nm_core_dep,
c_args: cflags,
link_args: ldflags,
link_args: ldflags_linker_script_binary,
link_depends: linker_script_binary,
install: true,
install_dir: nm_libexecdir
Expand Down

0 comments on commit 34cb6f9

Please sign in to comment.