blob: f506120fdb197e70b0d5f684f0d6e467e3c2fd88 (
plain)
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
|
#!/bin/sh
fail() {
echo "$0: $*" >&2
exit 1
}
CC=cc
CFLAGS="-std=c99 -Wall -Wextra -Wpedantic -D_POSIX_C_SOURCE=200809L"
LDFLAGS="-fPIC"
SOURCES="test.c"
output="build"
for arg ; do
case "$arg" in
--runtime=*)
runtime="${arg#*=}"
;;
--output=*)
output="${arg#*=}"
;;
*)
echo "usage"
;;
esac
done
if [ -z "$runtime" ]; then
echo "Guessing runtime ..."
case "$(uname -s)" in
Linux)
case "$(uname -m)" in
x86_64)
runtime="linux-x64"
;;
esac
;;
esac
fi
case "$runtime" in
linux-x64)
sofile="libdjup.so"
;;
*)
fail "Unsupported runtime $runtime"
esac
echo Building for runtime "$runtime ..."
mkdir -p "$output/runtimes/$runtime/native" && $CC $CFLAGS $SOURCES -shared $LDFLAGS -o "$output/runtimes/$runtime/native/$sofile"
echo Done
|