chiark / gitweb /
Move gcrypt-util to basic/
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 19 Dec 2017 18:06:56 +0000 (19:06 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 30 May 2018 05:49:47 +0000 (07:49 +0200)
We were including gcrypt-util.[ch] by hand in the few places where it
was used. Create a convenience library to avoid compiling the same
files multiple times.

v2:
- use a separate static library instead of mergin into libbasic

meson.build
src/basic/meson.build
src/shared/meson.build

index 95d99df56ad77b7ffea715a08a00ca7cb7c54499..6883d4a7a892681d2aad63e4410a48cc063cf27f 100644 (file)
@@ -1407,10 +1407,7 @@ includes = include_directories('src/basic',
 add_project_arguments('-include', 'config.h', language : 'c')
 
 #if 0 /// UNNEEDED by elogind
-# gcrypt_util_sources = files('src/shared/gcrypt-util.h',
-#                             'src/shared/gcrypt-util.c')
 #endif // 0
-
 subdir('po')
 #if 0 /// UNNEEDED by elogind
 # subdir('catalog')
@@ -1441,15 +1438,14 @@ subdir('src/login')
 # libsystemd = shared_library(
 #         'systemd',
 #         journal_internal_sources,
-#         gcrypt_util_sources,
 #         version : libsystemd_version,
 #         include_directories : includes,
 #         link_args : ['-shared',
 #                      '-Wl,--version-script=' + libsystemd_sym_path],
-#         link_with : libbasic,
+#         link_with : [libbasic,
+#                      libbasic_gcrypt],
 #         link_whole : libsystemd_static,
 #         dependencies : [threads,
-#                         libgcrypt,
 #                         librt,
 #                         libxz,
 #                         liblz4],
@@ -1717,11 +1713,10 @@ test_dlopen = executable(
 # if conf.get('ENABLE_RESOLVE') == 1
 #         executable('systemd-resolved',
 #                    systemd_resolved_sources,
-#                    gcrypt_util_sources,
 #                    include_directories : includes,
-#                    link_with : [libshared],
+#                    link_with : [libshared,
+#                                 libbasic_gcrypt],
 #                    dependencies : [threads,
-#                                    libgcrypt,
 #                                    libgpg_error,
 #                                    libm,
 #                                    libidn],
@@ -1731,11 +1726,10 @@ test_dlopen = executable(
 # 
 #         exe = executable('systemd-resolve',
 #                          systemd_resolve_sources,
-#                          gcrypt_util_sources,
 #                          include_directories : includes,
-#                          link_with : [libshared],
+#                          link_with : [libshared,
+#                                       libbasic_gcrypt],
 #                          dependencies : [threads,
-#                                          libgcrypt,
 #                                          libgpg_error,
 #                                          libm,
 #                                          libidn],
index 78aba8257d234bf56802e5376f15588d3618bff5..d4f0503a0fb00430254968715be663f9ffd6096b 100644 (file)
@@ -461,3 +461,13 @@ libbasic = static_library(
                         libselinux],
         c_args : ['-fvisibility=default'],
         install : false)
+
+# A convenience library that is separate from libbasic to avoid
+# unnecessary linking to libgcrypt.
+libbasic_gcrypt = static_library(
+        'basic-gcrypt',
+        'gcrypt-util.c',
+        'gcrypt-util.h',
+        include_directories : includes,
+        dependencies : [libgcrypt],
+        c_args : ['-fvisibility=default'])
index 2b5d14d2cb5a12415550d098ec09eeb21a49d6cd..1bc098bf86578445191d09446da560f8b63bb3a4 100644 (file)
@@ -57,8 +57,6 @@
 #         firewall-util.h
 #         fstab-util.c
 #         fstab-util.h
-#         gcrypt-util.c
-#         gcrypt-util.h
 #         generator.c
 #         generator.h
 #         gpt.h
@@ -208,7 +206,8 @@ libshared = shared_library(
 #         libudev_sources,
 #                      '-Wl,--version-script=' + libshared_sym_path],
 #         link_whole : [libshared_static,
-#                       libbasic],
+#                       libbasic,
+#                       libbasic_gcrypt],
 #else
         libelogind_internal_sources,
 #endif // 0