mirror of
https://github.com/systemd/systemd.git
synced 2026-08-03 14:40:31 +00:00
meson: avoid double compilation for standalone progs
So far we compiled the normal and standalone versions completely independently. Let's use the 'extract' template pattern to avoid any additional compilation and only require an single link to produce the .standalone variants. Unfortunately, as designed, the 'extract' framework only allows one set of object files to be extracted. Since we need all the files for the .standalone version, we cannot use 'extract' for other purposes. Thus, in the two cases where 'extract' was used for the test binaries, this is now changed to compile the files a second time. But the number of files in that list is small, so this seems like a better option. (If we weren't using the template system, we could easily extract just the objects we need. But with the current system, at the point of the definition, the binaries are not defined yet. We'd need to handle all of this through sets of dictionaries, and that just seems like too much trouble to avoid double compilation of a few small files.)
This commit is contained in:
@@ -2548,7 +2548,7 @@ foreach dict : executables
|
||||
endforeach
|
||||
|
||||
include_directories = dict['include_directories']
|
||||
if not is_test
|
||||
if not is_test and exe_sources.length() > 0
|
||||
include_directories += fs.parent(exe_sources[0])
|
||||
endif
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ executables += [
|
||||
executable_template + {
|
||||
'name' : 'systemd-repart',
|
||||
'public' : true,
|
||||
'sources' : files('repart.c'),
|
||||
'extract' : files('repart.c'),
|
||||
'link_with' : [
|
||||
libshared,
|
||||
libshared_fdisk,
|
||||
@@ -24,7 +24,7 @@ executables += [
|
||||
executable_template + {
|
||||
'name' : 'systemd-repart.standalone',
|
||||
'public' : true,
|
||||
'sources' : files('repart.c'),
|
||||
'objects' : ['systemd-repart'],
|
||||
'link_with' : [
|
||||
libc_wrapper_static,
|
||||
libbasic_static,
|
||||
|
||||
@@ -4,13 +4,7 @@ if conf.get('HAVE_LIBMOUNT') != 1
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
systemd_shutdown_sources = files(
|
||||
'detach-dm.c',
|
||||
'detach-loopback.c',
|
||||
'detach-md.c',
|
||||
'shutdown.c',
|
||||
)
|
||||
systemd_shutdown_extract_sources = files(
|
||||
shutdown_detach_sources = files(
|
||||
'detach-swap.c',
|
||||
'umount.c',
|
||||
)
|
||||
@@ -18,13 +12,17 @@ systemd_shutdown_extract_sources = files(
|
||||
executables += [
|
||||
libexec_template + {
|
||||
'name' : 'systemd-shutdown',
|
||||
'sources' : systemd_shutdown_sources,
|
||||
'extract' : systemd_shutdown_extract_sources,
|
||||
'extract' : files(
|
||||
'detach-dm.c',
|
||||
'detach-loopback.c',
|
||||
'detach-md.c',
|
||||
'shutdown.c',
|
||||
) + shutdown_detach_sources,
|
||||
'dependencies' : libmount_cflags,
|
||||
},
|
||||
libexec_template + {
|
||||
'name' : 'systemd-shutdown.standalone',
|
||||
'sources' : systemd_shutdown_sources + systemd_shutdown_extract_sources,
|
||||
'objects' : ['systemd-shutdown'],
|
||||
'link_with' : [
|
||||
libc_wrapper_static,
|
||||
libbasic_static,
|
||||
@@ -34,8 +32,8 @@ executables += [
|
||||
'dependencies' : libmount_cflags,
|
||||
},
|
||||
test_template + {
|
||||
'sources' : files('test-umount.c'),
|
||||
'objects' : ['systemd-shutdown'],
|
||||
'sources' : files('test-umount.c') +
|
||||
shutdown_detach_sources,
|
||||
'dependencies' : libmount_cflags,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -8,13 +8,13 @@ executables += [
|
||||
executable_template + {
|
||||
'name' : 'systemd-sysusers',
|
||||
'public' : true,
|
||||
'sources' : files('sysusers.c'),
|
||||
'extract' : files('sysusers.c'),
|
||||
'dependencies' : libaudit_cflags,
|
||||
},
|
||||
executable_template + {
|
||||
'name' : 'systemd-sysusers.standalone',
|
||||
'public' : true,
|
||||
'sources' : files('sysusers.c'),
|
||||
'objects' : ['systemd-sysusers'],
|
||||
'link_with' : [
|
||||
libc_wrapper_static,
|
||||
libbasic_static,
|
||||
|
||||
@@ -4,25 +4,20 @@ if conf.get('ENABLE_TMPFILES') != 1
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
systemd_tmpfiles_sources = files(
|
||||
'tmpfiles.c',
|
||||
)
|
||||
systemd_tmpfiles_extract_sources = files(
|
||||
'offline-passwd.c',
|
||||
)
|
||||
offline_passwd_c = files('offline-passwd.c')
|
||||
|
||||
executables += [
|
||||
executable_template + {
|
||||
'name' : 'systemd-tmpfiles',
|
||||
'public' : true,
|
||||
'sources' : systemd_tmpfiles_sources,
|
||||
'extract' : systemd_tmpfiles_extract_sources,
|
||||
'extract' : files('tmpfiles.c') +
|
||||
offline_passwd_c,
|
||||
'dependencies' : libacl_cflags,
|
||||
},
|
||||
executable_template + {
|
||||
'name' : 'systemd-tmpfiles.standalone',
|
||||
'public' : true,
|
||||
'sources' : systemd_tmpfiles_sources + systemd_tmpfiles_extract_sources,
|
||||
'objects' : ['systemd-tmpfiles'],
|
||||
'link_with' : [
|
||||
libc_wrapper_static,
|
||||
libbasic_static,
|
||||
@@ -32,7 +27,7 @@ executables += [
|
||||
'dependencies' : libacl_cflags,
|
||||
},
|
||||
test_template + {
|
||||
'sources' : files('test-offline-passwd.c'),
|
||||
'objects' : ['systemd-tmpfiles'],
|
||||
'sources' : files('test-offline-passwd.c') +
|
||||
offline_passwd_c,
|
||||
},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user