summaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2019-08-12 05:46:25 +0200
committerAllan McRae <allan@archlinux.org>2019-10-07 05:43:37 +0200
commitde6249ce221aae4062ea131d4f676f7e3d44af28 (patch)
tree42c10fed40bc0fe591c8e38fb136afd433e00bf5 /meson.build
parent2a792ac7bb1ceda42767c696e2664819b47ffc3b (diff)
downloadpacman-de6249ce221aae4062ea131d4f676f7e3d44af28.tar.gz
pacman-de6249ce221aae4062ea131d4f676f7e3d44af28.tar.xz
Support file with seccomp enabled
Not all compression types can be detected in the seccomp sandbox, so we need to disable it. This requires either configuring makepkg to know the sandbox is available, or checking for file >= 5.38 in which the sandbox option is a no-op even when seccomp is disabled. - Requires autoconf-archive for autotools version compare macro. - meson version comparison could be made a lot simpler using meson-git. Fixes FS#58626 Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build10
1 files changed, 10 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 453e2282..7be2425c 100644
--- a/meson.build
+++ b/meson.build
@@ -220,12 +220,20 @@ config_h = configure_file(
configuration : conf)
add_project_arguments('-include', 'config.h', language : 'c')
+filecmd = 'file'
default_sedinplaceflags = ' --follow-symlinks -i'
inodecmd = 'stat -c \'%i %n\''
strip_binaries = '--strip-all'
strip_shared = '--strip-unneeded'
strip_static = '--strip-debug'
+file_seccomp = get_option('file-seccomp')
+# meson-git has find_program('file', required: false, version: '>=5.38')
+filever = run_command('sh', '-c', 'file --version | sed -n "s/^file-\(.*\)/\\1/p"').stdout()
+if file_seccomp.enabled() or ( file_seccomp.auto() and filever.version_compare('>= 5.38') )
+ filecmd = 'file -S'
+endif
+
os = host_machine.system()
if os.startswith('darwin')
inodecmd = '/usr/bin/stat -f \'%i %n\''
@@ -268,6 +276,7 @@ substs.set('BUILDSCRIPT', BUILDSCRIPT)
substs.set('TEMPLATE_DIR', get_option('makepkg-template-dir'))
substs.set('DEBUGSUFFIX', get_option('debug-suffix'))
substs.set('INODECMD', inodecmd)
+substs.set('FILECMD', filecmd)
substs.set('SEDINPLACEFLAGS', sedinplaceflags)
substs.set('SEDPATH', SED.path())
substs.set('LIBMAKEPKGDIR', LIBMAKEPKGDIR)
@@ -424,6 +433,7 @@ message('\n '.join([
' Host Type : @0@'.format(chost),
' File inode command : @0@'.format(inodecmd),
' In-place sed command : @0@ @1@'.format(SED.path(), sedinplaceflags),
+ ' File seccomp command : @0@'.format(filecmd),
' libalpm version : @0@'.format(libalpm_version),
' pacman version : @0@'.format(PACKAGE_VERSION),
'',