Commit graph

131 commits

Author SHA1 Message Date
netblue30
4a4bd8a617 testing 2023-02-06 14:13:12 -05:00
netblue30
e6f2374d55 installing etc-cleanup tool in /usr/lib/firejail directory 2023-02-06 09:34:47 -05:00
Kelvin M. Klann
f48886f254 build: mark most phony targets as such
To improve clarity and to prevent unnecessary filesystem lookups.

Overall, this appears to reduce the amount of implicit rule searches by
~4% for the default build and by ~12% for the "man" target (as an
example):

    $ git checkout master >/dev/null 2>&1
    $ git show --pretty='%h %ai %s' -s
    b55cb6a80 2023-01-31 18:56:42 -0500 testing
    $ ./configure >/dev/null
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    7101
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    1239
    # (with this commit applied)
    $ make clean >/dev/null && make --debug=i -j 4     | grep -F 'Trying implicit' | wc -l
    6793
    $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l
    1085

Environment: GNU make 4.4-1 on Artix Linux.

Note: The amount lines printed is the same on non-parallel builds (that
is, without `-j 4`).

See commit 2465f9248 ("makefiles: make all, clean and distclean PHONY",
2021-02-12) / PR #4024 for details.

Note: By "most phony targets" I mean all non-path targets except for the
testing targets, which were being changed recently (for example, the
"test-github" target) and so might still be under development.
2023-02-03 03:47:01 -03:00
netblue30
6d0c7514ed split make test-github into different actions 2023-01-31 14:10:31 -05:00
netblue30
1e6116cf15 testing sysutils 2023-01-31 11:15:21 -05:00
Kelvin M. Klann
d30e709b79 build: sort with C locale when generating syntax lists
To ensure a consistent order.

Misc: This might also make it a bit faster.
2023-01-29 00:57:56 -03:00
Kelvin M. Klann
757e5f4b25 build: make contrib target by default
Make the syntax target by default to make it harder to forget to update
the syntax files.

Note that the syntax files are built mostly silently and that they are
generated relatively fast (they only take 40~70ms to build on a not
exactly recent machine with `make clean; time make -j 4 syntax`), so
they should not add much noise nor time noise when just trying to build
firejail, for example.
2023-01-28 00:05:54 -03:00
Kelvin M. Klann
aad1351ab1 build: auto-generate syntax files
Changes:

* Generate firejail.vim from firejail.vim.in
* Generate firejail-profile.lang from firejail-profile.lang.in
* Update the manual syntax file steps on the new command checklist on
  CONTRIBUTING.md to use `make syntax` instead

Relates to #2679 #5502 #5577 #5612.
2023-01-28 00:05:54 -03:00
Kelvin M. Klann
c7c4f57d13 build: auto-generate syntax lists
Changes:

* Use the commands from contrib/vim/syntax/firejail.vim to create
  makefile targets to generate syntax lists in contrib/syntax/lists
* Add contrib/syntax/files/example.in as an example of how to generate
  syntax files
* Generate and add the syntax lists, to make it easier to spot if they
  are properly updated when a new command is added or if their recipes
  also need changes
* Add "syntax" and "contrib" makefile targets

Note: The generation commands are executed mostly silently to avoid
generating too much noise when also making other targets.

Note2: In some generation commands, a `$$` escape is used to pass `$` to
the shell, to avoid being interpreted by make as the start of a macro.

Note3: `@make_input@` is used in example.in to make it clear that the
file is generated (and that it is generated by make rather than
configure), similarly to how `@configure_input@` is used in configure
input files.  See also apparmor.vim:

    $ head -n 2 /usr/share/vim/vimfiles/syntax/apparmor.vim
    " generated from apparmor.vim.in by create-apparmor.vim.py
    " do not edit this file - edit apparmor.vim.in or create-apparmor.vim.py instead

Environment: apparmor 3.1.2-1 on Artix Linux.

Relates to #2679 #5502 #5577 #5612.
2023-01-27 23:58:30 -03:00
Kelvin M. Klann
88ba851893 build: move syntax files to contrib/syntax/files
Having all of syntax files in the same directory makes it easier to
reference all of them at once on a makefile (such as with
`contrib/syntax/files/*.in`).

Also, this makes the path to the gtksourceview language-spec shorter.
Current path/new path:

* contrib/gtksourceview-5/language-specs/firejail-profile.lang
* contrib/syntax/files/firejail-profile.lang

Currently, adding a rule to the root Makefile to generate the
language-spec in the same directory as an input file would take at least
95 characters (with only a single dependency):

    contrib/gtksourceview-5/language-specs/%.lang: contrib/gtksourceview-5/language-specs/%.lang.in

With this commit, the above shortened to 59 characters:

    contrib/syntax/files/%.lang: contrib/syntax/files/%.lang.in

Which should make it more readable.

