forked from inferno-os/inferno-os
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild-macos-sdl3.sh
More file actions
executable file
·91 lines (77 loc) · 2.38 KB
/
build-macos-sdl3.sh
File metadata and controls
executable file
·91 lines (77 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
#
# Build InferNode for macOS ARM64 (SDL3 GUI mode)
#
# !!! CRITICAL TODO !!!
# The emu-hosted Limbo compiler (/dis/limbo.dis) produces BROKEN bytecode on ARM64!
# It generates smaller .dis files with invalid opcodes (BADOP errors at runtime).
#
# ALWAYS use the native Limbo compiler for building Limbo modules:
# ./MacOSX/arm64/bin/limbo -I module -o output.dis source.b
#
# DO NOT use:
# ./emu/MacOSX/o.emu -r. 'limbo ...'
#
# The hosted limbo.dis needs to be rebuilt for ARM64 compatibility.
# See: appl/cmd/limbo/ and dis/limbo.dis
# !!! END CRITICAL TODO !!!
#
set -e
ROOT="$(cd "$(dirname "$0")" && pwd)"
export ROOT
echo "=== InferNode macOS ARM64 Build (SDL3 GUI) ==="
echo "ROOT=$ROOT"
echo ""
# Check SDL3 is installed
if ! pkg-config --exists sdl3 2>/dev/null; then
echo "Error: SDL3 not found!"
echo "Install with: brew install sdl3 sdl3_ttf"
exit 1
fi
SDL3_VERSION=$(pkg-config --modversion sdl3)
echo "Found SDL3 version: $SDL3_VERSION"
# Set up environment for macOS ARM64
export SYSHOST=MacOSX
export OBJTYPE=arm64
export PATH="$ROOT/MacOSX/arm64/bin:$PATH"
export AWK=awk
export SHELLNAME=sh
echo "Building for: SYSHOST=$SYSHOST OBJTYPE=$OBJTYPE"
echo "GUI Backend: SDL3"
echo ""
# Stamp build version (matches CI workflow)
BUILD_DATE=$(date +%Y%m%d)
SHORT_SHA=$(git -C "$ROOT" rev-parse --short=8 HEAD 2>/dev/null || echo "local")
sed -i '' "s|InferNode 0.1|InferNode 0.1 build ${BUILD_DATE}-${SHORT_SHA}|" "$ROOT/include/version.h"
echo "Version: $(grep VERSION "$ROOT/include/version.h")"
echo ""
# Build emulator
cd "$ROOT/emu/MacOSX"
echo "Cleaning previous build..."
mk clean 2>/dev/null || true
echo "Building SDL3 GUI emulator..."
mk GUIBACK=sdl3
# Restore version.h so repeated builds don't accumulate stamps
git -C "$ROOT" checkout -- "$ROOT/include/version.h" 2>/dev/null || true
if [[ -f o.emu ]]; then
echo ""
echo "=== Build Successful ==="
ls -lh o.emu
file o.emu
echo ""
echo "Checking SDL3 dependencies..."
otool -L o.emu | grep -i sdl
echo ""
# Copy to InferNode for app bundle (macOS menu shows executable name)
cp o.emu InferNode
echo "Copied o.emu -> InferNode (for InferNode.app bundle)"
echo ""
echo "Launch with:"
echo " open $ROOT/MacOSX/InferNode.app"
echo ""
echo "Or run directly:"
echo " ./o.emu -r../.. sh -l -c 'xenith -t dark'"
else
echo "Build failed!"
exit 1
fi