From de6249ce221aae4062ea131d4f676f7e3d44af28 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 11 Aug 2019 23:46:25 -0400 Subject: 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 Signed-off-by: Allan McRae --- meson.build | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'meson.build') 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), '', -- cgit v1.2.3-54-g00ecf