Relates to #2679 #5502.
2023-01-27 23:20:40 -03:00
Kelvin M. Klann
fab675241b build: move man page targets to after seccomp filters
The seccomp filters are used by firejail itself at runtime (and are
installed to `$(libdir)`), while the man pages are used by an external
program (and installing them is optional; see `HAVE_MAN`), so reorder
them.

Misc: The seccomp filter targets were apparently added on commit
64431c712 ("seccomp work 1", 2016-11-20).
2023-01-27 02:47:21 -03:00
Kelvin M. Klann
4031155653 build: run commands silently on config targets
And also add an "error: " prefix, to make the output clearer.

Before:

    $ rm -f config.mk; make config.mk
    printf 'run ./configure to generate %s\n' "config.mk" >&2
    run ./configure to generate config.mk
    false
    make: *** No rule to make target 'config.mk'.  Stop.

After:

    $ rm -f config.mk; make config.mk
    error: run ./configure to generate config.mk
    make: *** No rule to make target 'config.mk'.  Stop.

This amends commit e21637ca8 ("makefiles: add generated files as
dependencies", 2022-06-23) / PR #5219.
2023-01-27 02:47:21 -03:00
Kelvin M. Klann
40e7319ed9 build: remove gtksourceview language-spec on uninstall
It is currently only used on the "install" target.

This amends commit 16afd8c8e ("Add basic gtksourceview language-spec
(#5502)", 2022-12-04).
2023-01-24 12:10:48 -03:00
netblue30
c2b6b6b1a3 private-etc rework: remove hiding blacklisted files in private-etc directory feature 2023-01-20 20:06:06 -05:00
netblue30
73361d0ccc cleanup 2023-01-19 00:30:08 -05:00
netblue30
1718982333 more profile fixes/testing 2023-01-19 00:17:47 -05:00
netblue30
8a5ec7b107 some profile updates 2023-01-18 23:18:19 -05:00
netblue30
2d0d9a4080 rel 0.9.72 testing: cleanup make test-private-lib 2023-01-12 11:33:47 -05:00
Kelvin M. Klann
3a368e58ee Revert "remove make deb and use make deb-apparmor to build packages"
This reverts commit 8229944053.

The idea is to later enable building the .deb package with AppArmor by
default with `make deb` and to then remove `make deb-apparmor` (though
note that some ci changes might also be needed in tandem[1]).  This
could potentially allow building a .deb package for all firejail
versions (including past and future ones) with just `make deb`.

Also, note that other options can be added/removed to the default `deb`
target (besides AppArmor-related ones), so ideally there would be only a
single `deb` target with all the desired options applied.

So instead of releasing a version without `make deb` and then
potentially adding it back and removing `make deb-apparmor`, just leave
the targets as is (considering the current release, 0.9.70) for now.

[1] https://github.com/netblue30/firejail/pull/5176#issuecomment-1146855467
2022-12-21 06:32:26 -03:00
netblue30
8229944053 remove make deb and use make deb-apparmor to build packages 2022-12-19 09:53:07 -05:00
rusty-snake
16afd8c8e9
Add basic gtksourceview language-spec (#5502)
Tested with org.gnome.TextEditor.

The gtksourceview language-spec hasn't changed between gtksourceview 3,
4 and 5 AFAIK so it should also work on older systems if you copy/link
the file in the right places.
2022-12-04 16:37:02 +00:00
Kelvin M. Klann
72345b7305 makefiles: include config.mk directly
Instead of including it through src/common.mk.

This allows each makefile to directly override any value defined in
config.mk.
2022-11-21 16:59:43 -03:00
Kelvin M. Klann
e8a37ca101 Makefile: put the all target after variables
This should make it more consistent with the other makefiles (especially
considering the subsequent deduplication commits on this branch) and
enables it to depend on the variables in question (as variables in
dependencies are immediately expanded, at least by default).
2022-11-21 16:59:36 -03:00
netblue30
729b1251cd --icmptrace 2022-10-24 08:35:01 -04:00
glitsj16
9aef909066
build: only install ids.config when --enable-ids is set (#5357)
This PR ensures ids.config only gets installed when --enable-ids is set during configure.
Fixes #5356.
2022-09-04 08:22:29 +00:00
Kelvin M. Klann
7bbcf7eab2 build: use TARNAME instead of NAME for paths
PACKAGE_TARNAME is the same as PACKAGE_NAME but normalized, so it should
be safer to use in paths.  For example, on a downstream project, if
spaces or shell metacharacters are added to the package name, a path
that uses PACKAGE_TARNAME should keep working.

From the manual of GNU Autoconf (version 2.69):

>  -- Macro: AC_INIT (PACKAGE, VERSION, [BUG-REPORT], [TARNAME], [URL])
>      Process any command-line arguments and perform initialization and
>      verification.
>
>      Set the name of the PACKAGE and its VERSION.  These are typically
>      used in '--version' support, including that of 'configure'.  The
>      optional argument BUG-REPORT should be the email to which users
>      should send bug reports.  The package TARNAME differs from
>      PACKAGE: the latter designates the full package name (e.g., 'GNU
>      Autoconf'), while the former is meant for distribution tar ball
>      names (e.g., 'autoconf').  It defaults to PACKAGE with 'GNU '
>      stripped, lower-cased, and all characters other than
>      alphanumerics and underscores are changed to '-'.

Note also that by default (on autoconf v2.69), `docdir=@docdir@` in
config.mk.in expands to the following in config.mk:

    docdir=${datarootdir}/doc/${PACKAGE_TARNAME}
2022-08-14 02:17:39 -03:00
Kelvin M. Klann
9a45c34fc7 build: rename DOCDIR to docdir
To match other similar variables, such as datarootdir and mandir.
2022-08-13 23:38:53 -03:00
Tommy Nguyen
77208e0beb
Add files make uninstall forgot to remove
There were a couple of files leftover after `make uninstall`. This
patch fixes that.
2022-08-01 07:46:51 -04:00
Kelvin M. Klann
e21637ca82 makefiles: add generated files as dependencies
With the previous commit ("makefiles: stop failing when config.mk does
not exist", 2022-06-23), make will not immediately fail when trying to
build a target without having the proper compile-time flags (which are
defined on common.mk).

For example, when running the command below:

    make distclean && make

It will throw an error only after (mis-)compiling multiple objects.

So add a dependency on config.mk on every target that uses output
variables (such as @NAME@ / $(NAME)) on its recipe.  And add a
dependency on config.sh on targets that call shell scripts that use
output variables (such as @NAME@ / $NAME).  Also, add a recipe for
config.mk / config.sh telling to run ./configure, to make it a bit more
obvious just in case.

With this commit, make will abort earlier, by detecting that the
config.mk / config.sh dependency does not exist.  This happens before
trying to execute the recipe.

This also makes the dependencies more accurate, since if config.mk
(which defines some CFLAGS) is changed, the CFLAGS may also have
changed, so a target that uses CFLAGS should probably be considered out
of date in this case anyway.

Relates to #5140.
2022-06-30 05:32:07 -03:00
Kelvin M. Klann
83ae0ed837 makefiles: stop failing when config.mk does not exist
This allows running `make clean` and `make distclean` (and possibly
others) without having to run ./configure beforehand.

Note that some packaging-related targets still depend on the existence
of generated files.  For example:

* dist: config.mk
* deb: config.sh

Commands used to search and replace:

    $ git grep -Elz 'include *([^ ]*/)?config.mk' | xargs -0 -I '{}' \
      sh -c "printf '%s\n' \
      \"\$(sed -E 's|^include *(([^ ]*/)?config.mk)|-include \1|' '{}')\" >'{}'"

Relates to #5140.
2022-06-30 05:32:07 -03:00
Kelvin M. Klann
011d84b462 build: reduce autoconf input files from 32 to 2
Configure summary: autoconf essentially only parses configure.ac and
generates the configure script (that is, the "./configure" shell
script).  The latter is what actually checks what is available on the
system and internally sets the value of the output variables.  It then,
for every filename foo in AC_CONFIG_FILES (and for every output variable
name BAR in AC_SUBST), reads foo.in, replaces every occurrence of
`@BAR@` with the value of the shell variable `$BAR` and generates the
file foo from the result.  After this, configure is finished and `make`
could be executed to start the build.

Now that (as of #5140) all output variables are only defined on
config.mk.in and on config.sh.in, there is no need to generate any
makefile nor any other mkfile or shell script at configure time.  So
rename every "Makefile.in" to "Makefile", mkdeb.sh.in to mkdeb.sh,
src/common.mk.in to src/common.mk and leave just config.mk and config.sh
as the files to be generated at configure time.

This allows editing and committing all makefiles directly, without
potentially having to run ./configure in between.

Commands used to rename the makefiles:

    $ git ls-files -z -- '*Makefile.in' | xargs -0 -I '{}' sh -c \
      "git mv '{}' \"\$(dirname '{}')/Makefile\""

Additionally, from my (rudimentary) testing, this commit reduces the
time it takes to run ./configure by about 20~25% compared to commit
72ece92ea ("Transmission fixes: drop private-lib (#5213)", 2022-06-22).
Environment: dash 0.5.11.5-1, gcc 12.1.0-2, Artix Linux, ext4 on an HDD.

Commands used for benchmarking each commit:

    $ : >time_configure && ./configure && make distclean &&
      for i in $(seq 1 10); do
      { time -p ./configure; } 2>>time_configure; done
    $ grep real time_configure |
      awk '{ total += $2 } END { print total/NR }'
2022-06-30 05:30:14 -03:00
Renamed from Makefile.in (Browse further)