diff options
author | Kelvin M. Klann <kmk3.code@protonmail.com> | 2022-05-10 15:47:44 -0300 |
---|---|---|
committer | Kelvin M. Klann <kmk3.code@protonmail.com> | 2022-06-30 05:30:14 -0300 |
commit | 011d84b462a78703b9b939cb5e48b4cc75ebe015 (patch) | |
tree | fe2ad82e289323a7749191a6e8f719b011e2b937 /mkdeb.sh | |
parent | Transmission fixes: drop private-lib (#5213) (diff) | |
download | firejail-011d84b462a78703b9b939cb5e48b4cc75ebe015.tar.gz firejail-011d84b462a78703b9b939cb5e48b4cc75ebe015.tar.zst firejail-011d84b462a78703b9b939cb5e48b4cc75ebe015.zip |
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 }'
Diffstat (limited to 'mkdeb.sh')
-rwxr-xr-x | mkdeb.sh | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/mkdeb.sh b/mkdeb.sh new file mode 100755 index 000000000..a98261ba6 --- /dev/null +++ b/mkdeb.sh | |||
@@ -0,0 +1,61 @@ | |||
1 | #!/bin/sh | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2022 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | # based on http://tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/ | ||
7 | # a code archive should already be available | ||
8 | |||
9 | set -e | ||
10 | |||
11 | . "$(dirname "$0")/config.sh" | ||
12 | |||
13 | EXTRA_VERSION=$1 | ||
14 | |||
15 | test "$#" -gt 0 && shift | ||
16 | |||
17 | CODE_ARCHIVE="$NAME-$VERSION.tar.xz" | ||
18 | CODE_DIR="$NAME-$VERSION" | ||
19 | INSTALL_DIR="${INSTALL_DIR}${CODE_DIR}/debian" | ||
20 | DEBIAN_CTRL_DIR="${DEBIAN_CTRL_DIR}${CODE_DIR}/debian/DEBIAN" | ||
21 | |||
22 | echo "*****************************************" | ||
23 | echo "code archive: $CODE_ARCHIVE" | ||
24 | echo "code directory: $CODE_DIR" | ||
25 | echo "install directory: $INSTALL_DIR" | ||
26 | echo "debian control directory: $DEBIAN_CTRL_DIR" | ||
27 | echo "*****************************************" | ||
28 | |||
29 | tar -xJvf "$CODE_ARCHIVE" | ||
30 | #mkdir -p "$INSTALL_DIR" | ||
31 | cd "$CODE_DIR" | ||
32 | ./configure --prefix=/usr "$@" | ||
33 | make -j2 | ||
34 | mkdir debian | ||
35 | DESTDIR=debian make install-strip | ||
36 | |||
37 | cd .. | ||
38 | echo "*****************************************" | ||
39 | SIZE="$(du -s "$INSTALL_DIR")" | ||
40 | echo "install size $SIZE" | ||
41 | echo "*****************************************" | ||
42 | |||
43 | mv "$INSTALL_DIR/usr/share/doc/firejail/RELNOTES" "$INSTALL_DIR/usr/share/doc/firejail/changelog.Debian" | ||
44 | gzip -9 -n "$INSTALL_DIR/usr/share/doc/firejail/changelog.Debian" | ||
45 | rm "$INSTALL_DIR/usr/share/doc/firejail/COPYING" | ||
46 | install -m644 "$CODE_DIR/platform/debian/copyright" "$INSTALL_DIR/usr/share/doc/firejail/." | ||
47 | mkdir -p "$DEBIAN_CTRL_DIR" | ||
48 | sed "s/FIREJAILVER/$VERSION/g" "$CODE_DIR/platform/debian/control.$(dpkg-architecture -qDEB_HOST_ARCH)" > "$DEBIAN_CTRL_DIR/control" | ||
49 | |||
50 | mkdir -p "$INSTALL_DIR/usr/share/lintian/overrides/" | ||
51 | install -m644 "$CODE_DIR/platform/debian/firejail.lintian-overrides" "$INSTALL_DIR/usr/share/lintian/overrides/firejail" | ||
52 | |||
53 | find "$INSTALL_DIR/etc" -type f | sed "s,^$INSTALL_DIR,," | LC_ALL=C sort > "$DEBIAN_CTRL_DIR/conffiles" | ||
54 | chmod 644 "$DEBIAN_CTRL_DIR/conffiles" | ||
55 | find "$INSTALL_DIR" -type d -exec chmod 755 '{}' + | ||
56 | cd "$CODE_DIR" | ||
57 | fakeroot dpkg-deb --build debian | ||
58 | lintian --no-tag-display-limit debian.deb | ||
59 | mv debian.deb "../firejail_${VERSION}${EXTRA_VERSION}_1_$(dpkg-architecture -qDEB_HOST_ARCH).deb" | ||
60 | cd .. | ||
61 | rm -fr "$CODE_DIR" | ||