aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@protonmail.com>2022-05-30 11:34:32 -0400
committerLibravatar GitHub <noreply@github.com>2022-05-30 11:34:32 -0400
commit7ab6c49b43d17e3077d7e32ae04eb649859646fd (patch)
tree1344783a7d0e14053c89c3fe248fc3230e62079d
parentMerge pull request #5158 from hknaack/seamonkey-support-enigmail-gpg (diff)
parentmkdeb.sh.in: pass remaining arguments to ./configure (diff)
downloadfirejail-7ab6c49b43d17e3077d7e32ae04eb649859646fd.tar.gz
firejail-7ab6c49b43d17e3077d7e32ae04eb649859646fd.tar.zst
firejail-7ab6c49b43d17e3077d7e32ae04eb649859646fd.zip
Merge pull request #5154 from kmk3/build-clean-up-dist
mkdeb.sh.in: pass remaining arguments to ./configure
-rw-r--r--.gitlab-ci.yml2
-rw-r--r--Makefile.in2
-rwxr-xr-xcontrib/fj-mkdeb.py38
-rwxr-xr-xmkdeb.sh.in14
4 files changed, 20 insertions, 36 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4871ef031..af590e2e1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -54,7 +54,7 @@ build_apparmor:
54 script: 54 script:
55 - apt-get update -qq 55 - apt-get update -qq
56 - DEBIAN_FRONTEND=noninteractive apt-get install -y -qq build-essential lintian libapparmor-dev pkg-config gawk 56 - DEBIAN_FRONTEND=noninteractive apt-get install -y -qq build-essential lintian libapparmor-dev pkg-config gawk
57 - ./configure --prefix=/usr --enable-apparmor && make deb-apparmor && dpkg -i firejail*.deb 57 - ./configure && make deb-apparmor && dpkg -i firejail*.deb
58 - command -V firejail && firejail --version 58 - command -V firejail && firejail --version
59 - firejail --version | grep -F 'AppArmor support is enabled' 59 - firejail --version | grep -F 'AppArmor support is enabled'
60 60
diff --git a/Makefile.in b/Makefile.in
index 0e80fb43a..7d961213a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -222,7 +222,7 @@ deb: dist
222 ./mkdeb.sh 222 ./mkdeb.sh
223 223
224deb-apparmor: dist 224deb-apparmor: dist
225 ./mkdeb.sh -apparmor 225 ./mkdeb.sh -apparmor --enable-apparmor
226 226
227test-compile: dist 227test-compile: dist
228 cd test/compile; ./compile.sh $(NAME)-$(VERSION) 228 cd test/compile; ./compile.sh $(NAME)-$(VERSION)
diff --git a/contrib/fj-mkdeb.py b/contrib/fj-mkdeb.py
index 60e25fd14..f6611bee8 100755
--- a/contrib/fj-mkdeb.py
+++ b/contrib/fj-mkdeb.py
@@ -3,9 +3,10 @@
3# Copyright (C) 2014-2022 Firejail Authors 3# Copyright (C) 2014-2022 Firejail Authors
4# License GPL v2 4# License GPL v2
5 5
6# This script automates the workaround for https://github.com/netblue30/firejail/issues/772 6# This script automates the creation of a .deb package. It was originally
7# created to work around https://github.com/netblue30/firejail/issues/772
7 8
8import os, shlex, subprocess, sys 9import os, subprocess, sys
9 10
10 11
11def run(srcdir, args): 12def run(srcdir, args):
@@ -15,35 +16,29 @@ def run(srcdir, args):
15 print('Error: Not a firejail source tree? Exiting.') 16 print('Error: Not a firejail source tree? Exiting.')
16 return 1 17 return 1
17 18
18 dry_run = False 19 # Ignore unsupported arguments.
19 escaped_args = []
20 # We need to modify the list as we go. So be sure to copy the list to be iterated!
21 for a in args[:]: 20 for a in args[:]:
22 if a.startswith('--prefix'): 21 if a.startswith('--prefix'):
23 # prefix should ALWAYS be /usr here. Discard user-set values 22 # prefix should ALWAYS be /usr here. Discard user-set values
24 args.remove(a) 23 args.remove(a)
25 elif a == '--only-fix-mkdeb': 24
26 # for us, not configure 25 # Remove generated files.
27 dry_run = True 26 distclean = subprocess.call(['make', 'distclean'])
28 args.remove(a) 27 if distclean != 0:
29 else: 28 return distclean
30 escaped_args.append(shlex.quote(a))
31 29
32 # Run configure to generate mkdeb.sh. 30 # Run configure to generate mkdeb.sh.
33 first_config = subprocess.call(['./configure', '--prefix=/usr'] + args) 31 first_config = subprocess.call(['./configure', '--prefix=/usr'] + args)
34 if first_config != 0: 32 if first_config != 0:
35 return first_config 33 return first_config
36 34
37 # Fix up dynamically-generated mkdeb.sh to include custom configure options. 35 # Create the dist file used by mkdeb.sh.
38 with open('mkdeb.sh', 'rb') as f: 36 make_dist = subprocess.call(['make', 'dist'])
39 sh = str(f.read(), 'utf_8') 37 if make_dist != 0:
40 with open('mkdeb.sh', 'wb') as f: 38 return make_dist
41 f.write(bytes(sh.replace('./configure $CONFIG_ARGS',
42 './configure $CONFIG_ARGS ' + (' '.join(escaped_args))), 'utf_8'))
43
44 if dry_run: return 0
45 39
46 return subprocess.call(['make', 'deb']) 40 # Run mkdeb.sh with the custom configure options.
41 return subprocess.call(['./mkdeb.sh'] + args)
47 42
48 43
49if __name__ == '__main__': 44if __name__ == '__main__':
@@ -51,13 +46,12 @@ if __name__ == '__main__':
51 print('''Build a .deb of firejail with custom configure options 46 print('''Build a .deb of firejail with custom configure options
52 47
53usage: 48usage:
54{script} [--fj-src=SRCDIR] [--only-fix-mkdeb] [CONFIGURE_OPTIONS [...]] 49{script} [--fj-src=SRCDIR] [CONFIGURE_OPTIONS [...]]
55 50
56 --fj-src=SRCDIR: manually specify the location of firejail source tree 51 --fj-src=SRCDIR: manually specify the location of firejail source tree
57 as SRCDIR. If not specified, looks in the parent directory 52 as SRCDIR. If not specified, looks in the parent directory
58 of the directory where this script is located, and then the 53 of the directory where this script is located, and then the
59 current working directory, in that order. 54 current working directory, in that order.
60 --only-fix-mkdeb: don't run configure or make after modifying mkdeb.sh
61 CONFIGURE_OPTIONS: arguments for configure 55 CONFIGURE_OPTIONS: arguments for configure
62'''.format(script=sys.argv[0])) 56'''.format(script=sys.argv[0]))
63 sys.exit(0) 57 sys.exit(0)
diff --git a/mkdeb.sh.in b/mkdeb.sh.in
index 6d6981417..79f8d748c 100755
--- a/mkdeb.sh.in
+++ b/mkdeb.sh.in
@@ -9,20 +9,10 @@
9set -e 9set -e
10NAME=@PACKAGE_NAME@ 10NAME=@PACKAGE_NAME@
11VERSION=@PACKAGE_VERSION@ 11VERSION=@PACKAGE_VERSION@
12PACKAGE_TARNAME=@PACKAGE_TARNAME@
13HAVE_APPARMOR=@HAVE_APPARMOR@
14HAVE_SELINUX=@HAVE_SELINUX@
15EXTRA_VERSION=$1 12EXTRA_VERSION=$1
16 13
17CONFIG_ARGS="--prefix=/usr" 14test "$#" -gt 0 && shift
18if [ -n "$HAVE_APPARMOR" ]; then
19 CONFIG_ARGS="$CONFIG_ARGS --enable-apparmor"
20fi
21if [ -n "$HAVE_SELINUX" ]; then
22 CONFIG_ARGS="$CONFIG_ARGS --enable-selinux"
23fi
24 15
25TOP="$PWD"
26CODE_ARCHIVE="$NAME-$VERSION.tar.xz" 16CODE_ARCHIVE="$NAME-$VERSION.tar.xz"
27CODE_DIR="$NAME-$VERSION" 17CODE_DIR="$NAME-$VERSION"
28INSTALL_DIR="${INSTALL_DIR}${CODE_DIR}/debian" 18INSTALL_DIR="${INSTALL_DIR}${CODE_DIR}/debian"
@@ -38,7 +28,7 @@ echo "*****************************************"
38tar -xJvf "$CODE_ARCHIVE" 28tar -xJvf "$CODE_ARCHIVE"
39#mkdir -p "$INSTALL_DIR" 29#mkdir -p "$INSTALL_DIR"
40cd "$CODE_DIR" 30cd "$CODE_DIR"
41./configure $CONFIG_ARGS 31./configure --prefix=/usr "$@"
42make -j2 32make -j2
43mkdir debian 33mkdir debian
44DESTDIR=debian make install-strip 34DESTDIR=debian make install-strip