Skip to content

Commit ac7a33a

Browse files
committed
WIP: meson build system
Rebased and updated from #4656 by rusty-snake.
1 parent 5bf2e28 commit ac7a33a

File tree

15 files changed

+188
-119
lines changed

15 files changed

+188
-119
lines changed

.github/workflows/build-extra.yml

+5-24
Original file line numberDiff line numberDiff line change
@@ -61,32 +61,13 @@ jobs:
6161
libapparmor-dev libselinux1-dev
6262
- name: print env
6363
run: ./ci/printenv.sh
64-
- uses: actions/checkout@v2
6564
- name: install dependencies
6665
run: sudo apt-get install ninja-build
6766
- name: Install meson
68-
run: pip install --pre meson==0.49.2
67+
run: pip install --pre meson==0.56.2 # https://packages.debian.org/oldstable/meson
6968
- name: meson setup
70-
run: CC=clang-11 meson _builddir --werror
69+
run: CC=clang-14 meson setup _builddir -Dprefix=/usr -Dapparmor=true -Dselinux=true --werror
7170
- name: meson compile
72-
run: ninja -C _builddir
73-
scan-build:
74-
runs-on: ubuntu-20.04
75-
steps:
76-
- uses: actions/checkout@v2
77-
- name: install dependencies
78-
run: sudo apt-get install clang-tools-11 ninja-build
79-
- name: Install meson
80-
run: pip install --pre meson
81-
- name: meson setup
82-
run: CC=clang-11 meson _builddir --werror
83-
- name: scan-build
84-
run: ninja -C _builddir scan-build
85-
cppcheck:
86-
runs-on: ubuntu-20.04
87-
steps:
88-
- uses: actions/checkout@v2
89-
- name: install cppcheck
90-
run: sudo apt-get install cppcheck
91-
- name: cppcheck
92-
run: cppcheck -q --force --error-exitcode=1 --enable=warning,performance .
71+
run: meson compile -C _builddir
72+
- name: meson install
73+
run: meson install -C _builddir

.github/workflows/build.yml

+4-8
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,14 @@ jobs:
7474
- name: install dependencies
7575
run: >
7676
sudo apt-get install -qy
77-
gcc-12 libapparmor-dev libselinux1-dev expect ninja-build xzdec
77+
gcc-12 libapparmor-dev libselinux1-dev ninja-build
7878
- name: print env
7979
run: ./ci/printenv.sh
8080
- name: Install meson
8181
run: pip install meson
8282
- name: meson setup
83-
run: CC=gcc-11 meson _builddir --werror --prefix=/usr -Danalyzer=true -Dapparmor=true -Dselinux=true
83+
run: CC=gcc-12 meson setup _builddir --werror --prefix=/usr -Danalyzer=true -Dapparmor=true -Dselinux=true
8484
- name: meson compile
85-
run: ninja -C _builddir
85+
run: meson compile -C _builddir
8686
- name: meson install
87-
run: sudo -E ninja -C _builddir install
88-
# TODO: Why do we run this for profile changes?
89-
# TODO: meson test
90-
#- name: meson test
91-
# run: SHELL=/bin/bash meson test
87+
run: sudo -E meson install -C _builddir

.github/workflows/requirements.txt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
meson==1.3.1 \
2+
--hash=sha256:6020568bdede1643d4fb41e28215be38eff5d52da28ac7d125457c59e0032ad7 \
3+
--hash=sha256:d5223ecca9564d735d36daaba2571abc6c032c8c3a7ffa0674e803ef0c7e0219
4+
ninja==1.11.1.1 \
5+
--hash=sha256:18302d96a5467ea98b68e1cae1ae4b4fb2b2a56a82b955193c637557c7273dbd \
6+
--hash=sha256:185e0641bde601e53841525c4196278e9aaf4463758da6dd1e752c0a0f54136a \
7+
--hash=sha256:376889c76d87b95b5719fdd61dd7db193aa7fd4432e5d52d2e44e4c497bdbbee \
8+
--hash=sha256:3e0f9be5bb20d74d58c66cc1c414c3e6aeb45c35b0d0e41e8d739c2c0d57784f \
9+
--hash=sha256:73b93c14046447c7c5cc892433d4fae65d6364bec6685411cb97a8bcf815f93a \
10+
--hash=sha256:7563ce1d9fe6ed5af0b8dd9ab4a214bf4ff1f2f6fd6dc29f480981f0f8b8b249 \
11+
--hash=sha256:76482ba746a2618eecf89d5253c0d1e4f1da1270d41e9f54dfbd91831b0f6885 \
12+
--hash=sha256:84502ec98f02a037a169c4b0d5d86075eaf6afc55e1879003d6cab51ced2ea4b \
13+
--hash=sha256:95da904130bfa02ea74ff9c0116b4ad266174fafb1c707aa50212bc7859aebf1 \
14+
--hash=sha256:9d793b08dd857e38d0b6ffe9e6b7145d7c485a42dcfea04905ca0cdb6017cc3c \
15+
--hash=sha256:9df724344202b83018abb45cb1efc22efd337a1496514e7e6b3b59655be85205 \
16+
--hash=sha256:aad34a70ef15b12519946c5633344bc775a7656d789d9ed5fdb0d456383716ef \
17+
--hash=sha256:d491fc8d89cdcb416107c349ad1e3a735d4c4af5e1cb8f5f727baca6350fdaea \
18+
--hash=sha256:ecf80cf5afd09f14dcceff28cb3f11dc90fb97c999c89307aea435889cb66877 \
19+
--hash=sha256:fa2ba9d74acfdfbfbcf06fad1b8282de8a7a8c481d9dee45c859a8c93fcc1082

