Skip to content

Commit

Permalink
meson: include the library symbol version list in link_depends
Browse files Browse the repository at this point in the history
This is pretty ugly, because I don't know how to use a single
definition for two purposes:
- --version-script needs a path relative to the build root
- link_depends needs a path relative to source root
Also, link_depends does not accept files() output
[mesonbuild/meson#1172], and I don't see a way to go
from files() output to a string path that can be used to craft the -Wl arg.

Ideally, a single files() result could be used in both places.
I'm leaving this as a separate commit for now.
  • Loading branch information
keszybz committed Apr 19, 2017
1 parent 9cfeeef commit edc82d1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
14 changes: 10 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -962,17 +962,19 @@ libjournal_core = static_library(
libsystemd_journal_internal],
install : false)

version_script_arg = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
libsystemd = shared_library(
'systemd',
libsystemd_internal_sources,
version : '0.18.0',
include_directories : includes,
link_args : ['-shared',
'-Wl,--version-script=' + libsystemd_sym],
'-Wl,--version-script=' + version_script_arg],
link_with : [libbasic,
libsystemd_internal,
libsystemd_journal_internal],
dependencies : [threads],
link_depends : libsystemd_sym,
install : true,
install_dir : rootlibdir)

Expand All @@ -988,20 +990,22 @@ foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME', []],
module = tuple[0]
extra_deps = tuple[2]

sym = meson.current_source_dir() + '/src/nss-@0@/nss-@0@.sym'.format(module)
sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
version_script_arg = join_paths(meson.current_source_dir(), sym)

shared_library(
'nss_' + module,
'src/nss-@0@/nss-@0@.c'.format(module),
version : '2',
include_directories : includes,
link_args : ['-shared',
'-Wl,--version-script=' + sym,
'-Wl,--version-script=' + version_script_arg,
'-Wl,--undefined'],
link_with : [libsystemd_internal,
libbasic],
dependencies : [threads,
librt] + extra_deps,
link_depends : sym,
install : true,
install_dir : rootlibdir)
endif
Expand Down Expand Up @@ -1207,16 +1211,18 @@ if conf.get('ENABLE_LOGIND', 0) == 1
install_dir : rootbindir)

if conf.get('HAVE_PAM', 0) == 1
version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
shared_library(
'pam_systemd',
pam_systemd_c,
name_prefix : '',
include_directories : includes,
link_args : ['-shared',
'-Wl,--version-script=' + pam_systemd_sym],
'-Wl,--version-script=' + version_script_arg],
link_with : [libshared],
dependencies : [libpam,
libpam_misc],
link_depends : pam_systemd_sym,
install : true,
install_dir : pamlibdir)
endif
Expand Down
2 changes: 1 addition & 1 deletion src/libsystemd/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ libsystemd_internal = static_library(
dependencies : [threads,
librt])

libsystemd_sym = meson.current_source_dir() + '/libsystemd.sym'
libsystemd_sym = 'src/libsystemd/libsystemd.sym'

libsystemd_pc = configure_file(
input : 'libsystemd.pc.in',
Expand Down
6 changes: 4 additions & 2 deletions src/libudev/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ libudev_sources = '''

############################################################

libudev_sym = meson.current_source_dir() + '/libudev.sym'
libudev_sym = 'libudev.sym'

version_script_arg = '@0@/@1@'.format(meson.current_source_dir(), libudev_sym)
libudev = shared_library(
'udev',
libudev_sources,
version : '1.6.6',
include_directories : includes,
link_args : ['-shared',
'-Wl,--version-script=' + libudev_sym],
'-Wl,--version-script=' + version_script_arg],
link_with : [libbasic,
libsystemd],
link_depends : libudev_sym,
install : true,
install_dir : rootlibdir)

Expand Down
2 changes: 1 addition & 1 deletion src/login/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if conf.get('ENABLE_LOGIND', 0) == 1
install_data(logind_conf,
install_dir : pkgsysconfdir)

pam_systemd_sym = meson.current_source_dir() + '/pam_systemd.sym'
pam_systemd_sym = 'src/login/pam_systemd.sym'
pam_systemd_c = files('pam_systemd.c')

install_data('org.freedesktop.login1.conf',
Expand Down

0 comments on commit edc82d1

Please sign in to comment.