-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·62 lines (51 loc) · 1.32 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
#!/bin/bash
set -euxo pipefail
CUR=`dirname $(realpath $0)`
NCPU=`grep -c ^processor /proc/cpuinfo`
LINUX=$HOME
NAME="rust-for-linux"
LINUX_PATH=$LINUX/$NAME
rustup default nightly-2021-05-29
rustup component add rust-src
if [[ -d "$LINUX_PATH" ]]; then
if [[ ${1---x86} == "--arm" ]]; then
# aarch64
pushd $LINUX_PATH
if [ -f ./.config ]; then
rm -f ./.config
fi
touch .config
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- rust.config
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LLVM=1 -j32
popd
else
# x86_64
pushd $LINUX_PATH
if [ -f .config ]; then
rm -f ./.config
fi
touch .config
cp $CUR/x86_mini.config ./arch/x86/configs
make ARCH=x86_64 -j32 CC=clang x86_mini.config LLVM=1
make ARCH=x86_64 -j32 CC=clang kvm_guest.config LLVM=1
make LLVM=1 -j32
popd
fi
else
pushd $LINUX
git clone --depth=1 [email protected]:hanqing/rust-for-linux.git
popd
pushd $LINUX_PATH
# build x86_64
touch .config
cp $CUR/x86_mini.config ./arch/x86/configs
make ARCH=x86_64 -j32 CC=clang x86_mini.config LLVM=1
make ARCH=x86_64 -j32 CC=clang kvm_guest.config LLVM=1
make LLVM=1 -j32
# build aarch64
rm .config
touch .config
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- rust.config
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LLVM=1 -j32
popd
fi