Skip to content

Commit

Permalink
meson: de-duplicate binaries using symlinks
Browse files Browse the repository at this point in the history
Use custom targets to create symlinks for testing.
meson will dereference these at install time, so use install_symlink().
  • Loading branch information
floppym committed Jul 23, 2024
1 parent 466662d commit 76c91be
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 28 deletions.
21 changes: 14 additions & 7 deletions src/einfo/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
einfo_execs = [
'einfon',
'einfo',
'ewarnn',
'ewarn',
'eerrorn',
Expand All @@ -22,11 +21,19 @@ einfo_execs = [
'veoutdent',
]

executable('einfo',
['einfo.c', version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)

foreach exec: einfo_execs
executable(exec,
['einfo.c', version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)
custom_target(exec,
build_by_default: true,
command: ['ln', '-fns', 'einfo', '@OUTPUT@'],
output: exec)
install_symlink(exec,
install_dir: rc_bindir,
pointing_to: 'einfo')
endforeach
21 changes: 14 additions & 7 deletions src/mark_service/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
mark_service_execs = [
'mark_service_starting',
'mark_service_started',
'mark_service_stopping',
'mark_service_stopped',
Expand All @@ -10,11 +9,19 @@ mark_service_execs = [
'mark_service_crashed',
]

executable('mark_service_starting',
['mark_service.c', misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo,librc],
install: true,
install_dir: rc_sbindir)

foreach exec : mark_service_execs
executable(exec,
['mark_service.c', misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo,librc],
install: true,
install_dir: rc_sbindir)
custom_target(exec,
build_by_default: true,
command: ['ln', '-fns', 'mark_service_starting', '@OUTPUT@'],
output: exec)
install_symlink(exec,
install_dir: rc_sbindir,
pointing_to: 'mark_service_starting')
endforeach
21 changes: 14 additions & 7 deletions src/service/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
service_execs = [
'service_starting',
'service_started',
'service_stopping',
'service_stopped',
Expand All @@ -10,11 +9,19 @@ service_execs = [
'service_crashed',
]

executable('service_starting',
['service.c', misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)

foreach exec : service_execs
executable(exec,
['service.c', misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)
custom_target(exec,
build_by_default: true,
command: ['ln', '-fns', 'service_starting', '@OUTPUT@'],
output: exec)
install_symlink(exec,
install_dir: rc_bindir,
pointing_to: 'service_starting')
endforeach
21 changes: 14 additions & 7 deletions src/value/meson.build
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
value_execs = [
'service_get_value',
'service_set_value',
'get_options',
'save_options',
]

executable('service_get_value',
['value.c', misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)

foreach exec : value_execs
executable(exec,
['value.c', misc_c, version_h],
include_directories: [incdir, einfo_incdir, rc_incdir],
link_with: [libeinfo, librc],
install: true,
install_dir: rc_bindir)
custom_target(exec,
build_by_default: true,
command: ['ln', '-fns', 'service_get_value', '@OUTPUT@'],
output: exec)
install_symlink(exec,
install_dir: rc_bindir,
pointing_to: 'service_get_value')
endforeach

0 comments on commit 76c91be

Please sign in to comment.