forked from getditto/rust-bitcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·47 lines (42 loc) · 1.17 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
#!/bin/bash
set -euxo
source config.sh
WORKING_DIR="$(pwd)/build"
mkdir -p "$WORKING_DIR"
if ! which ninja; then
echo "ninja not found. Try: brew install ninja"
exit 1
fi
if ! which cmake; then
echo "cmake not found. Try: brew install cmake"
exit 1
fi
cd "$WORKING_DIR"
if [ ! -d "$WORKING_DIR/swift-llvm" ]; then
git clone https://github.com/apple/swift-llvm.git -b "$SWIFT_BRANCH"
fi
cd "$WORKING_DIR/swift-llvm"
git reset --hard
git clean -f
git checkout "origin/$SWIFT_BRANCH"
cd ..
mkdir -p llvm-build
cd llvm-build
cmake "$WORKING_DIR/swift-llvm" -DCMAKE_INSTALL_PREFIX="$WORKING_DIR/llvm-root" -DCMAKE_BUILD_TYPE=Release -DLLVM_INSTALL_UTILS=ON -DLLVM_TARGETS_TO_BUILD='X86;ARM;AArch64' -G Ninja
ninja
ninja install
cd "$WORKING_DIR"
if [ ! -d "$WORKING_DIR/rust" ]; then
git clone https://github.com/rust-lang/rust.git
fi
cd rust
git reset --hard
git clean -f
git checkout "$RUST_COMMIT"
cd ..
mkdir -p rust-build
cd rust-build
../rust/configure --llvm-config="$WORKING_DIR/llvm-root/bin/llvm-config" --target=aarch64-apple-ios
export RUSTFLAGS_NOT_BOOTSTRAP=-Zembed-bitcode
export CFLAGS_aarch64_apple_ios=-fembed-bitcode
python "$WORKING_DIR/rust/x.py" build