Commit 34cb6f98 authored by Thomas Haller's avatar Thomas Haller

build/meson: use variables for ldflags and linker-script

parent 98b46537
......@@ -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
......@@ -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
)
......@@ -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
)
......
......@@ -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
)
......@@ -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
......
......@@ -100,11 +100,7 @@ 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',
......@@ -112,8 +108,10 @@ libnm_glib_vpn = shared_library(
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
)
......@@ -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',
......@@ -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
)
......@@ -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
)
......
......@@ -108,11 +108,7 @@ 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',
......@@ -120,8 +116,10 @@ libnm_util = shared_library(
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
)
......@@ -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
)
......
......@@ -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',
......@@ -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
)
......@@ -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
)
......
......@@ -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')
......
......@@ -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
......
......@@ -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')
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
)
......@@ -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
)
......@@ -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
......
......@@ -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
......
......@@ -223,7 +223,7 @@ create_exports_networkmanager = join_paths(meson.source_root(), 'tools', 'create
symbol_map_name = 'NetworkManager.ver'
symbol_map = custom_target(
linker_script = custom_target(
symbol_map_name,
input: meson.source_root(),
output: symbol_map_name,
......@@ -232,7 +232,7 @@ symbol_map = custom_target(
command: [create_exports_networkmanager, '--called-from-make', '@INPUT@']
)
ldflags += '-Wl,--version-script,@0@'.format(symbol_map)
ldflags += '-Wl,--version-script,@0@'.format(linker_script)
'''
network_manager = executable(
......@@ -242,7 +242,8 @@ network_manager = executable(
c_args: cflags,
link_with: libnetwork_manager,
link_args: ldflags,
link_depends: symbol_map,
#FIXME
#link_depends: linker_script,
install: true,
install_dir: nm_sbindir
)
......@@ -255,10 +256,6 @@ deps = [
nm_core_dep
]
ldflags = [
'-Wl,--version-script,@0@'.format(linker_script_binary),
]
name = 'nm-iface-helper'
executable(
......@@ -267,7 +264,7 @@ executable(
dependencies: deps,
c_args: cflags,
link_with: [libnetwork_manager_base, libsystemd_nm],
link_args: ldflags,
link_args: ldflags_linker_script_binary,
link_depends: linker_script_binary,
install: true,
install_dir: nm_libexecdir
......
......@@ -26,19 +26,17 @@ deps = [
nm_dep
]
symbol_map = join_paths(meson.current_source_dir(), 'nm-ppp-plugin.ver')
ldflags = [
'-Wl,--version-script,@0@'.format(symbol_map),
]
linker_script = join_paths(meson.current_source_dir(), 'nm-ppp-plugin.ver')
core_plugins += shared_module(
name,
sources: 'nm-ppp-manager.c',
dependencies: deps,
c_args: '-DPPPD_PLUGIN_DIR="@0@"'.format(pppd_plugin_dir),
link_args: ldflags,
link_depends: symbol_map,
link_args: [
'-Wl,--version-script,@0@'.format(linker_script),
],
link_depends: linker_script,
install: true,
install_dir: nm_pkglibdir
)
......@@ -17,17 +17,13 @@ sources = files(
'nms-ibft-plugin.c'
)
ldflags = [
'-Wl,--version-script,@0@'.format(linker_script_settings),
]
libnm_settings_plugin_ibft = shared_module(
name,
sources: sources,
dependencies: nm_dep,
c_args: cflags,
link_with: libnms_ibft_core,
link_args: ldflags,
link_args: ldflags_linker_script_settings,
link_depends: linker_script_settings,
install: true,
install_dir: nm_pkglibdir
......
......@@ -46,17 +46,13 @@ libnms_ifcfg_rh_core = static_library(
sources = [dbus_sources] + files('nms-ifcfg-rh-connection.c')
ldflags = [
'-Wl,--version-script,@0@'.format(linker_script_settings),
]
libnm_settings_plugin_ifcfg_rh = shared_module(
'nm-settings-plugin-ifcfg-rh',
sources: sources,
dependencies: deps,
c_args: cflags,
link_with: [libnmdbus_ifcfg_rh, libnms_ifcfg_rh_core],
link_args: ldflags,
link_args: ldflags_linker_script_settings,
link_depends: linker_script_settings,
install: true,
install_dir: nm_pkglibdir
......
......@@ -22,17 +22,13 @@ sources = files(
'nms-ifupdown-plugin.c'
)
ldflags = [
'-Wl,--version-script,@0@'.format(linker_script_settings),
]
libnm_settings_plugin_ifupdown = shared_module(
'nm-settings-plugin-ifupdown',
sources: sources,
dependencies: deps,
c_args: cflags,
link_with: libnms_ifupdown_core,
link_args: ldflags,
link_args: ldflags_linker_script_settings,
link_depends: linker_script_settings,
install: true,
install_dir: nm_pkglibdir
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment