diff --git a/meson.build b/meson.build index 6ee4466ba..f20f1ba46 100644 --- a/meson.build +++ b/meson.build @@ -6,7 +6,7 @@ project('OpenRC', 'c', 'prefix=/usr', 'warning_level=3', ], - meson_version : '>=0.53.2') + meson_version : '>=0.57.0') cc = meson.get_compiler('c') fs = import('fs') @@ -201,6 +201,8 @@ init_d_conf_data.set('SYSCONFDIR', get_option('sysconfdir')) dl_dep = cc.find_library('dl', required: false) util_dep = cc.find_library('util', required: false) +install_hardlinks = files('tools' / 'meson_install_hardlinks.sh') + subdir('bash-completion') subdir('conf.d') subdir('etc') diff --git a/src/einfo/meson.build b/src/einfo/meson.build index df11d5fd2..fe9d67f8a 100644 --- a/src/einfo/meson.build +++ b/src/einfo/meson.build @@ -1,6 +1,5 @@ einfo_execs = [ 'einfon', - 'einfo', 'ewarnn', 'ewarn', 'eerrorn', @@ -22,11 +21,21 @@ einfo_execs = [ 'veoutdent', ] +einfo = 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', '-fn', einfo, '@OUTPUT@'], + output: exec) endforeach + +meson.add_install_script(install_hardlinks, + rc_bindir, + 'einfo', + einfo_execs) diff --git a/src/mark_service/meson.build b/src/mark_service/meson.build index ba046dcb5..af7872e24 100644 --- a/src/mark_service/meson.build +++ b/src/mark_service/meson.build @@ -1,5 +1,4 @@ mark_service_execs = [ - 'mark_service_starting', 'mark_service_started', 'mark_service_stopping', 'mark_service_stopped', @@ -10,11 +9,21 @@ mark_service_execs = [ 'mark_service_crashed', ] +mark_service = 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', '-fn', mark_service, '@OUTPUT@'], + output: exec) endforeach + +meson.add_install_script(install_hardlinks, + rc_sbindir, + 'mark_service_starting', + mark_service_execs) diff --git a/src/service/meson.build b/src/service/meson.build index b3a86f6df..4ac102c4a 100644 --- a/src/service/meson.build +++ b/src/service/meson.build @@ -1,5 +1,4 @@ service_execs = [ - 'service_starting', 'service_started', 'service_stopping', 'service_stopped', @@ -10,11 +9,21 @@ service_execs = [ 'service_crashed', ] +service = 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', '-fn', service, '@OUTPUT@'], + output: exec) endforeach + +meson.add_install_script(install_hardlinks, + rc_bindir, + 'service_starting', + service_execs) diff --git a/src/value/meson.build b/src/value/meson.build index da958f01f..222b750df 100644 --- a/src/value/meson.build +++ b/src/value/meson.build @@ -1,15 +1,24 @@ value_execs = [ - 'service_get_value', 'service_set_value', 'get_options', 'save_options', ] +value = 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', '-fn', value, '@OUTPUT@'], + output: exec) endforeach + +meson.add_install_script(install_hardlinks, + rc_bindir, + 'service_get_value', + value_execs) diff --git a/tools/meson_install_hardlinks.sh b/tools/meson_install_hardlinks.sh new file mode 100755 index 000000000..3c4e904ba --- /dev/null +++ b/tools/meson_install_hardlinks.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +dir=$1 +target=$2 +shift 2 +for linkname; do + ln -fn "${DESTDIR}${dir}/${target}" "${DESTDIR}${dir}/${linkname}" +done