forked from feather-lang/feather
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmise.toml
More file actions
221 lines (191 loc) · 5.54 KB
/
mise.toml
File metadata and controls
221 lines (191 loc) · 5.54 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
[env]
_.path = "./bin"
CGO_ENABLED = "1"
CC = "zig cc"
[tasks."build:harness"]
description = "Builds the test harness runner"
run = """
cd harness
go build -o $MISE_CONFIG_ROOT/bin/harness ./cmd/harness
"""
[tasks."build:bench"]
description = "Builds the benchmark runner"
run = """
cd harness
go build -o $MISE_CONFIG_ROOT/bin/bench ./cmd/bench
"""
[tasks."build:feather-tester"]
description = "Builds the feather-tester binary"
run = """
go build -a -o $MISE_CONFIG_ROOT/bin/feather-tester ./cmd/feather-tester
"""
[tasks."build:oracle"]
description = "Builds the oracle (reference TCL interpreter)"
dir = "oracle"
run = """
cc -o $MISE_PROJECT_ROOT/bin/oracle \
$(pkg-config --cflags tcl) \
main.c \
$(pkg-config --libs tcl)
"""
[tasks."build:wasm"]
description = "Builds feather.wasm for JavaScript/browser embedding"
dir = "js"
run = "mise run build"
[tasks."build:c-shared"]
description = "Builds libfeather shared library from Go package"
run = """
go build -buildmode=c-shared -o $MISE_PROJECT_ROOT/bin/libfeather.so ./cmd/libfeather
# Move generated header to bin/ for C compilation
mv libfeather.h $MISE_PROJECT_ROOT/bin/ 2>/dev/null || true
# On macOS, fix the install name to use @rpath
if [ "$(uname)" = "Darwin" ]; then
install_name_tool -id @rpath/libfeather.so $MISE_PROJECT_ROOT/bin/libfeather.so
fi
"""
[tasks."build:c-shared:cross"]
description = "Cross-compile libfeather using zig (targets: linux-amd64, linux-arm64, windows-amd64)"
usage = """
arg "target" help="Target platform: linux-amd64, linux-arm64, windows-amd64"
"""
run = """
set -e
TARGET="$usage_target"
case "$TARGET" in
linux-amd64)
GOOS=linux GOARCH=amd64 ZIG_TARGET=x86_64-linux-gnu EXT=so
;;
linux-arm64)
GOOS=linux GOARCH=arm64 ZIG_TARGET=aarch64-linux-gnu EXT=so
;;
windows-amd64)
GOOS=windows GOARCH=amd64 ZIG_TARGET=x86_64-windows-gnu EXT=dll
;;
*)
echo "Unknown target: $TARGET"
echo "Available targets: linux-amd64, linux-arm64, windows-amd64"
exit 1
;;
esac
mkdir -p $MISE_PROJECT_ROOT/bin/cross
echo "Cross-compiling for $TARGET (zig target: $ZIG_TARGET)..."
CGO_ENABLED=1 GOOS=$GOOS GOARCH=$GOARCH \
CC="zig cc -target $ZIG_TARGET" \
go build -buildmode=c-shared \
-o $MISE_PROJECT_ROOT/bin/cross/libfeather-$TARGET.$EXT \
./cmd/libfeather
# Header is generated with the output name, rename it
mv libfeather-$TARGET.h $MISE_PROJECT_ROOT/bin/cross/libfeather.h 2>/dev/null || true
echo "Built: bin/cross/libfeather-$TARGET.$EXT"
"""
[tasks."build:feather-c"]
description = "Builds the feather-c binary (C host)"
depends = ["build:c-shared"]
run = """
if [ "$(uname)" = "Darwin" ]; then
RPATH_FLAG="-Wl,-rpath,@executable_path"
else
RPATH_FLAG='-Wl,-rpath,$ORIGIN'
fi
cc -o $MISE_PROJECT_ROOT/bin/feather-c \
-I$MISE_PROJECT_ROOT/bin \
-L$MISE_PROJECT_ROOT/bin \
$RPATH_FLAG \
c/tester.c \
-lfeather
"""
[tasks."test:wasm-memory"]
description = "Run the WASM memory test checking for leaks"
dir = "js"
run = "mise run test:wasm-memory"
[tasks."test:go-memory"]
description = "Run the Go memory test checking for leaks"
depends = ["build:feather-memory-tester"]
run = "bin/feather-memory-tester"
[tasks."build:feather-httpd"]
description = "Builds the feather-httpd example server"
run = """
go build -o $MISE_CONFIG_ROOT/bin/feather-httpd ./cmd/feather-httpd
"""
[tasks."build:feather-memory-tester"]
description = "Builds the feather-memory-tester binary"
run = """
go build -o $MISE_CONFIG_ROOT/bin/feather-memory-tester ./cmd/feather-memory-tester
"""
[tasks.build]
description = "build all binaries in bin/"
depends = ["build:harness", "build:bench", "build:feather-tester"]
[tasks.test]
description = "Run the test harness"
depends = ["build"]
usage = """
arg "path" default="testcases/"
"""
run = """
harness run --host bin/feather-tester $usage_path
"""
[tasks."test:js"]
description = "Run the test harness with the JavaScript host"
depends = ["build:harness", "build:wasm"]
run = """
harness run --host js/tester.js testcases/
"""
[tasks."test:c"]
description = "Run the test harness with the C host"
depends = ["build:harness", "build:feather-c"]
usage = """
arg "path" default="testcases/"
"""
run = """
harness run --host bin/feather-c $usage_path
"""
[tasks."test:all"]
description = "Run all test suites in parallel"
depends = ["test", "test:js", "test:c"]
[tasks.bench]
description = "Run benchmarks with the Go host"
depends = ["build:bench", "build:feather-tester"]
usage = """
arg "path" default="benchmarks/"
"""
run = """
bench -host bin/feather-tester $usage_path*.html
"""
[tasks."bench:js"]
description = "Run benchmarks with the JavaScript host"
depends = ["build:bench", "build:wasm"]
run = """
bench -host js/tester.js benchmarks/*.html
"""
[tasks."bench:oracle"]
description = "Run benchmarks with the TCL Oracle (reference TCL interpreter)"
depends = ["build:bench", "build:oracle"]
run = """
bench -host bin/oracle benchmarks/*.html
"""
[tasks."bench:c"]
description = "Run benchmarks with the C host"
depends = ["build:bench", "build:feather-c"]
run = """
bench -host bin/feather-c benchmarks/*.html
"""
[tasks."bench:all"]
description = "Run all benchmarks in parallel"
depends = ["bench", "bench:js", "bench:oracle", "bench:c"]
[tasks."build:raylib"]
description = "Build the raylib example game"
depends = ["build:c-shared"]
dir = "c/examples/raylib"
run = """
# Copy libfeather.so to make the example self-contained
cp $MISE_PROJECT_ROOT/bin/libfeather.so .
make
"""
[tasks."run:raylib"]
description = "Run the raylib example game"
depends = ["build:raylib"]
dir = "c/examples/raylib"
run = "./game"
[tools]
go = "1.25.5"
zig = "latest"