-
Notifications
You must be signed in to change notification settings - Fork 11
/
lib.sh
46 lines (38 loc) · 1.09 KB
/
lib.sh
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
__dirname=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
JsToC() {
node js-build/js-to-c.js $1
}
ClangOptions() {
# string format warnings: ignored as we're compiling to C
# float-equal: fine, JS float semantics too
# padding: something to consider much later
# gnu stuff: research and consider later
echo -g \
-std=c11 \
-O0 \
-Weverything \
-Wno-format-security \
-Wno-format-pedantic \
-Wno-float-equal \
-Wno-padded \
-Wno-gnu-folding-constant \
-Wno-gnu-folding-constant \
-Wno-missing-noreturn \
-Wno-newline-eof
}
CToExec() {
local cTarget=$1
local exe=$2
clang $(ClangOptions) $cTarget out/runtime.dylib out/prelude.dylib $(LibuvDylib) -o $exe
}
CToLib() {
local cTarget=$1
local out=$2
clang -dynamiclib $(ClangOptions) out/runtime.dylib $(LibuvDylib) $cTarget -o $out
}
GetRuntimeLibs() {
find "$__dirname/runtime" -maxdepth 1 -name '*.c' -not -name '*.test.c'
}
LibuvDylib() {
echo ./runtime/vendor/libuv-1.26.0/out/cmake/libuv.dylib
}