From 0d200264b1bc04304ae5dcb70f8bcc7ae3b358cc Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Sat, 13 Aug 2022 15:55:53 -0300 Subject: [PATCH 1/5] config.mk.in: move CC variable near CFLAGS Move it to the bottom, near other compilation-related flags. --- config.mk.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.mk.in b/config.mk.in index e0be0e656..fdab92cb5 100644 --- a/config.mk.in +++ b/config.mk.in @@ -7,7 +7,6 @@ # up overriding the includer's intended default target (which by default is the # first target encountered). -CC=@CC@ prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ @@ -50,6 +49,7 @@ HAVE_ONLY_SYSCFG_PROFILES=@HAVE_ONLY_SYSCFG_PROFILES@ MANFLAGS = $(HAVE_LTS) $(HAVE_OUTPUT) $(HAVE_X11) $(HAVE_PRIVATE_HOME) $(HAVE_APPARMOR) $(HAVE_IDS) $(HAVE_OVERLAYFS) $(HAVE_USERTMPFS) $(HAVE_DBUSPROXY) $(HAVE_FIRETUNNEL) $(HAVE_GLOBALCFG) $(HAVE_CHROOT) $(HAVE_NETWORK) $(HAVE_USERNS) $(HAVE_FILE_TRANSFER) $(HAVE_SELINUX) $(HAVE_SUID) $(HAVE_FORCE_NONEWPRIVS) $(HAVE_ONLY_SYSCFG_PROFILES) +CC=@CC@ CFLAGS=@CFLAGS@ ifdef NO_EXTRA_CFLAGS From 3bb8064677f1ca423447a47da1265ea67512b03d Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Sat, 13 Aug 2022 16:02:53 -0300 Subject: [PATCH 2/5] config.mk.in: move basic variables to the top Move up the variables that are defined in the `AC_INIT` call on configure.ac. And put VERSION last, to match the usual `$(NAME)-$(VERSION)` usage. --- config.mk.in | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config.mk.in b/config.mk.in index fdab92cb5..2f02c42eb 100644 --- a/config.mk.in +++ b/config.mk.in @@ -7,6 +7,10 @@ # up overriding the includer's intended default target (which by default is the # first target encountered). +NAME=@PACKAGE_NAME@ +PACKAGE_TARNAME=@PACKAGE_TARNAME@ +VERSION=@PACKAGE_VERSION@ + prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ @@ -15,9 +19,6 @@ datarootdir=@datarootdir@ mandir=@mandir@ sysconfdir=@sysconfdir@ -VERSION=@PACKAGE_VERSION@ -NAME=@PACKAGE_NAME@ -PACKAGE_TARNAME=@PACKAGE_TARNAME@ DOCDIR=@docdir@ HAVE_APPARMOR=@HAVE_APPARMOR@ HAVE_CONTRIB_INSTALL=@HAVE_CONTRIB_INSTALL@ From 9a45c34fc762b1d52d48ea3886b7b09f0b769c74 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Sat, 13 Aug 2022 16:06:45 -0300 Subject: [PATCH 3/5] build: rename DOCDIR to docdir To match other similar variables, such as datarootdir and mandir. --- Makefile | 4 ++-- config.mk.in | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index eb49f9ac9..a3b2bf0eb 100644 --- a/Makefile +++ b/Makefile @@ -124,8 +124,8 @@ ifeq ($(HAVE_CONTRIB_INSTALL),yes) install -m 0644 contrib/vim/syntax/firejail.vim $(DESTDIR)$(datarootdir)/vim/vimfiles/syntax endif # documents - install -m 0755 -d $(DESTDIR)$(DOCDIR) - install -m 0644 -t $(DESTDIR)$(DOCDIR) COPYING README RELNOTES etc/templates/* + install -m 0755 -d $(DESTDIR)$(docdir) + install -m 0644 -t $(DESTDIR)$(docdir) COPYING README RELNOTES etc/templates/* # profiles and settings install -m 0755 -d $(DESTDIR)$(sysconfdir)/firejail install -m 0644 -t $(DESTDIR)$(sysconfdir)/firejail src/firecfg/firecfg.config diff --git a/config.mk.in b/config.mk.in index 2f02c42eb..7eed050ca 100644 --- a/config.mk.in +++ b/config.mk.in @@ -16,10 +16,10 @@ exec_prefix=@exec_prefix@ bindir=@bindir@ libdir=@libdir@ datarootdir=@datarootdir@ +docdir=@docdir@ mandir=@mandir@ sysconfdir=@sysconfdir@ -DOCDIR=@docdir@ HAVE_APPARMOR=@HAVE_APPARMOR@ HAVE_CONTRIB_INSTALL=@HAVE_CONTRIB_INSTALL@ BUSYBOX_WORKAROUND=@BUSYBOX_WORKAROUND@ From 891fd0270154ba1992e30d3e59c1daf990bfb604 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Sat, 13 Aug 2022 16:10:08 -0300 Subject: [PATCH 4/5] build: add new TARNAME variable That expands to `@PACKAGE_TARNAME@`, similar to the existing PACKAGE_TARNAME variable. To make it easier to use (and read) and to be more consistent with the surrounding variables (NAME and VERSION). Note that the original PACKAGE_TARNAME is still needed, as by default (on autoconf v2.69) `docdir=@docdir@` in config.mk.in expands to the following in config.mk: docdir=${datarootdir}/doc/${PACKAGE_TARNAME} --- config.mk.in | 3 ++- config.sh.in | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config.mk.in b/config.mk.in index 7eed050ca..9973b7eaa 100644 --- a/config.mk.in +++ b/config.mk.in @@ -8,7 +8,8 @@ # first target encountered). NAME=@PACKAGE_NAME@ -PACKAGE_TARNAME=@PACKAGE_TARNAME@ +TARNAME=@PACKAGE_TARNAME@ +PACKAGE_TARNAME=@PACKAGE_TARNAME@ # needed by docdir VERSION=@PACKAGE_VERSION@ prefix=@prefix@ diff --git a/config.sh.in b/config.sh.in index 155f2158e..0a91c68f2 100644 --- a/config.sh.in +++ b/config.sh.in @@ -4,4 +4,5 @@ # shellcheck disable=SC2034 NAME="@PACKAGE_NAME@" +TARNAME="@PACKAGE_TARNAME@" VERSION="@PACKAGE_VERSION@" From 7bbcf7eab290c8b9f683f71838009933df2295b5 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Wed, 22 Jun 2022 03:45:57 -0300 Subject: [PATCH 5/5] 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} --- Makefile | 20 ++++++++++---------- mkdeb.sh | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index a3b2bf0eb..0ea19a48a 100644 --- a/Makefile +++ b/Makefile @@ -221,14 +221,14 @@ dist: config.mk make distclean mv config.status.old config.status mv config.sh.old config.sh - rm -fr $(NAME)-$(VERSION) $(NAME)-$(VERSION).tar.xz - mkdir -p $(NAME)-$(VERSION)/test - cp -a $(DISTFILES) $(NAME)-$(VERSION) - cp -a $(DISTFILES_TEST) $(NAME)-$(VERSION)/test - rm -rf $(NAME)-$(VERSION)/src/tools - find $(NAME)-$(VERSION) -name .svn -delete - tar -cJvf $(NAME)-$(VERSION).tar.xz $(NAME)-$(VERSION) - rm -fr $(NAME)-$(VERSION) + rm -fr $(TARNAME)-$(VERSION) $(TARNAME)-$(VERSION).tar.xz + mkdir -p $(TARNAME)-$(VERSION)/test + cp -a $(DISTFILES) $(TARNAME)-$(VERSION) + cp -a $(DISTFILES_TEST) $(TARNAME)-$(VERSION)/test + rm -rf $(TARNAME)-$(VERSION)/src/tools + find $(TARNAME)-$(VERSION) -name .svn -delete + tar -cJvf $(TARNAME)-$(VERSION).tar.xz $(TARNAME)-$(VERSION) + rm -fr $(TARNAME)-$(VERSION) asc: config.mk ./mkasc.sh $(VERSION) @@ -240,11 +240,11 @@ deb-apparmor: dist config.sh ./mkdeb.sh -apparmor --enable-apparmor test-compile: dist config.mk - cd test/compile; ./compile.sh $(NAME)-$(VERSION) + cd test/compile; ./compile.sh $(TARNAME)-$(VERSION) .PHONY: rpms rpms: src/man config.mk - ./platform/rpm/mkrpm.sh $(NAME) $(VERSION) + ./platform/rpm/mkrpm.sh $(TARNAME) $(VERSION) extras: all $(MAKE) -C extras/firetools diff --git a/mkdeb.sh b/mkdeb.sh index a98261ba6..5f65e80b2 100755 --- a/mkdeb.sh +++ b/mkdeb.sh @@ -14,8 +14,8 @@ EXTRA_VERSION=$1 test "$#" -gt 0 && shift -CODE_ARCHIVE="$NAME-$VERSION.tar.xz" -CODE_DIR="$NAME-$VERSION" +CODE_ARCHIVE="$TARNAME-$VERSION.tar.xz" +CODE_DIR="$TARNAME-$VERSION" INSTALL_DIR="${INSTALL_DIR}${CODE_DIR}/debian" DEBIAN_CTRL_DIR="${DEBIAN_CTRL_DIR}${CODE_DIR}/debian/DEBIAN"