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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2017-12-19 14:19:46 +01:00
parent 4f561ecda9
commit 2d4ceca8a5
5 changed files with 18 additions and 19 deletions

View 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',

View 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)

View File

@ -44,8 +44,6 @@ if conf.get('HAVE_GCRYPT') == 1
fsprg.c
fsprg.h
'''.split())
journal_internal_sources += gcrypt_util_sources
endif
############################################################

View 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)

View 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'],