2025-08-17 08:57:45 +00:00
|
|
|
#!/bin/bash
|
2025-08-16 13:44:06 +00:00
|
|
|
|
2025-08-17 08:37:52 +00:00
|
|
|
# Run this if you're on Linux or macOS and you haven't already built LuaJIT.
|
2025-08-16 13:44:06 +00:00
|
|
|
# If you don't, osci-render won't compile.
|
|
|
|
|
2025-08-18 18:36:10 +00:00
|
|
|
cd "$DIR/modules/LuaJIT/src" || exit 1
|
2025-08-16 16:28:55 +00:00
|
|
|
|
2025-08-18 19:09:52 +00:00
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
2025-08-17 08:37:52 +00:00
|
|
|
echo "Building LuaJIT universal binary (x86_64 + arm64)..."
|
|
|
|
|
2025-08-18 19:00:07 +00:00
|
|
|
make clean
|
|
|
|
|
|
|
|
export MACOSX_DEPLOYMENT_TARGET=10.13
|
|
|
|
|
|
|
|
# build x86_64
|
2025-08-17 08:37:52 +00:00
|
|
|
make -j$(sysctl -n hw.logicalcpu) \
|
2025-08-18 19:00:07 +00:00
|
|
|
LUAJIT_T=luajit-x86_64 \
|
2025-08-17 08:37:52 +00:00
|
|
|
BUILDMODE=static \
|
2025-08-18 19:00:07 +00:00
|
|
|
CC='clang -target x86_64-apple-macos' \
|
|
|
|
|| exit 2
|
|
|
|
|
2025-08-17 08:37:52 +00:00
|
|
|
mv libluajit.a libluajit_x86_64.a
|
2025-08-18 19:00:07 +00:00
|
|
|
|
2025-08-17 08:37:52 +00:00
|
|
|
make clean
|
|
|
|
|
|
|
|
# Build arm64
|
|
|
|
make -j$(sysctl -n hw.logicalcpu) \
|
2025-08-18 19:00:07 +00:00
|
|
|
LUAJIT_T=luajit-arm64 \
|
2025-08-17 08:37:52 +00:00
|
|
|
BUILDMODE=static \
|
2025-08-18 19:00:07 +00:00
|
|
|
CC='clang -target arm64-apple-macos' \
|
|
|
|
|| exit 3
|
2025-08-17 08:37:52 +00:00
|
|
|
|
|
|
|
mv libluajit.a libluajit_arm64.a
|
|
|
|
|
|
|
|
# Merge into fat binary
|
|
|
|
lipo -create -output libluajit.a libluajit_x86_64.a libluajit_arm64.a
|
2025-08-18 18:27:12 +00:00
|
|
|
echo "Universal libluajit.a created."
|
2025-08-17 08:37:52 +00:00
|
|
|
|
2025-08-16 16:28:55 +00:00
|
|
|
else
|
2025-08-17 09:04:30 +00:00
|
|
|
make -j$(nproc) BUILDMODE=static XCFLAGS="-fPIC"
|
2025-08-16 16:28:55 +00:00
|
|
|
fi
|