]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
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)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 3 Jan 2018 11:09:14 +0000 (12:09 +0100)
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/journal/meson.build
src/shared/meson.build
src/test/meson.build

index 70b2d1b2c902a6d1ed3b1dd998eecda18d91da14..8ea3c03788649ae952fc580faba4b0e4c458c1b4 100644 (file)
@@ -1231,8 +1231,7 @@ includes = include_directories('src/basic',
                                'src/libsystemd/sd-netlink',
                                'src/libsystemd/sd-network',
                                'src/libsystemd-network',
-                               '.',
-                              )
+                               '.')
 
 add_project_arguments('-include', 'config.h', language : 'c')
 
@@ -1259,6 +1258,7 @@ libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sy
 libsystemd = shared_library(
         'systemd',
         journal_internal_sources,
+        gcrypt_util_sources,
         version : libsystemd_version,
         include_directories : includes,
         link_args : ['-shared',
index a37e279e570dee93aafc3eee61e4b8a211fe3fd5..43a2e11356af520e95d04046b4220e2642823322 100644 (file)
@@ -15,7 +15,7 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with systemd; If not, see <http://www.gnu.org/licenses/>.
 
-basic_sources_plain = files('''
+basic_sources = files('''
         MurmurHash2.c
         MurmurHash2.h
         af-list.c
@@ -294,7 +294,7 @@ foreach item : [['af',     af_list_txt,     'af',         ''],
         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',
@@ -303,6 +303,6 @@ libbasic = static_library(
         dependencies : [threads,
                         libcap,
                         libblkid,
-                        libselinux,
-                       ],
+                        libselinux],
+        c_args : ['-fvisibility=default'],
         install : false)
index edb2a1a30e2c7cdff1357db2a2b9d11793046c1d..e4d78f330d4118c44d764096595b9efe1ac1710a 100644 (file)
@@ -44,8 +44,6 @@ if conf.get('HAVE_GCRYPT') == 1
                 fsprg.c
                 fsprg.h
         '''.split())
-
-        journal_internal_sources += gcrypt_util_sources
 endif
 
 ############################################################
index 4620eaa007a949529a7c5950bbb37b4a65943f41..a9ad217fec0d1aaa390e1fd60529c10d108823b3 100644 (file)
@@ -159,24 +159,24 @@ 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,
         journal_internal_sources,
         libsystemd_sources,
         libudev_sources,
         include_directories : includes,
         link_args : ['-shared',
-                    '-Wl,--version-script=' + libshared_sym_path],
+                     '-Wl,--version-script=' + libshared_sym_path],
+        link_whole : [libshared_static,
+                      libbasic],
         c_args : ['-fvisibility=default'],
         dependencies : libshared_deps,
         install : true,
         install_dir : rootlibexecdir)
-
-libshared_static = static_library(
-        libshared_name,
-        shared_sources,
-        basic_sources,
-        include_directories : includes,
-        dependencies : libshared_deps)
index dcec53fa51520630cefb3879208988fe93ffdd60..7ba73af704159b2f5aec2a98a46f00e495bab7a3 100644 (file)
@@ -119,6 +119,7 @@ tests += [
 
         [['src/test/test-dns-domain.c'],
          [libcore,
+          libshared,
           libsystemd_network],
          []],
 
@@ -167,7 +168,7 @@ tests += [
          []],
 
         [['src/test/test-copy.c'],
-         [libshared_static],
+         [],
          []],
 
         [['src/test/test-sigbus.c'],