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.
This commit is contained in:
Kelvin M. Klann 2023-07-28 13:05:54 -03:00
parent 59ed39ec46
commit 200f389ed0
4 changed files with 15 additions and 11 deletions

View file

@ -347,12 +347,12 @@ deb: dist config.sh
./mkdeb.sh
.PHONY: test-compile
test-compile: dist config.mk
cd test/compile; ./compile.sh $(TARNAME)-$(VERSION)
test-compile: dist config.sh
cd test/compile; ./compile.sh
.PHONY: rpms
rpms: src/man config.mk
./platform/rpm/mkrpm.sh $(TARNAME) $(VERSION)
rpms: src/man config.sh
./platform/rpm/mkrpm.sh
.PHONY: extras
extras: all

View file

@ -3,7 +3,7 @@
# Copyright (C) 2014-2023 Firejail Authors
# License GPL v2
. "$(dirname "$0")/config.sh"
. "$(dirname "$0")/config.sh" || exit 1
printf 'Calculating SHA256 for all files in /transfer - %s version %s' "$TARNAME" "$VERSION"

View file

@ -3,15 +3,18 @@
# Copyright (C) 2014-2023 Firejail Authors
# License GPL v2
#
# Usage: ./platform/rpm/mkrpm.sh firejail <version> "<config options>"
# Usage: ./platform/rpm/mkrpm.sh <config options>
#
# Builds rpms in a temporary directory then places the result in the
# current working directory.
name="$1"
# shellcheck source=config.sh
. "$(dirname "$0")/../../config.sh" || exit 1
name="$TARNAME"
# Strip any trailing prefix from the version like -rc1 etc
version="$(printf '%s\n' "$2" | sed 's/\-.*//g')"
config_opt="$3"
version="$(printf '%s\n' "$VERSION" | sed 's/\-.*//g')"
config_opt="$*"
if [[ ! -f "platform/rpm/${name}.spec" ]]; then
printf 'error: spec file not found for name %s\n' "${name}" >&2

View file

@ -11,7 +11,8 @@
# install contrib scripts
# --enable-analyzer enable GCC 10 static analyzer
# shellcheck source=config.sh
. "$(dirname "$0")/../../config.sh" || exit 1
arr[1]="TEST 1: standard compilation"
arr[2]="TEST 2: compile dbus proxy disabled"
@ -51,7 +52,7 @@ print_title() {
echo "**************************************************"
}
DIST="$1"
DIST="$(TARNAME)-$(VERSION)"
while [[ $# -gt 0 ]]; do # Until you run out of parameters . . .
case "$1" in
--clean)