-
Notifications
You must be signed in to change notification settings - Fork 3
/
init.sh
executable file
·42 lines (35 loc) · 1 KB
/
init.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
#!/bin/sh
BS=bootstrap
SING=singularity/implementation
O7_OPT="-DO7_MEMNG_MODEL=O7_MEMNG_NOFREE"
WARN="-Wall -Wno-parentheses"
DEBUG=-g
OPTIM=-O1
OPT=
LD_OPT=
CC_OPT="$WARN $OPTIM $DEBUG $O7_OPT $OPT $LD_OPT"
search_cc() {
for CC in cc gcc clang tcc "zig cc" ccomp zapcc; do
if $CC -v 2>/dev/null; then
echo Use \"$CC\" as C compiler
return 0
fi
done
echo Can not found c compiler
return 1
}
build() {
mkdir -p result
SING_C="$SING/CFiles.c $SING/CLI.c $SING/OsEnv.c $SING/OsExec.c $SING/Platform.c $SING/o7.c"
$CC $CC_OPT -I$BS -I$SING $BS/*.c $SING_C -o result/bs-ost
}
info() {
echo
echo Bootstrap version of translator was built. Info about next steps:
echo " result/bs-ost run make.Help -infr . -m source"
echo
echo To build, test, and install run:
echo " result/bs-ost run 'make.Build; make.Test' -infr . -m source &&"
echo " /usr/bin/sudo result/ost run make.Install -infr . -m source"
}
search_cc && build && info