config.sh.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# @configure_input@
1+
# configure_input
22
#
33
# shellcheck shell=sh
44
# shellcheck disable=SC2034

contrib/meson.build

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
contrib_scripts = [
2-
'firejail-welcome.sh',
32
'fix_private-bin.py',
43
'fjclip.py',
54
'fjdisplay.py',
@@ -19,6 +18,6 @@ install_data(contrib_scripts,
1918
install_data('vim/ftdetect/firejail.vim',
2019
install_dir: datadir / 'vim' / 'vimfiles' / 'ftdetect',
2120
)
22-
install_data('vim/syntax/firejail.vim',
21+
install_data('syntax/files/firejail.vim.in',
2322
install_dir: datadir / 'vim' / 'vimfiles' / 'syntax',
2423
)

meson.build

+22-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ project('firejail', 'c',
77
'b_pie=true',
88
],
99
# https://packages.debian.org/oldstable/meson
10-
meson_version: '>=0.49.2',
11-
version: '0.9.67',
10+
meson_version: '>=0.56.2',
11+
version: '0.9.73',
1212
)
1313

1414
# # # # # # # # # #
@@ -75,14 +75,17 @@ foreach option, flag : {
7575
'firetunnel': '-DHAVE_FIRETUNNEL',
7676
'force-nonewprivs': '-DHAVE_FORCE_NONEWPRIVS',
7777
'globalcfg': '-DHAVE_GLOBALCFG',
78+
'ids': '-DHAVE_IDS',
7879
'lts': '-DHAVE_LTS',
7980
'network': '-DHAVE_NETWORK',
8081
'output': '-DHAVE_OUTPUT',
82+
# 'overlayfs': '-DHAVE_OVERLAYFS',
8183
'private-home': '-DHAVE_PRIVATE_HOME',
8284
'selinux': '-DHAVE_SELINUX',
8385
'suid': '-DHAVE_SUID',
8486
'userns': '-DHAVE_USERNS',
8587
'usertmpfs': '-DHAVE_USERTMPFS',
88+
# 'whitelist': '-DHAVE_WHITELIST',
8689
'x11': '-DHAVE_X11',
8790
}
8891

@@ -148,13 +151,16 @@ if show_summary and meson.version().version_compare('>=0.53.0')
148151
summary('firetunnel', get_option('firetunnel'), section: 'Facilities')
149152
summary('force-nonewprivs', get_option('force-nonewprivs'), section: 'Facilities')
150153
summary('globalcfg', get_option('globalcfg'), section: 'Facilities')
154+
summary('ids', get_option('ids'), section: 'Facilities')
151155
summary('network', get_option('network'), section: 'Facilities')
152156
summary('output', get_option('output'), section: 'Facilities')
157+
summary('overlayfs', get_option('overlayfs'), section: 'Facilities')
153158
summary('private-home', get_option('private-home'), section: 'Facilities')
154159
summary('selinux', get_option('selinux'), section: 'Facilities')
155160
summary('suid', get_option('suid'), section: 'Facilities')
156161
summary('userns', get_option('userns'), section: 'Facilities')
157162
summary('usertmpfs', get_option('usertmpfs'), section: 'Facilities')
163+
summary('whitelist', get_option('whitelist'), section: 'Facilities')
158164
summary('x11', get_option('x11'), section: 'Facilities')
159165

160166
summary('lts', get_option('lts'), section: 'LTS')
@@ -163,3 +169,17 @@ if show_summary and meson.version().version_compare('>=0.53.0')
163169
summary('contrib', get_option('contrib'), section: 'Misc')
164170
summary('manpage', get_option('manpage'), section: 'Misc')
165171
endif
172+
173+
conf = configuration_data()
174+
conf.set('PACKAGE_BUGREPORT', '[email protected]')
175+
conf.set('PACKAGE_NAME', 'firejail')
176+
conf.set('PACKAGE_STRING', 'firejail ' + meson.project_version())
177+
conf.set('PACKAGE_TARNAME', 'firejail')
178+
conf.set('PACKAGE_VERSION', meson.project_version())
179+
conf.set_quoted('PACKAGE_URL', 'https://firejail.wordpress.com')
180+
181+
test_config_sh = configure_file(
182+
configuration: conf,
183+
input: 'config.sh.in',
184+
output: '@BASENAME@',
185+
)

meson_options.txt

+6
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ option('force-nonewprivs', type: 'boolean', value: true,
1717
description: 'force nonewprivs')
1818
option('globalcfg', type: 'boolean', value: true,
1919
description: 'Abort execution if the global config is not present')
20+
option('ids', type: 'boolean', value: false,
21+
description: 'IDS support')
2022
option('network', type: 'boolean', value: true,
2123
description: 'network')
2224
option('output', type: 'boolean', value: true,
2325
description: '--output logging')
26+
option('overlayfs', type: 'boolean', value: true,
27+
description: 'overlayfs support')
2428
option('private-home', type: 'boolean', value: true,
2529
description: 'private home feature')
2630
option('selinux', type: 'boolean', value: false,
@@ -31,6 +35,8 @@ option('userns', type: 'boolean', value: true,
3135
description: 'user namespace')
3236
option('usertmpfs', type: 'boolean', value: true,
3337
description: 'tmpfs as regular user')
38+
option('whitelist', type: 'boolean', value: true,
39+
description: 'whitelist support')
3440
option('x11', type: 'boolean', value: true,
3541
description: 'X11 sandboxing support')
3642

src/firejail/meson.build

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ firejail_sources = [
55
'arp.c',
66
'bandwidth.c',
77
'caps.c',
8-
'cgroup.c',
98
'checkcfg.c',
109
'chroot.c',
1110
'cmdline.c',
@@ -28,6 +27,7 @@ firejail_sources = [
2827
'fs_whitelist.c',
2928
'ids.c',
3029
'join.c',
30+
'landlock.c',
3131
'ls.c',
3232
'macros.c',
3333
'mountinfo.c',
@@ -36,9 +36,11 @@ firejail_sources = [
3636
'network.c',
3737
'network_main.c',
3838
'no_sandbox.c',
39+
'oom.c',
3940
'output.c',
4041
'paths.c',
4142
'preproc.c',
43+
'process.c',
4244
'profile.c',
4345
'protocol.c',
4446
'pulseaudio.c',

src/firemon/meson.build

-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ firemon_sources = [
33
'apparmor.c',
44
'arp.c',
55
'caps.c',
6-
'cgroup.c',
76
'cpu.c',
8-
'interface.c',
97
'list.c',
108
'netstats.c',
119
'procevent.c',

src/fseccomp/meson.build

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
fseccomp_sources = [
22
'main.c',
33
'protocol.c',
4+
'namespaces.c',
45
'seccomp.c',
56
'seccomp_file.c',
67
'seccomp_secondary.c',

src/man/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ foreach manpage : manpages
2323
section = manpage.split('.')[1]
2424
configured_manpage = configure_file(
2525
configuration: manconf,
26-
input: manpage.split('.')[0] + '.txt',
26+
input: manpage + '.in',
2727
output: '@PLAINNAME@',
2828
)
2929
custom_target(manpage,

src/meson.build

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ subdir('profstats')
2121

2222
# SBOX_APPS
2323
subdir('fbuilder')
24-
subdir('fids')
24+
if get_option('ids')
25+
subdir('fids')
26+
endif
2527
subdir('ftee')
2628

2729
# SBOX_APPS_NON_DUMPABLE

test/build-test.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
set -e
4+
src=$1
5+
dir=$2
6+
build=$3
7+
log=test/${dir}.log
8+
9+
echo src:$src
10+
echo dir:$dir
11+
echo log:$log
12+
echo build:$build
13+
14+
(cd $src/$dir && BUILD_ROOT=$build ./${dir}.sh 2>&1) | tee $log
15+
grep -a TESTING $log && ! grep -a -q "TESTING ERROR" $log
16+
17+
exit 0

0 commit comments

Comments
 (0)