-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild
executable file
·100 lines (83 loc) · 1.55 KB
/
build
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
#!/bin/bash
set -e
err() { echo $@; exit 1; }
if [[ ! -f out/xvo ]] || [[ -n $@ ]]; then
if ! command -v v &> /dev/null; then
err "please install v"
fi
mkdir -p out
v src -o out/xvo
fi
if [[ ! -f out/xvo ]]; then
err "couldnt build xvo"
fi
build_toolchain() {
export PATH=$PWD/out/toolchain/bin:$PATH
build() {
./out/xvo build $@ \
-root %pwd/out/rootfs \
-toolchain %pwd/out/toolchain \
-pkg %pwd/toolchain/pkg \
-stuff %pwd/toolchain/stuff \
-dl %pwd/out/toolchain_dl \
-bl %pwd/out/toolchain_build \
-scripts %pwd/scripts \
-target %arch-linux-musl \
-nopackage yes \
-debug yes
}
build binutils linux-headers gcc-static musl gcc
}
action() {
export PATH=$PWD/out/toolchain/bin:$PATH
local action=$1
shift;
./out/xvo $action $@ \
-root %pwd/out/rootfs \
-prefix / \
-toolchain %pwd/out/toolchain \
-pkg %pwd/pkg \
-stuff %pwd/stuff \
-dl %pwd/out/dl \
-bl %pwd/out/build \
-scripts %pwd/scripts \
-target %arch-linux-musl \
-config %pwd/toolchain/config \
-stage 0 \
-rebuild yes \
-debug yes
}
emerge() {
action emerge $@
}
install() {
action install $@
}
remove() {
action remove $@
}
build_system() {
emerge linux-headers
emerge musl
emerge busybox
return
emerge binutils
emerge gcc
emerge make
emerge patch
emerge ca-certificates
emerge libressl
emerge libz
emerge curl
}
main() {
case $1 in
system) build_system ;;
toolchain) build_toolchain ;;
install) shift; install $@ ;;
remove) shift; remove $@ ;;
*) emerge $@ ;;
esac
shift $((OPTIND -1))
}
main $@