diff --git a/.github/workflows/amiga.yml b/.github/workflows/amiga.yml index 70f82d0..b84be1f 100644 --- a/.github/workflows/amiga.yml +++ b/.github/workflows/amiga.yml @@ -1,5 +1,10 @@ name: amiga +# Verifies that AmigaOS 3/4 and MorphOS still cross-compile. The uploaded +# json-c.lha is a CI convenience artifact only — official json-c releases +# remain source-only. Aminet uploads are a separate, manual process and +# are not published from this job. + on: [push, pull_request, workflow_dispatch] concurrency: @@ -14,11 +19,19 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 120 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 # Ubuntu's `lha` package is lhasa: extract-only, cannot create archives. # Build LHa for UNIX (https://github.com/jca02266/lha) instead. + - name: Cache LHa for UNIX + id: cache-lha + uses: actions/cache@v6 + with: + path: ~/.local/bin/lha + key: lha-16619b066b189ef289bb8b07b37d1c38d550da99-${{ runner.os }} + - name: Install LHa for UNIX + if: steps.cache-lha.outputs.cache-hit != 'true' working-directory: ${{runner.temp}} run: | sudo apt-get update @@ -31,7 +44,9 @@ jobs: ./configure --prefix="$HOME/.local" make -j"$(nproc)" make install - echo "$HOME/.local/bin" >> "$GITHUB_PATH" + + - name: Add LHa to PATH + run: echo "$HOME/.local/bin" >> "$GITHUB_PATH" - name: Check lha can create archives run: | @@ -49,9 +64,9 @@ jobs: wait - name: Build and package - run: ./package-amiga.sh + run: ./amiga/package-amiga.sh - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: json-c.lha path: dist/json-c.lha diff --git a/README.md b/README.md index 6af6456..36bea72 100644 --- a/README.md +++ b/README.md @@ -275,7 +275,9 @@ make install Building for Commodore Amiga or MorphOS ---------------------- -Building for Commodore Amiga is supported for both Motorola 68k (AmigaOS 3) and PowerPC (AmigaOS 4) architectures. MorphOS on compatible PowerPC hardware is also supported. You can set up a cross compiler locally, however it is much easier to use the already preconfigured Amiga development environment wtthin a Docker container. +Building for Commodore Amiga is supported for both Motorola 68k (AmigaOS 3) and PowerPC (AmigaOS 4) architectures. MorphOS on compatible PowerPC hardware is also supported. You can set up a cross compiler locally, however it is much easier to use the already preconfigured Amiga development environment within a Docker container. + +Included below are instructions for building for specific individual systems, as well as how to build for *all* Amiga variants. Install Docker on your machine if you don't already have it. You can download Docker Desktop for Windows/macOS/Linux [here](https://www.docker.com/products/docker-desktop/). @@ -384,19 +386,19 @@ cmake -DMORPHOS_BASEREL32=ON .. ### Building and packaging every variant -Two scripts at the repository root build the whole matrix across all three +Two scripts in the `amiga/` directory build the whole matrix across all three systems, so you do not have to drive the container by hand. -* `build-amiga-sdk.sh [OS ...]` — builds every variant and installs +* `amiga/build-amiga-sdk.sh [OS ...]` — builds every variant and installs `libjson-c.a` plus the `json-c/` headers into an SDK tree. The location comes from `$AMIGA_SDK` (default `/opt/amiga`); either a `/` or an AmigaSDK-gcc-style `amigaos3/sdk//` layout is accepted, and an OS whose subdirectory is absent is skipped rather than failing. -* `package-amiga.sh [OS ...]` — builds the same matrix into a staging tree and +* `amiga/package-amiga.sh [OS ...]` — builds the same matrix into a staging tree and produces `dist/json-c.lha` for distribution. Both default to `AmigaOS3 AmigaOS4 MorphOS`, and both take the variant list -from the same table in `build-amiga-sdk.sh`, so they cannot disagree. 22 +from the same table in `amiga/build-amiga-sdk.sh`, so they cannot disagree. 22 libraries are built in total: 15 for AmigaOS 3 (newlib, libnix and clib2, each across the five multilib slots), 3 for AmigaOS 4 (newlib, clib2, clib4) and 4 for MorphOS (ixemul and native, each with and without `-mbaserel32`). diff --git a/build-amiga-sdk.sh b/amiga/build-amiga-sdk.sh similarity index 96% rename from build-amiga-sdk.sh rename to amiga/build-amiga-sdk.sh index 835edda..9669ae3 100755 --- a/build-amiga-sdk.sh +++ b/amiga/build-amiga-sdk.sh @@ -2,14 +2,15 @@ # Cross-build json-c for Amiga systems across every multilib slot and install # the archives plus headers into an SDK tree. # -# ./build-amiga-sdk.sh [OS ...] # default: AmigaOS3 AmigaOS4 MorphOS +# ./amiga/build-amiga-sdk.sh [OS ...] # default: AmigaOS3 AmigaOS4 MorphOS # # SDK location comes from $AMIGA_SDK (default /opt/amiga). set -uo pipefail SDK=${AMIGA_SDK:-/opt/amiga} -cd "$(dirname "$0")" -ROOT=$PWD +AMIGA_DIR=$(cd "$(dirname "$0")" && pwd) +ROOT=$(cd "$AMIGA_DIR/.." && pwd) +cd "$ROOT" OSES=("$@"); [[ ${#OSES[@]} -eq 0 ]] && OSES=(AmigaOS3 AmigaOS4 MorphOS) # os | image tag | sdk subdir diff --git a/json-c.readme b/amiga/json-c.readme similarity index 98% rename from json-c.readme rename to amiga/json-c.readme index 3bebf37..10a18b3 100644 --- a/json-c.readme +++ b/amiga/json-c.readme @@ -1,5 +1,5 @@ Short: JSON parser and generator library (static libs + headers) -Author: Michael Clark, Eric Haszlakiewicz et al. +Author: Michael Clark, Eric Hawicz et al. Uploader: Cameron Armstrong (Nightfox) Type: dev/lib Version: 0.19 diff --git a/package-amiga.sh b/amiga/package-amiga.sh similarity index 87% rename from package-amiga.sh rename to amiga/package-amiga.sh index 2456c4c..62c2407 100755 --- a/package-amiga.sh +++ b/amiga/package-amiga.sh @@ -2,7 +2,7 @@ # Build every json-c variant for the requested Amiga systems and package them # into dist/json-c.lha. # -# ./package-amiga.sh [OS ...] # default: all three +# ./amiga/package-amiga.sh [OS ...] # default: all three # # Archive layout (single directory at the root): # json-c/json-c.readme @@ -11,8 +11,9 @@ # json-c/MorphOS/... set -uo pipefail -cd "$(dirname "$0")" -ROOT=$PWD +AMIGA_DIR=$(cd "$(dirname "$0")" && pwd) +ROOT=$(cd "$AMIGA_DIR/.." && pwd) +cd "$ROOT" DIST=$ROOT/dist STAGE=$DIST/stage OSES=("$@"); [[ ${#OSES[@]} -eq 0 ]] && OSES=(AmigaOS3 AmigaOS4 MorphOS) @@ -32,7 +33,7 @@ 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 "$ROOT/json-c.readme" "$STAGE/json-c/json-c.readme" +cp "$AMIGA_DIR/json-c.readme" "$STAGE/json-c/json-c.readme" built=() for os in "${OSES[@]}"; do @@ -47,7 +48,7 @@ for os in "${OSES[@]}"; do echo "=== $os ===" # Stage whatever landed even if some variants failed -- a single unsupported # multilib should not drop the whole OS from the archive. - AMIGA_SDK="$tmp" ./build-amiga-sdk.sh "$os" || echo " ($os: some variants failed, see above)" + AMIGA_SDK="$tmp" "$AMIGA_DIR/build-amiga-sdk.sh" "$os" || echo " ($os: some variants failed, see above)" if [[ -n $(find "$tmp/$sub" -name 'libjson-c.a' -print -quit 2>/dev/null) ]]; then mkdir -p "$STAGE/json-c/$os" cp -a "$tmp/$sub/." "$STAGE/json-c/$os/"