Add a shellcheck test, fix or ignore all warnings reported by shellcheck.

This commit is contained in:
Eric Hawicz committed 2026-10-18 20:42:14 -04:00
1 parent 5a79fb68c2
commit 8f191846d5
21 files changed
+163 -94

No files matched your search

+6 -2
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# shellcheck shell=bash
# Cross-build json-c for Amiga systems across every multilib slot and install
# the archives plus headers into an SDK tree.
#
@@ -10,7 +11,7 @@ set -uo pipefail
SDK=${AMIGA_SDK:-/opt/amiga}
AMIGA_DIR=$(cd "$(dirname "$0")" && pwd)
ROOT=$(cd "$AMIGA_DIR/.." && pwd)
cd "$ROOT"
cd "$ROOT" || exit 1
OSES=("$@"); [[ ${#OSES[@]} -eq 0 ]] && OSES=(AmigaOS3 AmigaOS4 MorphOS)
# os | image tag | sdk subdir
@@ -30,6 +31,7 @@ os_sdkdir() { case "$1" in
esac; }
# Per-OS variant table: "tree|slot|cmake args"
# shellcheck disable=SC2034 # used in vars nameref, below
variants_AmigaOS3=(
"libnix|.|-DM68K_CRT=nix20 -DM68K_CPU=68000 -DM68K_BASEREL=off"
"libnix|libm020|-DM68K_CRT=nix20 -DM68K_CPU=68020 -DM68K_BASEREL=off"
@@ -54,6 +56,7 @@ variants_AmigaOS3=(
# ppc-amigaos -mcrt=clib4 -> <target>/lib/clib4/
# ppc-morphos -mclib=libnix-> <target>/lib/libnix/
# ppc-morphos -mbaserel32 -> <target>/lib/libb32/
# shellcheck disable=SC2034 # used in vars nameref, below
variants_AmigaOS4=(
".|.|-DPPC_CRT=newlib"
".|clib2|-DPPC_CRT=clib2"
@@ -61,6 +64,7 @@ variants_AmigaOS4=(
)
# MORPHOS_CLIB=libnix (-mclib=libnix) and NOIXEMUL (-noixemul) select the same
# multilib; it is the self-contained ABI, needing no ixemul.library on target.
# shellcheck disable=SC2034 # used in vars nameref, below
variants_MorphOS=(
".|.|"
".|libb32|-DMORPHOS_BASEREL32=ON"
@@ -79,7 +83,7 @@ for os in "${OSES[@]}"; do
elif [[ -d $SDK/$osdir/$sdksub ]]; then SDKROOT=$SDK/$osdir/$sdksub
else echo "skip $os: neither $SDK/$sdksub nor $SDK/$osdir/$sdksub"; continue; fi
eval "vars=(\"\${variants_$os[@]}\")"
declare -n vars="variants_${os}" # nameref
for v in "${vars[@]}"; do
IFS='|' read -r tree slot cargs <<<"$v"
bdir="bld-$os-$(echo "$tree$slot$cargs" | tr -c 'A-Za-z0-9' '-' | cut -c1-40)"
+3 -2
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
# shellcheck shell=bash
# Build every json-c variant for the requested Amiga systems and package them
# into dist/json-c.lha.
#
@@ -13,7 +14,7 @@ set -uo pipefail
AMIGA_DIR=$(cd "$(dirname "$0")" && pwd)
ROOT=$(cd "$AMIGA_DIR/.." && pwd)
cd "$ROOT"
cd "$ROOT" || exit 1
DIST=$ROOT/dist
STAGE=$DIST/stage
OSES=("$@"); [[ ${#OSES[@]} -eq 0 ]] && OSES=(AmigaOS3 AmigaOS4 MorphOS)
@@ -68,7 +69,7 @@ done
# to refresh a single entry (e.g. the readme) in an existing archive with
# `lha u` -- it APPENDS a second entry with the same name rather than replacing
# it, and extraction then yields the stale copy.
( cd "$STAGE" && lha -aq2 "$DIST/json-c.lha" * >/dev/null )
( cd "$STAGE" && lha -aq2 "$DIST/json-c.lha" ./* >/dev/null )
rm -rf "$STAGE"
echo
echo "packaged: ${built[*]}"