Skip to content

Commit

Permalink
build with LuaJIT on GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
missdeer committed Jan 19, 2024
1 parent 5bdde13 commit ff5787a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
Build:
strategy:
matrix:
lua-version: [lua51, lua52, lua53, lua54]
lua-version: [lua51, lua52, lua53, lua54, luajit]
os: [macos, ubuntu, windows]
runs-on: ${{ matrix.os }}-latest
steps:
Expand Down Expand Up @@ -45,8 +45,12 @@ jobs:
if: matrix.os == 'macos'
run: |
env CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w -X main.sha1ver=$(git rev-parse --short HEAD) -X 'main.buildTime=$(date)'" -tags ${{ matrix.lua-version }} -o getnovel-amd64 .
env CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w -X main.sha1ver=$(git rev-parse --short HEAD) -X 'main.buildTime=$(date)'" -tags ${{ matrix.lua-version }} -o getnovel-arm64 .
lipo -create -output getnovel getnovel-amd64 getnovel-arm64
if [ "${{ matrix.lua-version }}" == "luajit" ]; then
mv getnovel-amd64 getnovel
else
env CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w -X main.sha1ver=$(git rev-parse --short HEAD) -X 'main.buildTime=$(date)'" -tags ${{ matrix.lua-version }} -o getnovel-arm64 .
lipo -create -output getnovel getnovel-amd64 getnovel-arm64
fi
curl -sSL -o kindlegen.zip https://github.com/ystyle/kaf-cli/releases/download/kindlegen/KindleGen_Mac_64bit_v2_9.zip
unzip kindlegen.zip
mkdir ${{ matrix.os }}-amd64
Expand Down
15 changes: 10 additions & 5 deletions golua/lua/buildlua.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,16 @@ cd luajit
if [ "$OS" == "Darwin" ]; then
env MACOSX_DEPLOYMENT_TARGET=12.0 make clean
env MACOSX_DEPLOYMENT_TARGET=12.0 CFLAGS="-arch x86_64" LDFLAGS="-arch x86_64" make -j $CoreCount BUILDMODE=static
mv src/libluajit.a ./libluajit-amd64.a
env MACOSX_DEPLOYMENT_TARGET=12.0 make clean
env MACOSX_DEPLOYMENT_TARGET=12.0 CFLAGS="-arch arm64" LDFLAGS="-arch arm64" make -j $CoreCount BUILDMODE=static
mv src/libluajit.a ./libluajit-arm64.a
lipo -create -output libluajit.a libluajit-arm64.a libluajit-amd64.a
arch=`uname -m`
if [ "$arch" == "arm64" ]; then
mv src/libluajit.a ./libluajit-amd64.a
env MACOSX_DEPLOYMENT_TARGET=12.0 make clean
env MACOSX_DEPLOYMENT_TARGET=12.0 CFLAGS="-arch arm64" LDFLAGS="-arch arm64" make -j $CoreCount BUILDMODE=static
mv src/libluajit.a ./libluajit-arm64.a
lipo -create -output libluajit.a libluajit-arm64.a libluajit-amd64.a
else
mv src/libluajit.a ./libluajit.a
fi
else
make -j $CoreCount BUILDMODE=static
mv src/*.a ./libluajit.a
Expand Down

0 comments on commit ff5787a

Please sign in to comment.