]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
meson: Add build-setarch option
authorJordan Williams <jordan@jwillikers.com>
Tue, 23 Apr 2024 13:39:12 +0000 (08:39 -0500)
committerJordan Williams <jordan@jwillikers.com>
Wed, 24 Apr 2024 20:30:30 +0000 (15:30 -0500)
The sys/personality.h header does not exist on macOS.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
meson.build
meson_options.txt

index 90c71b49e8e324640873a1b33e1969a8ffe84956..67181ca05f621fd737cfcf740ce13b1c74e3cdb9 100644 (file)
@@ -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(
index 42469fa67e671b2e3db4d1546dcd666da3abb584..b2507d228ba589547cdbbf42f54224d50d4f967a 100644 (file)
@@ -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',