Skip to content

Commit

Permalink
build with luajit
Browse files Browse the repository at this point in the history
  • Loading branch information
missdeer committed Jan 18, 2024
1 parent 58cd4b3 commit c4d9fa3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
18 changes: 18 additions & 0 deletions golua/lua/buildlua.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,21 @@ find . -name 'lua*' -type d | while read dir; do
fi
cd ..
done

if [ ! -d luajit ]; then
git clone --depth 1 https://github.com/LuaJIT/LuaJIT.git luajit
fi
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
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
mv src/libluajit.a ./libluajit-arm64.a
lipo -create -output libluajit.a libluajit-arm64.a libluajit-amd64.a
else
make -j $CoreCount
mv src/libluajit.a ./
fi
cd ..
5 changes: 3 additions & 2 deletions golua/lua/golua.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package lua

/*
#cgo !lua52,!lua53,!lua54 CFLAGS: -I ${SRCDIR}/lua51
#cgo !lua52,!lua53,!lua54 LDFLAGS: -L ${SRCDIR}/lua51
#cgo !lua52,!lua53,!lua54,!luajit LDFLAGS: -L ${SRCDIR}/lua51
#cgo lua52 CFLAGS: -I ${SRCDIR}/lua52
#cgo lua52 LDFLAGS: -L ${SRCDIR}/lua52
#cgo lua53 CFLAGS: -I ${SRCDIR}/lua53
#cgo lua53 LDFLAGS: -L ${SRCDIR}/lua53
#cgo lua54 CFLAGS: -I ${SRCDIR}/lua54
#cgo lua54 LDFLAGS: -L ${SRCDIR}/lua54
#cgo LDFLAGS: -llua
#cgo !luajit LDFLAGS: -llua
#cgo luajit LDFLAGS: -L ${SRCDIR}/luajit -lluajit
#include <lua.h>
#include <lualib.h>
Expand Down

0 comments on commit c4d9fa3

Please sign in to comment.