-
Notifications
You must be signed in to change notification settings - Fork 182
/
ci.sh
executable file
·112 lines (96 loc) · 2.37 KB
/
ci.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
#!/usr/bin/env bash
base=$(dirname "$(readlink -f "$0")")
install=$base/install
src=$base/src
set -eu
function parse_parameters() {
while (($#)); do
case $1 in
all | binutils | deps | kernel | llvm) action=$1 ;;
*) exit 33 ;;
esac
shift
done
}
function do_all() {
do_deps
do_llvm
do_binutils
do_kernel
}
function do_binutils() {
"$base"/build-binutils.py \
--install-folder "$install" \
--show-build-commands \
--targets x86_64
}
function do_deps() {
# We only run this when running on GitHub Actions
[[ -z ${GITHUB_ACTIONS:-} ]] && return 0
sudo apt-get install -y --no-install-recommends \
bc \
bison \
ca-certificates \
clang \
cmake \
curl \
file \
flex \
gcc \
g++ \
git \
libelf-dev \
libssl-dev \
lld \
make \
ninja-build \
python3 \
texinfo \
xz-utils \
zlib1g-dev
}
function do_kernel() {
local branch=linux-rolling-stable
local linux=$src/$branch
if [[ -d $linux ]]; then
git -C "$linux" fetch --depth=1 origin $branch
git -C "$linux" reset --hard FETCH_HEAD
else
git clone \
--branch "$branch" \
--depth=1 \
--single-branch \
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git \
"$linux"
fi
cat <<EOF | env PYTHONPATH="$base"/tc_build python3 -
from pathlib import Path
from kernel import LLVMKernelBuilder
builder = LLVMKernelBuilder()
builder.folders.build = Path('$base/build/linux')
builder.folders.source = Path('$linux')
builder.matrix = {'defconfig': ['X86']}
builder.toolchain_prefix = Path('$install')
builder.build()
EOF
}
function do_llvm() {
extra_args=()
[[ -n ${GITHUB_ACTIONS:-} ]] && extra_args+=(--no-ccache)
"$base"/build-llvm.py \
--assertions \
--build-stage1-only \
--build-target distribution \
--check-targets clang lld llvm \
--install-folder "$install" \
--install-target distribution \
--projects clang lld \
--quiet-cmake \
--ref release/19.x \
--shallow-clone \
--show-build-commands \
--targets X86 \
"${extra_args[@]}"
}
parse_parameters "$@"
do_"${action:=all}"