-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·113 lines (84 loc) · 2.9 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
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
#!/bin/bash
set -e
#============================================================
# Prerequisities 0
echo ""
echo "============================================================"
echo "Prerequisities 0"
echo ""
#sudo apt-get update -y
#sudo apt-get upgrade -y
echo "sudo apt-get install -y build-essential gdb texinfo mono-complete"
sudo apt-get install -y build-essential gdb texinfo mono-complete
#============================================================
# Prerequisities 1
echo ""
echo "============================================================"
echo "Prerequisities 1"
echo ""
mkdir -p artifacts
cd artifacts
if [ ! -f dotnet-install.sh ]; then
wget https://dot.net/v1/dotnet-install.sh
chmod 755 dotnet-install.sh
./dotnet-install.sh -c 2.2
./dotnet-install.sh -c 3.1
./dotnet-install.sh -c 5.0
./dotnet-install.sh -c 6.0
./dotnet-install.sh -c 7.0
./dotnet-install.sh -c 8.0
fi
cd ..
#============================================================
# Prerequisities 2
echo ""
echo "============================================================"
echo "Prerequisities 2"
echo ""
export PATH=~/.dotnet:~/.dotnet/tools:$PATH
export DOTNET_ROOT=~/.dotnet
#============================================================
# Build toolchain
echo ""
echo "============================================================"
echo "Build toolchain"
echo ""
(cd chibicc-cil-toolchain && dotnet clean && dotnet build)
#============================================================
# Build libc (bootstrap)
echo ""
echo "============================================================"
echo "Build libc (bootstrap)"
echo ""
(cd libc-cil && ./build-crt0.sh && dotnet clean libc.sln && dotnet build libc.sln)
#============================================================
# Build chibicc-cil (bootstrap)
echo ""
echo "============================================================"
echo "Build chibicc-cil (bootstrap)"
echo ""
(cd chibicc-cil && make clean && make -j test && make -j test-stage2 && make -j test-stage3)
#============================================================
# Build newlib
echo ""
echo "============================================================"
echo "Build newlib"
echo ""
(cd libc-cil && ./build-newlib.sh)
#============================================================
# Build libgloss
echo ""
echo "============================================================"
echo "Build libgloss"
echo ""
(cd libc-cil && dotnet clean libgloss.sln && dotnet build libgloss.sln)
export CHIBICC_CIL_INCLUDE_PATH=`pwd`/libc-cil/newlib/newlib/libc/include
export CHIBICC_CIL_LIB_PATH=`pwd`/libc-cil/libgloss/bin/Debug/netstandard2.0
#============================================================
# Build chibicc-cil (main)
echo ""
echo "============================================================"
echo "Build chibicc-cil (main)"
echo ""
# Broken
#(cd chibicc-cil && make clean && make -j test && make -j test-stage2 && make -j test-stage3)