meson: use a convenience lib for journal user sources

Instead of compiling those files twice, once for libsystemd and once for
libshared, compile once as a static archive and then link into both.
This reduce the meson target for man=no compile to 1291.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2017-12-19 19:38:43 +01:00
parent a8e559d4c6
commit 5e3cec87be
3 changed files with 13 additions and 7 deletions

View file

@ -1254,14 +1254,14 @@ libjournal_core = static_library(
libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym) libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
libsystemd = shared_library( libsystemd = shared_library(
'systemd', 'systemd',
journal_internal_sources,
version : libsystemd_version, version : libsystemd_version,
include_directories : includes, include_directories : includes,
link_args : ['-shared', link_args : ['-shared',
'-Wl,--version-script=' + libsystemd_sym_path], '-Wl,--version-script=' + libsystemd_sym_path],
link_with : [libbasic, link_with : [libbasic,
libbasic_gcrypt], libbasic_gcrypt],
link_whole : libsystemd_static, link_whole : [libsystemd_static,
libjournal_client],
dependencies : [threads, dependencies : [threads,
librt, librt,
libxz, libxz,

View file

@ -15,7 +15,7 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>. # along with systemd; If not, see <http://www.gnu.org/licenses/>.
journal_internal_sources = files(''' journal_client_sources = files('''
audit-type.c audit-type.c
audit-type.h audit-type.h
catalog.c catalog.c
@ -38,7 +38,7 @@ journal_internal_sources = files('''
'''.split()) '''.split())
if conf.get('HAVE_GCRYPT') == 1 if conf.get('HAVE_GCRYPT') == 1
journal_internal_sources += files(''' journal_client_sources += files('''
journal-authenticate.c journal-authenticate.c
journal-authenticate.h journal-authenticate.h
fsprg.c fsprg.c
@ -69,7 +69,13 @@ audit_type_to_name = custom_target(
command : [awk, '-f', '@INPUT0@', '@INPUT1@'], command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
capture : true) capture : true)
journal_internal_sources += [audit_type_to_name] journal_client_sources += [audit_type_to_name]
libjournal_client = static_library(
'journal-client',
journal_client_sources,
include_directories : includes,
c_args : ['-fvisibility=default'])
############################################################ ############################################################

View file

@ -166,7 +166,6 @@ libshared_static = static_library(
libshared = shared_library( libshared = shared_library(
libshared_name, libshared_name,
journal_internal_sources,
libudev_sources, libudev_sources,
include_directories : includes, include_directories : includes,
link_args : ['-shared', link_args : ['-shared',
@ -174,7 +173,8 @@ libshared = shared_library(
link_whole : [libshared_static, link_whole : [libshared_static,
libbasic, libbasic,
libbasic_gcrypt, libbasic_gcrypt,
libsystemd_static], libsystemd_static,
libjournal_client],
c_args : ['-fvisibility=default'], c_args : ['-fvisibility=default'],
dependencies : libshared_deps, dependencies : libshared_deps,
install : true, install : true,