[nautilus/wip/ernestask/seccomp-arches: 1/2] meson.build: Remove libseccomp dependency where unsupported



commit 7df25026229a45f92281329c176e434a28b486d9
Author: Ernestas Kulik <ernestask gnome org>
Date:   Mon Oct 8 14:13:23 2018 +0300

    meson.build: Remove libseccomp dependency where unsupported
    
    A number of CPU architectures are unsupported as far as libseccomp goes.
    This commit expands the current restriction to Linux by checking the
    host CPU.

 meson.build | 40 +++++++++++++++++++++++++++-------------
 1 file changed, 27 insertions(+), 13 deletions(-)
---
diff --git a/meson.build b/meson.build
index b7baa5555..b134702b5 100644
--- a/meson.build
+++ b/meson.build
@@ -58,15 +58,28 @@ add_project_arguments(
   language: 'c'
 )
 
-#####################
-# Operating systems #
-#####################
+######################
+# Host system checks #
+######################
 
-is_linux = host_machine.system() == 'linux'
+host_system = host_machine.system()
+host_cpu = host_machine.cpu()
+unsupported_cpus = [
+  'alpha',
+  'ia64',
+  'm68k',
+  'parisc',
+  'parisc64',
+  'sh4',
+  'sparc64',
+]
+system_supports_seccomp = host_system == 'linux'
+cpu_supports_seccomp = not unsupported_cpus.contains(host_cpu)
+seccomp_required = system_supports_seccomp and cpu_supports_seccomp
 
-#########################
-# End operating systems #
-#########################
+##########################
+# End host system checks #
+##########################
 
 ##################
 # Module imports #
@@ -108,9 +121,11 @@ gmodule = dependency('gmodule-no-export-2.0', version: glib_ver)
 gnome_autoar = dependency('gnome-autoar-0', version: '>= 0.2.1')
 gsettings_desktop_schemas = dependency('gsettings-desktop-schemas')
 gtk = dependency('gtk+-3.0', version: '>= 3.22.27')
-seccomp = []
-if is_linux
+if seccomp_required
+  message('libseccomp required on this platform, make sure bubblewrap is available at runtime as well.')
   seccomp = dependency('libseccomp')
+else
+  seccomp = dependency('', required: false)
 endif
 selinux = []
 if get_option('selinux')
@@ -156,10 +171,9 @@ conf.set_quoted('VERSION', '@0@-@VCS_TAG@'.format(meson.project_version()))
 ###################################################
 # gnome-desktop macros for thumbnailer sandboxing #
 ###################################################
-if is_linux
-  conf.set10('ENABLE_SECCOMP', true)
-  conf.set10('HAVE_BWRAP', true)
-endif
+
+conf.set('ENABLE_SECCOMP', seccomp.found())
+conf.set('HAVE_BWRAP', seccomp.found())
 
 if get_option('packagekit')
   conf.set10('ENABLE_PACKAGEKIT', true)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]