aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Williams <jordan@jwillikers.com>2024-04-23 08:39:12 -0500
committerJordan Williams <jordan@jwillikers.com>2024-04-24 15:30:30 -0500
commit17146fbf1bb4c93db53bd741f1484327c729631d (patch)
tree500faf14cae078063a1159dcd01a355db51d3a7f
parentfa907a8810d9a0e7049a01828e2dd0d53567cf0a (diff)
downloadutil-linux-17146fbf1bb4c93db53bd741f1484327c729631d.tar.gz
meson: Add build-setarch option
The sys/personality.h header does not exist on macOS. Signed-off-by: Jordan Williams <jordan@jwillikers.com>
-rw-r--r--meson.build52
-rw-r--r--meson_options.txt2
2 files changed, 31 insertions, 23 deletions
diff --git a/meson.build b/meson.build
index 90c71b49e8..67181ca05f 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 42469fa67e..b2507d228b 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',