Skip to content

Commit

Permalink
meson: de-duplicate binaries using symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
floppym committed May 29, 2024
1 parent 3d30b6f commit 250c556
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 29 deletions.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ project('OpenRC', 'c',
'prefix=/usr',
'warning_level=3',
],
meson_version : '>=0.53.2')
meson_version : '>=0.61.0')

cc = meson.get_compiler('c')
fs = import('fs')
Expand Down
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 250c556

Please sign in to comment.