From 17146fbf1bb4c93db53bd741f1484327c729631d Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Tue, 23 Apr 2024 08:39:12 -0500 Subject: [PATCH] meson: Add build-setarch option The sys/personality.h header does not exist on macOS. Signed-off-by: Jordan Williams --- meson.build | 52 ++++++++++++++++++++++++++--------------------- meson_options.txt | 2 ++ 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/meson.build b/meson.build index 90c71b49e..67181ca05 100644 --- a/meson.build +++ b/meson.build @@ -1666,36 +1666,42 @@ if opt and not is_disabler(exe) bashcompletions += ['rtcwake'] endif +opt = get_option('build-setarch').require(cc.has_header('sys/personality.h')).allowed() exe = executable( 'setarch', setarch_sources, include_directories : includes, link_with : [lib_common], install_dir : usrbin_exec_dir, - install : true) -exes += exe -manadocs += ['sys-utils/setarch.8.adoc'] -bashcompletions += ['setarch'] - -setarch_links = ['uname26', 'linux32', 'linux64'] -setarch_links_arch = { - 's390x' : ['s390', 's390x'], - 'x86' : ['i386'], - 'x86_64' : ['i386', 'x86_64'], - 'ppc64' : ['ppc', 'ppc64', 'ppc32'], - 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'], - 'mips64' : ['mips', 'mips64', 'mips32'], - 'ia64' : ['i386', 'ia64'], - 'hppa' : ['parisc', 'parisc64', 'parisc32'], -} -setarch_links += setarch_links_arch.get(host_machine.cpu_family(), []) + install : opt, + build_by_default : opt) +if opt and not is_disabler(exe) + exes += exe + manadocs += ['sys-utils/setarch.8.adoc'] + bashcompletions += ['setarch'] +endif -foreach link: setarch_links - meson.add_install_script(meson_make_symlink, - 'setarch', - join_paths(usrbin_exec_dir, link)) - manlinks += {link + '.8': 'setarch.8'} -endforeach +if opt + setarch_links = ['uname26', 'linux32', 'linux64'] + setarch_links_arch = { + 's390x' : ['s390', 's390x'], + 'x86' : ['i386'], + 'x86_64' : ['i386', 'x86_64'], + 'ppc64' : ['ppc', 'ppc64', 'ppc32'], + 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'], + 'mips64' : ['mips', 'mips64', 'mips32'], + 'ia64' : ['i386', 'ia64'], + 'hppa' : ['parisc', 'parisc64', 'parisc32'], + } + setarch_links += setarch_links_arch.get(host_machine.cpu_family(), []) + + foreach link: setarch_links + meson.add_install_script(meson_make_symlink, + 'setarch', + join_paths(usrbin_exec_dir, link)) + manlinks += {link + '.8': 'setarch.8'} + endforeach +endif opt = not get_option('build-eject').disabled() exe = executable( diff --git a/meson_options.txt b/meson_options.txt index 42469fa67..b2507d228 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -153,6 +153,8 @@ option('build-ldattach', type : 'feature', description : 'build ldattach') option('build-rtcwake', type : 'feature', description : 'build rtcwake') +option('build-setarch', type : 'feature', + description : 'build setarch') option('build-kill', type : 'feature', description : 'build kill') option('build-last', type : 'feature', -- 2.47.3