diff --git a/golua/lua/buildlua.sh b/golua/lua/buildlua.sh index ebf7d3a..a5f2952 100755 --- a/golua/lua/buildlua.sh +++ b/golua/lua/buildlua.sh @@ -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 .. diff --git a/golua/lua/golua.go b/golua/lua/golua.go index 706e9ff..402166f 100644 --- a/golua/lua/golua.go +++ b/golua/lua/golua.go @@ -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 #include