Skip to content

Commit

Permalink
build: use config.sh in more scripts
Browse files Browse the repository at this point in the history
This removes the need to manually pass variables such as `$(TARNAME)`
and `$(VERSION)` to shell scripts in the root Makefile.

Relates to netblue30#5140.
  • Loading branch information
kmk3 committed Jul 28, 2023
1 parent 59ed39e commit 200f389
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mkasc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
11 changes: 7 additions & 4 deletions platform/rpm/mkrpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions test/compile/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 200f389

Please sign in to comment.