diff --git a/amiga/json-c.readme b/amiga/json-c.readme.template similarity index 99% rename from amiga/json-c.readme rename to amiga/json-c.readme.template index 10a18b3..0e43654 100644 --- a/amiga/json-c.readme +++ b/amiga/json-c.readme.template @@ -2,7 +2,7 @@ Short: JSON parser and generator library (static libs + headers) Author: Michael Clark, Eric Hawicz et al. Uploader: Cameron Armstrong (Nightfox) Type: dev/lib -Version: 0.19 +Version: VERSION Architecture: m68k-amigaos >= 2.0; ppc-amigaos; ppc-morphos Requires: an Amiga gcc compiler Replaces: dev/lib/json-c.lha diff --git a/amiga/package-amiga.sh b/amiga/package-amiga.sh index 62c2407..ac72155 100755 --- a/amiga/package-amiga.sh +++ b/amiga/package-amiga.sh @@ -33,7 +33,17 @@ rm -rf "$_lha_probe" # script's SDK layout ($SDK/) is the same shape we want per OS, so each # OS gets staged under its own directory. rm -rf "$DIST"; mkdir -p "$STAGE/json-c" -cp "$AMIGA_DIR/json-c.readme" "$STAGE/json-c/json-c.readme" + +# Extract the version from either a release tag, or the dev version + abbreviated commit hash +GIT_DESCR=$(git describe --tags --always) +if [[ "$GIT_DESCR" == json-c-* ]] ; then + # e.g. 0.19-20260627 + JSON_C_VERS=${GIT_DESCR#json-c-} +else + # e.g. 0.19.99-09e45f6 + JSON_C_VERS=$(sed -ne'/define JSON_C_VERSION / { s/"$//; s/.*"//; p }' "${ROOT}/json_c_version.h")-${GIT_DESCR} +fi +sed -e"s/VERSION/${JSON_C_VERS}/" "$AMIGA_DIR/json-c.readme.template" > "$STAGE/json-c/json-c.readme" built=() for os in "${OSES[@]}"; do