From e97d3ad71e676185d00c1d85b97fae31ce9e19d3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 19 Dec 2017 14:19:46 +0100 Subject: [PATCH] meson: link libbasic and libshared_static into libshared gcrypt_util_sources had to be moved because otherwise they appeared twice in libshared.so halfproducts, causing an error. -fvisibility=default is added to libbasic, libshared_static so that the symbols appear properly in the exported symbol list in libshared. The advantage is that files are not compiled twice. When configured with -Dman=false, the ninja target list is reduced from 1588 to 1347 targets. The difference in compilation time is small (<10%). I think this is because of -O0 and ccache and multiple cores, and in different settings the compilation time could be reduced. The main advantage is that errors and warnings are not reported twice. --- meson.build | 4 ++-- src/basic/meson.build | 25 ++++++------------------- src/shared/meson.build | 20 ++++++++++---------- src/test/meson.build | 5 +++-- 4 files changed, 21 insertions(+), 33 deletions(-) diff --git a/meson.build b/meson.build index 060a2dc9e..95d99df56 100644 --- a/meson.build +++ b/meson.build @@ -1396,14 +1396,13 @@ includes = include_directories('src/basic', # 'src/libsystemd/sd-netlink', # 'src/libsystemd/sd-network', # 'src/libsystemd-network', +# '.') #else 'src/libelogind/sd-bus', 'src/libelogind/sd-id128', 'src/sleep', 'src/update-utmp', #endif // 0 - '.', - ) add_project_arguments('-include', 'config.h', language : 'c') @@ -1442,6 +1441,7 @@ subdir('src/login') # libsystemd = shared_library( # 'systemd', # journal_internal_sources, +# gcrypt_util_sources, # version : libsystemd_version, # include_directories : includes, # link_args : ['-shared', diff --git a/src/basic/meson.build b/src/basic/meson.build index 6b16b7967..78aba8257 100644 --- a/src/basic/meson.build +++ b/src/basic/meson.build @@ -16,7 +16,7 @@ # along with elogind; If not, see . #if 0 /// elogind has a shorter list -# basic_sources_plain = files(''' +# basic_sources = files(''' # MurmurHash2.c # MurmurHash2.h # af-list.c @@ -36,8 +36,6 @@ # bitmap.c # bitmap.h # blkid-util.h -# blockdev-util.c -# blockdev-util.h # bpf-program.c # bpf-program.h # btrfs-ctree.h @@ -179,8 +177,6 @@ # smack-util.c # smack-util.h # socket-label.c -# socket-protocol-list.c -# socket-protocol-list.h # socket-util.c # socket-util.h # sparse-endian.h @@ -206,10 +202,10 @@ # time-util.h # umask-util.h # unaligned.h -# unit-def.c -# unit-def.h # unit-name.c # unit-name.h +# unit-def.c +# unit-def.h # user-util.c # user-util.h # utf8.c @@ -408,20 +404,11 @@ errno_list_txt = custom_target( command : [generate_errno_list, cpp], capture : true) -generate_socket_protocol_list = find_program('generate-socket-protocol-list.sh') -socket_protocol_list_txt = custom_target( - 'socket-protocol-list.txt', - output : 'socket-protocol-list.txt', - command : [generate_socket_protocol_list, cpp], - capture : true) - generated_gperf_headers = [] #if 0 /// elogind has only the cap and errno list. # foreach item : [['af', af_list_txt, 'af', ''], # ['arphrd', arphrd_list_txt, 'arphrd', 'ARPHRD_'], # ['cap', cap_list_txt, 'capability', ''], -# ['errno', errno_list_txt, 'errno', ''], -# ['socket-protocol', socket_protocol_list_txt, 'socket_protocol', 'IPPROTO_']] #else foreach item : [['cap', cap_list_txt, 'capability', ''], ['errno', errno_list_txt, 'errno', '']] @@ -460,7 +447,7 @@ foreach item : [['cap', cap_list_txt, 'capability', ''], generated_gperf_headers += [target1, target2] endforeach -basic_sources = basic_sources_plain + [missing_h] + generated_gperf_headers +basic_sources += [missing_h] + generated_gperf_headers libbasic = static_library( 'basic', @@ -471,6 +458,6 @@ libbasic = static_library( #if 0 /// no blkid in elogind # libblkid, #endif // 0 - libselinux, - ], + libselinux], + c_args : ['-fvisibility=default'], install : false) diff --git a/src/shared/meson.build b/src/shared/meson.build index 9270648dd..2b5d14d2c 100644 --- a/src/shared/meson.build +++ b/src/shared/meson.build @@ -193,31 +193,31 @@ libshared_deps = [threads, libshared_sym_path = '@0@/libshared.sym'.format(meson.current_source_dir()) -libshared = shared_library( +libshared_static = static_library( libshared_name, shared_sources, - basic_sources, + include_directories : includes, + dependencies : libshared_deps, + c_args : ['-fvisibility=default']) + +libshared = shared_library( + libshared_name, #if 0 /// UNNEEDED by elogind # journal_internal_sources, # libsystemd_sources, # libudev_sources, +# '-Wl,--version-script=' + libshared_sym_path], +# link_whole : [libshared_static, +# libbasic], #else libelogind_internal_sources, #endif // 0 include_directories : includes, link_args : ['-shared', - '-Wl,--version-script=' + libshared_sym_path], c_args : ['-fvisibility=default'], dependencies : libshared_deps, install : true, install_dir : rootlibexecdir) - -libshared_static = static_library( - libshared_name, - shared_sources, - basic_sources, #if 1 /// need elogind internal library sources libelogind_internal_sources, #endif // 1 - include_directories : includes, - dependencies : libshared_deps) diff --git a/src/test/meson.build b/src/test/meson.build index 2d88a8716..dcdba0ea3 100644 --- a/src/test/meson.build +++ b/src/test/meson.build @@ -126,7 +126,8 @@ tests += [ # # [['src/test/test-dns-domain.c'], # [libcore, -# libelogind_network], +# libshared, +# libsystemd_network], # []], # # [['src/test/test-boot-timestamps.c'], @@ -177,7 +178,7 @@ tests += [ []], [['src/test/test-copy.c'], - [libshared_static], + [], []], #if 0 /// UNNEEDED in elogind -- 2.30.2