From f55209223537bae6172e2edfb3852ef22c04c3be Mon Sep 17 00:00:00 2001 From: pedro-bento Date: Thu, 22 Oct 2026 12:34:04 +0100 Subject: [PATCH] Standardize release workflow --- .forgejo/scripts/freebsd-build.sh | 10 +++++++--- .forgejo/workflows/apple.yml | 22 +++++++++++++++------ Makefile | 33 ++++++++++++++++++++++++++++++- 3 files changed, 55 insertions(+), 10 deletions(-) diff --git a/.forgejo/scripts/freebsd-build.sh b/.forgejo/scripts/freebsd-build.sh index e77d2e3..823d605 100644 --- a/.forgejo/scripts/freebsd-build.sh +++ b/.forgejo/scripts/freebsd-build.sh @@ -4,6 +4,8 @@ # # freebsd-build.sh [source-dir] # +# The archive lands next to as libhate-no-d.a. +# # Needs qemu-system-x86, cloud-image-utils, openssh-client, xz and curl, plus # /dev/kvm (act_runner: options: "--device /dev/kvm"); under TCG the boot takes # many minutes. The guest runs with -snapshot, so nothing persists. @@ -126,10 +128,12 @@ ssh_vm 'set -e tar xzf /root/src.tar.gz -C /root/src cd /root/src gmake CC=cc clean >/dev/null 2>&1 || true - gmake CC=cc all' + gmake CC=cc all lib' -log "fetching binary" -mkdir -p "$(dirname "$OUT")" +log "fetching artifacts" +mkdir -p "$OUT_DIR" scp $SCP_OPTS "root@127.0.0.1:/root/src/hate-no-d" "$OUT" +scp $SCP_OPTS "root@127.0.0.1:/root/src/libhate-no-d.a" "$OUT_DIR/libhate-no-d.a" log "built $OUT ($(wc -c < "$OUT") bytes)" +log "built $OUT_DIR/libhate-no-d.a ($(wc -c < "$OUT_DIR/libhate-no-d.a") bytes)" diff --git a/.forgejo/workflows/apple.yml b/.forgejo/workflows/apple.yml index ded9fef..cacf26a 100644 --- a/.forgejo/workflows/apple.yml +++ b/.forgejo/workflows/apple.yml @@ -53,9 +53,13 @@ jobs: file ./hate-no-d file ./hate-no-d | grep -q '${{ matrix.arch }}' + - name: Package + run: sh .forgejo/scripts/make-archive.sh "hate-no-d-macos-${{ matrix.arch }}" tar.gz \ + ./hate-no-d ./libhate-no-d.a + - name: Attach to release if: github.event.inputs.tag != '' - run: sh .forgejo/scripts/release-asset.sh ./hate-no-d "hate-no-d-macos-${{ matrix.arch }}" + run: sh .forgejo/scripts/release-asset.sh "./hate-no-d-macos-${{ matrix.arch }}.tar.gz" # --------------------------------------------------------------------------- # iOS. Builds only the archive (JIT compiled out) for an Xcode app target. @@ -72,15 +76,21 @@ jobs: - name: Fetch submodules run: git submodule update --init --recursive - - name: Build libluajit.a - run: make PLATFORM=iOS IOS_ARCH=arm64 all + - name: Build static library + run: make PLATFORM=iOS IOS_ARCH=arm64 all lib - name: Verify archive run: | set -eu - lipo -info submodules/luajit/src/libluajit.a - lipo -info submodules/luajit/src/libluajit.a | grep -q arm64 + # libhate-no-d.a is what ships; it must be single-arch arm64 Mach-O. + lipo -info ./libhate-no-d.a + lipo -info ./libhate-no-d.a | grep -q arm64 + + - name: Package + # Only a static archive ships here: iOS forbids JIT, so libhate-no-d.a is + # the deliverable to link into an Xcode target. There is no binary. + run: sh .forgejo/scripts/make-archive.sh hate-no-d-ios-arm64 tar.gz ./libhate-no-d.a - name: Attach to release if: github.event.inputs.tag != '' - run: sh .forgejo/scripts/release-asset.sh submodules/luajit/src/libluajit.a hate-no-d-ios-arm64-luajit.a + run: sh .forgejo/scripts/release-asset.sh ./hate-no-d-ios-arm64.tar.gz diff --git a/Makefile b/Makefile index 3e6ad3b..d83826b 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ # Targets: # make the CLI (hate-no-d, or hate-no-d.exe / libluajit.a on iOS) # make lib libhate-no-d.a, for embedding into another program +# make help every target and option # luajit requires GNU Make (use `gmake` on FreeBSD/OpenBSD/NetBSD). ifndef .FEATURES @@ -222,6 +223,36 @@ $(LUAJIT_AR): $(MAKE) -C $(LUAJIT_SRC) $(LUAJIT_MAKE_ARGS) "LJCORE_O=ljamalg.o" libluajit.a # Targets +help: + @echo "hate-no-d -- LuaJIT-based Lua runtime" + @echo "" + @echo "Targets:" + @echo " make [all] CLI for the auto-detected platform (hate-no-d," + @echo " hate-no-d.exe, or libluajit.a on iOS)" + @echo " make lib libhate-no-d.a: LuaJIT plus LIB_OBJS, for embedding" + @echo " make luajit LuaJIT static archive only" + @echo " make print-config resolved configuration for the current target" + @echo " make clean remove build artifacts, LuaJIT's included" + @echo " make help this text" + @echo "" + @echo "Options (pass as VAR=value):" + @echo " PLATFORM= Linux | Android | Darwin | iOS | Windows | a BSD" + @echo " (default: uname -s)" + @echo " WIN_ARCH= x86_64 | i686 [Windows]" + @echo " ANDROID_NDK= NDK root, or export ANDROID_NDK_HOME [Android]" + @echo " ANDROID_ABI= arm64-v8a | armeabi-v7a | x86_64 | x86 [Android]" + @echo " ANDROID_API= target API level, default 21 [Android]" + @echo " IOS_ARCH= IOS_MIN= arm64 / 12.0 [iOS]" + @echo " IOS_SDK= IOS_CC= Xcode paths, default from xcrun [iOS]" + @echo " MACOSX_HRT= hardened-runtime JIT, default 1 [macOS]" + @echo " MACOSX_DEPLOYMENT_TARGET= default 11.0 [macOS]" + @echo " HOST_CC= host compiler for minilua/buildvm; needed" + @echo " when the target is 32-bit and the host is not" + @echo " CFLAGS= default -O2 -Wall" + @echo " LDFLAGS= extra linker flags" + @echo " LIB_OBJS= extra objects merged into libhate-no-d.a" + @echo " AR= archiver used to merge libhate-no-d.a" + all: $(LINK_TARGET) $(OBJ): hate-no-d.c @@ -280,4 +311,4 @@ clean: $(MAKE) -C $(LUAJIT_DIR) clean rm -f $(BIN) $(OBJ) $(LIB) $(LIB).mri -.PHONY: all clean luajit print-config lib +.PHONY: all clean luajit print-config lib help