chiark / gitweb /
meson: link libbasic and libshared_static into libshared
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 19 Dec 2017 13:19:46 +0000 (14:19 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 30 May 2018 05:49:47 +0000 (07:49 +0200)
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
src/basic/meson.build
src/shared/meson.build
src/test/meson.build

index 060a2dc9ea34fffd78407ebff4b346b386c3cf2d..95d99df56ad77b7ffea715a08a00ca7cb7c54499 100644 (file)
@@ -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',
index 6b16b79670421c557f8f990b1912b019113867e9..78aba8257d234bf56802e5376f15588d3618bff5 100644 (file)
@@ -16,7 +16,7 @@
 # along with elogind; If not, see <http://www.gnu.org/licenses/>.
 
 #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
 #         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
 #         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)
index 9270648dd3feffde6d3d466887499c939b55086a..2b5d14d2cb5a12415550d098ec09eeb21a49d6cd 100644 (file)
@@ -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)
index 2d88a8716c122383dc4552462e10e4c706157a81..dcdba0ea3ee67e9916753a955a4052ca7b8e32fa 100644 (file)
@@ -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