-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·52 lines (51 loc) · 2.11 KB
/
build.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
47
48
49
50
51
52
#!/bin/sh
(set -u
cd "$(dirname "$0")/source" || exit 1
. ../version || { printf "Version formatted wrong\n" >&2; exit 1; }
app="../BullshitCore-$MINECRAFT_VERSION-$VERSION" ||
{ printf "Version formatted wrong\n" >&2; exit 1; }
lib="../libbullshitcore-$MINECRAFT_VERSION-$VERSION"
set +u
case $1 in
debug)
shift
gcc -c -std=c99 -fPIC -Wall -Wextra -Wpedantic -Wformat=2 -Wshadow \
-Wwrite-strings -Wstrict-prototypes -Wold-style-definition \
-Wredundant-decls -Wnested-externs -Wmissing-include-dirs \
-Wjump-misses-init -Wlogical-op -I../include -I.. -g -pthread ./*.c \
"$@"
gcc -std=c99 -fPIC -shared -g -pthread ./*.o -o "$lib-debug.so" "$@" \
-lwolfssl
gcc -std=c99 -Wall -Wextra -Wpedantic -Wformat=2 -Wshadow \
-Wwrite-strings -Wstrict-prototypes -Wold-style-definition \
-Wredundant-decls -Wnested-externs -Wmissing-include-dirs \
-Wjump-misses-init -Wlogical-op -I../include -I. -g -pthread ./*.o \
../main.c -o "$app-debug" "$@" -lwolfssl;;
test)
for module in ../test/*.c; do
printf %s:\\n "$module"
for test in $(awk '/ifdef/ { print $NF }' "$module"); do
printf %s:\ "$test"
timeout 5 tcc "-run -D$test -I../include -L.. -lbullshitcore-$MINECRAFT_VERSION-$VERSION" \
"$module"
case $? in
124) printf "Timed out.\n";;
0) printf Passed.\\n;;
esac
done
done;;
*)
gcc -c -std=c99 -fPIC -Wall -Wextra -Wpedantic -Wformat=2 -Wshadow \
-Wwrite-strings -Wstrict-prototypes -Wold-style-definition \
-Wredundant-decls -Wnested-externs -Wmissing-include-dirs \
-Wjump-misses-init -Wlogical-op -I../include -I.. -O2 -flto \
-fno-fat-lto-objects -pthread -DNDEBUG ./*.c "$@"
gcc -std=c99 -fPIC -shared -O2 -flto -flto-partition=one -pthread \
./*.o -o "$lib.so" "$@" -lwolfssl
gcc -std=c99 -Wall -Wextra -Wpedantic -Wformat=2 -Wshadow \
-Wwrite-strings -Wstrict-prototypes -Wold-style-definition \
-Wredundant-decls -Wnested-externs -Wmissing-include-dirs \
-Wjump-misses-init -Wlogical-op -I../include -I. -O2 -flto \
-flto-partition=one -fno-fat-lto-objects -fwhole-program -pthread \
-DNDEBUG ./*.o ../main.c -o "$app" "$@" -lwolfssl && strip "$app";;
esac)