Commit graph

100 commits

Author SHA1 Message Date
Kelvin M. Klann
68d06a1359 build: sort/split some install commands
For increased consistency and readability.
2024-06-02 12:08:41 -03:00
Kelvin M. Klann
e30c57eebf build: use -t in applicable install commands
For increased consistency and readability.
2024-06-02 12:08:41 -03:00
Kelvin M. Klann
5430535a27 build: stop checking for dir existence on install
Just try to install them, as is done in the other `$(INSTALL) -d`
commands.
2024-06-02 12:08:41 -03:00
Kelvin M. Klann
afdb371f27 build: fix some inconsistencies in install commands
Changes:

* Remove / after `$(DESTDIR)`
* Remove useless -c
* Use 0755 instead of 755
* Use -d after -m

See also commit dae3933bc ("rework make realinstall and uninstall
(#3435)", 2020-06-04).
2024-06-02 12:08:41 -03:00
Kelvin M. Klann
6b35ed7997 build: remove redundant parent dir install
The command below already installs it.

Added on commit 926790411 ("add basic Firejail support to AppArmor base
abstraction (#3226)", 2021-10-21) / PR #4628.
2024-06-02 12:08:36 -03:00
Kelvin M. Klann
c633ba3ead build: line-break sh install commands
And remove the extraneous semicolon at the end of the command string.

See also commit dae3933bc ("rework make realinstall and uninstall
(#3435)", 2020-06-04).
2024-06-02 12:02:23 -03:00
Kelvin M. Klann
fb11081bec build: allow overriding common tools
Tools:

* gzip
* install
* rm
* strip
* tar

For the programs not checked in configure.ac:

From the manual of GNU Autoconf (version 2.71):

> If you use `AC_PROG_INSTALL`, you must include `install-sh` in your
> distribution

So set `install` just in the Makefile.  Use `$(RM)` to ensure that `-f`
is always used and to make it easier to spot when `-r` is used.

See commit 93d623fdf ("build: allow overriding certain tools",
2024-02-23) / PR #6222.
2024-05-29 17:35:35 -03:00
Kelvin M. Klann
753d199bc9
build: remove clean dependency from cppcheck targets (#6343)
Cleaning does not appear to make a difference; the same amount of files
is checked with/without cleaning.

Environment: cppcheck 2.12.0-3 on Artix Linux.

Added on commit 4e22add64 ("llvm scan", 2015-11-29).

This is a follow-up to #6222.
2024-05-20 03:43:40 +00:00
Kelvin M. Klann
97de0e08b9 build: remove redundant realinstall target
Leave just the "install" and "install-strip" targets.

See commit 099925e18 ("added install-strip, make install now without
strip.", 2015-09-10) / PR #60 and commit 0215cbc02 ("make install, make
install-strip", 2015-09-11).
2024-05-17 03:45:02 -03:00
Kelvin M. Klann
8748d76e80 build: add a standalone strip target
Move the strip invocation into its own target to allow stripping
binaries without having to run the "realinstall" target.
2024-05-17 03:45:02 -03:00
Kelvin M. Klann
c9531d95ed build: add print-version target and use in CI
To reduce TARNAME hardcoding.

Added on commit 6a89ab023 ("ci: run firejail --version after
build/install", 2022-05-16) / PR #5148.
2024-02-29 08:52:24 -03:00
Kelvin M. Klann
1f6400bd89 build: sync scan-build target with CI
Changes:

* Use --status-bugs in the scan-build target to exit with an error if
  bugs are found
* Call the make target in the CI job
2024-02-24 18:53:07 -03:00
Kelvin M. Klann
f4f7a814e7 build: sync cppcheck targets with CI
Changes:

* Use the same command from the cppcheck CI job in the cppcheck target
* Add cppcheck-old target based on the cppcheck_old CI job
* Call the make targets in CI to avoid duplicating the commands
2024-02-24 18:53:06 -03:00
Kelvin M. Klann
93d623fdf9 build: allow overriding certain tools
Allow overriding the following tools at configure-time and build-time:

* codespell
* cppcheck
* gawk
* scan-build

For example, instead of hardcoding `gawk`, enable overriding it at
configure-time with:

    ./configure GAWK=/path/to/gawk

To override it for a single `make` invocation:

    make GAWK=/path/to/gawk

Also, add default values for the programs that are not found (rather
than leaving the variables empty), to make error messages clearer when
trying to run them:

    $ make CPPCHECK= cppcheck-old
    [...]
    force --error-exitcode=1 --enable=warning,performance .
    make: force: No such file or directory
    $ make CPPCHECK=cppcheck cppcheck-old
    [...]
    cppcheck --force --error-exitcode=1 --enable=warning,performance .
    make: cppcheck: No such file or directory
2024-02-24 18:50:43 -03:00
Kelvin M. Klann
6815d71cff build: fix running make clean with undefined vars
In the `debian_ci` job in .gitlab-ci.yml, dpkg-deb calls `make
distclean` before calling ./configure, which makes `make clean` fail due
to certain variables not being declared:

     dpkg-source -i -I --before-build .
    [...]
       dh_auto_clean
    	make -j2 distclean
    make[1]: Entering directory '/builds/kmk3/firejail_ci'
    error: run ./configure to generate config.mk
    [...]
    rm -f contrib/syntax/files/example [...]
    rm -fr - -.tar.xz
    rm: invalid option -- '.'
    Try 'rm --help' for more information.
    make[1]: *** [Makefile:175: clean] Error 1

This amends commit 8a783cdc2 ("build: use TARNAME and remove more paths
on clean", 2023-07-29) / PR #6186.
2024-02-07 09:45:41 -03:00
Kelvin M. Klann
71ffe7ac8f
Merge pull request #6186 from kmk3/build-improve-clean
build: improve main clean target
2024-02-04 23:25:23 +00:00
Kelvin M. Klann
58e0b5c01b build: fix codespell warnings
Warnings:

    $ make codespell
    Running codespell...
    ./README:757: Manuel ==> Manual
    ./RELNOTES:269: relpaced ==> replaced
    ./src/firecfg/desktop_files.c:60: diectory ==> directory
    ./platform/debian/control.i386:11: namepaces ==> namespaces
    ./platform/debian/control.amd64:11: namepaces ==> namespaces
    make: *** [Makefile:383: codespell] Error 65
    $ codespell --version
    2.2.6
2024-02-01 22:31:18 -03:00
Kelvin M. Klann
b23f484df9 build: ignore depfiles on codespell
This amends commit e665769f5 ("build: automatically generate header
dependencies", 2023-07-05) / PR #6164.
2024-02-01 22:20:08 -03:00
Kelvin M. Klann
8a783cdc2f build: use TARNAME and remove more paths on clean 2024-02-01 19:28:43 -03:00
Kelvin M. Klann
152a21f151 build: simplify clean target
Move some clean commands into more relevant makefiles.
2024-01-31 17:37:05 -03:00
Kelvin M. Klann
3675da93ae build: remove redundant clean commands 2024-01-31 17:06:39 -03:00
Kelvin M. Klann
4909a2add1 build: sort clean commands 2024-01-31 17:06:39 -03:00
netblue30
2033e98e79
Merge pull request #5876 from kmk3/firecfg-add-confdir-ignore
feature: firecfg: add firecfg.d & add ignore command
2023-12-04 09:11:08 -05:00
Kelvin M. Klann
ce6fb3a8dd build: add missing dbus/x11 commands to arg1 list
Fix the list generation and run `make syntax`.

Relates to #5627.
2023-09-06 03:19:32 -03:00
Kelvin M. Klann
b589045b0f ci: use path whitelists instead of blacklists
That is, replace `paths-ignore` with `paths`.

This should reduce the number of unnecessary workflow executions and the
frequency at which paths are changed.  It also reduces the overall
number of paths used.

Also, add the missing ci/printenv.sh to the path whitelists.
2023-08-20 06:20:40 -03:00
Kelvin M. Klann
bfcf8bc31a
Merge pull request #5956 from kmk3/build-fix-dep-syntax
build: add missing makefile dep & syntax improvements
2023-08-14 21:37:50 +00:00
Kelvin M. Klann
204c45adee build: improve char escaping of syntax lists
Escape `.` only when generating the syntax files rather than directly in
the syntax lists, so that the latter contain the command names as is.

This also makes the escaping apply to the arg1 syntax list as well.

Note: Double escaping (`\\\\.`) is used in `regex_fromlf` because its
output is used in another sed replacement (where it needs to be `\\.`).

Relates to #5627.
2023-08-14 18:16:10 -03:00
Kelvin M. Klann
b2821a3448 build: run codespell on almost all files
Ignore only third-party/vendored files (such as license files and files
in m4/).

And ignore more words to fix the following errors:

    $ make codespell
    Running codespell...
    ./README:484: als ==> also
    ./README:646: Shotcut ==> Shortcut
    ./RELNOTES:516: als ==> also
    ./etc/inc/disable-common.inc:506: chage ==> change, charge
    ./etc/apparmor/firejail-default:35: readby ==> read, read by
    ./etc/apparmor/firejail-default:36: readby ==> read, read by
    ./etc/profile-a-l/als.profile:1: als ==> also
    ./etc/profile-a-l/als.profile:5: als ==> also
    make: *** [Makefile:374: codespell] Error 65
    $ codespell --version
    2.2.5
2023-08-14 04:32:51 -03:00
Kelvin M. Klann
ffb05aef6d build: codespell: remove dependency on "clean"
It works just fine without it (at least for the files in src/).

Note that by default codespell does not warn about binary files ("The
default mask is 34"):

    $ make -j "$(nproc)" >/dev/null
    $ make codespell
    codespell --ignore-regex "UE|creat|doas|ether|isplay|shotcut" src test
    $ codespell --version
    2.2.5
    $ codespell --help
    [...]
      -q QUIET_LEVEL, --quiet-level QUIET_LEVEL
                            bitmask that allows suppressing messages:
                            - 0: print all messages.
                            - 1: disable warnings about wrong encoding.
                            - 2: disable warnings about binary files.
                            - 4: omit warnings about automatic fixes that were
                              disabled in the dictionary.
                            - 8: don't print anything for non-automatic fixes.
                            - 16: don't print the list of fixed files.
                            - 32: don't print configuration files.
                            As usual with bitmasks, these levels can be combined;
                            e.g. use 3 for levels 1+2, 7 for 1+2+4, 23 for
                            1+2+4+16, etc. The default mask is 34.

Also, note that adding many ignore patterns (such as all of the ones in
.gitignore) makes it slower than letting codespell find and skip binary
files by itself.  So just add the most common ones, which do not
noticeably change how fast codespell runs either but they do reduce the
noise when running with `-q 0`.

Homepage: https://github.com/codespell-project/codespell

Added on commit d78fc96ee ("codespell github action", 2023-03-05).
2023-08-13 23:23:31 -03:00
Kelvin M. Klann
c619f13ea0 build: print syntax list generation
Relates to #5627.
2023-08-12 22:43:46 -03:00
Kelvin M. Klann
8e79f18cf9 build: add missing makefile dep
Make the non-phony targets that are defined in the root Makefile depend
on it, to ensure that they get re-generated if their recipes change.

Note that these targets are generated nearly instantly, so this should
not noticeably affect rebuild times.

Relates to #5627.
2023-08-12 22:43:46 -03:00
Kelvin M. Klann
2300980849 build: fix codespell errors
This fixes the following errors:

    $ make codespell
    [...]
    codespell --ignore-regex "UE|creat|doas|shotcut|ether" src test
    src/firemon/procevent.c:188: duble ==> double
    src/fnettrace/main.c:30: postive ==> positive
    src/fnettrace/main.c:30: defiend ==> defined
    src/fnettrace/main.c:482: isplay ==> display
    make: *** [Makefile:371: codespell] Error 65
    $ codespell --version
    2.2.5

Added in the following commits:

* bef5d86a1 ("increase socket buffer size for firemon, bug #2700",
  2019-09-29)
* c4962789f ("nettrace stats", 2023-08-08)
2023-08-12 03:36:53 -03:00
Kelvin M. Klann
2993298aaa firecfg: parse config files in /etc/firejail/firecfg.d
As suggested by @WhyNotHugo[1].

[1] https://github.com/netblue30/firejail/issues/2097#issuecomment-1179160459
2023-08-04 17:25:20 -03:00
Kelvin M. Klann
200f389ed0 build: use config.sh in more scripts
This removes the need to manually pass variables such as `$(TARNAME)`
and `$(VERSION)` to shell scripts in the root Makefile.

Relates to #5140.
2023-07-28 14:10:31 -03:00
Kelvin M. Klann
701c0282b8
Merge pull request #5916 from kmk3/build-improve-dist
build: dist and asc improvements
2023-07-27 12:48:15 +00:00
Kelvin M. Klann
e0e597ab55 build: make asc use config.sh
Similarly to mkdeb.sh.

Relates to #5140.
2023-07-27 09:33:23 -03:00
Kelvin M. Klann
640bb303d1 build: make dist depend on just clean
The clean target is currently enough to remove all generated files other
than the ones directly in the root directory, so to simplify the dist
target, make it depend on clean instead of distclean.

See commit 5f2785290 ("build: remove unnecessary distclean targets",
2023-07-15) / PR #5911.

Relates to #5142 #5182.
2023-07-27 09:33:23 -03:00
netblue30
8e4b847cdd split nettrace executable ^Cto netrace and netlock 2023-07-25 10:22:59 -04:00
Kelvin M. Klann
ce21a299aa build: remove remaining svn-related code
The only other svn-related code seems to have been removed on commit
7e1c057ae ("make testing", 2016-04-23).
2023-07-24 13:18:43 -03:00
Kelvin M. Klann
64c5ebaf0b build: sort DISTFILES_TEST 2023-07-24 13:18:43 -03:00
Kelvin M. Klann
de84b4d1cf build: format DISTFILES / DISTFILES_TEST 2023-07-24 13:18:43 -03:00
Kelvin M. Klann
5f27852906 build: remove unnecessary distclean targets
This also fixes the duplicate execution of the "clean" targets.
2023-07-20 05:03:47 -03:00
Kelvin M. Klann
8ee610eb10 build: fix hardcoded make in recursive make calls
Use the `$(MAKE)` macro to ensure that the same make program is used in
the recursive invocation.

Note: Most recursive calls already use `$(MAKE)`.
2023-07-20 05:03:47 -03:00
Kelvin M. Klann
580283d74b disable-common.inc: blacklist sudo/doas paths in /etc
Commands used to find the relevant paths in /etc:

    $ pacman -Qo /etc/* 2>/dev/null | grep sudo | LC_ALL=C sort
    /etc/pam.d/ is owned by sudo 1.9.14.p1-1
    /etc/sudo.conf is owned by sudo 1.9.14.p1-1
    /etc/sudo_logsrvd.conf is owned by sudo 1.9.14.p1-1
    /etc/sudoers is owned by sudo 1.9.14.p1-1
    /etc/sudoers.d/ is owned by sudo 1.9.14.p1-1

Environment: Artix Linux.

Also, add missing paths sudo/doas to etc/ids.config and jailcheck.

See also commit dbebd71db ("disable-common.inc: blacklist doas binary",
2022-10-05).

Relates to #5385.

Reported-by: Dieter Plaetinck <dieter@plaetinck.be>
2023-07-14 08:08:47 -03:00
Kelvin M. Klann
76bd5ad0f8 build: simplify code related to man pages
Simplify the main targets and use wildcards instead of repeating the
filenames manually.

Also, restore the `man` target and building only when `HAVE_MAN` is
enabled.

Note: Make automatically removes intermediate files (.1 and .5), so in
general only the .gz files have to be cleaned.

Commands used to rename the man pages:

    cd src/man
    git mv firecfg.txt firecfg.1.in
    git mv firejail-login.txt firejail-login.5.in
    git mv firejail-profile.txt firejail-profile.5.in
    git mv firejail-users.txt firejail-users.5.in
    git mv firejail.txt firejail.1.in
    git mv firemon.txt firemon.1.in
    git mv jailcheck.txt jailcheck.1.in

This is kind of a follow-up to commit 9e206b7f2 ("rework src/man
Makefile", 2023-07-07).
2023-07-13 11:43:53 -03:00
Kelvin M. Klann
80eb28483f build: restore seccomp filter targets
This partially reverts commit 2b34747db ("generate seccomp filters at
install time", 2023-07-07).  See also commit 6fa19aab9 ("feature: use
seccomp filters build at install time for --restrict-namespaces",
2023-07-12).

The seccomp filters were always being built because
src/fseccomp/fseccomp (and other programs) are in `$(ALL_ITEMS)`, which
is incorrectly marked as phony.  This commit fixes that and restores the
previous target logic, for consistency with the other targets and so
that the seccomp filters are made at build time rather than at install
time.
2023-07-13 07:26:42 -03:00
netblue30
6fa19aab98 feature: use seccomp filters build at install time for --restrict-namespaces 2023-07-12 09:31:49 -04:00
netblue30
1d5fff9034 Makefile fix 2023-07-10 15:13:58 -04:00
netblue30
2b34747db5 generate seccomp filters at install time 2023-07-07 19:34:55 -04:00
netblue30
9e206b7f2c rework src/man Makefile 2023-07-07 14:01:20 -04:00