@@ -17,14 +17,14 @@ source shared.sh
17
17
# Download sources
18
18
SRCS=(
19
19
" https://fuchsia.googlesource.com/zircon zircon e9a26dbc70d631029f8ee9763103910b7e3a2fe1"
20
- " https://llvm.googlesource.com/llvm llvm 3f58a16d8eec385e2b3ebdfbb84ff9d3bf27e025 "
21
- " https://llvm.googlesource.com/clang llvm/tools/clang 727ea63e6e82677f6e10e05e08bc7d6bdbae3111 "
22
- " https://llvm.googlesource.com/lld llvm/tools/lld a31286c1366e5e89b8872803fded13805a1a084b "
23
- " https://llvm.googlesource.com/lldb llvm/tools/lldb 0b2384abec4cb99ad66687712e07dee4dd9d187e "
24
- " https://llvm.googlesource.com/compiler-rt llvm/runtimes/compiler-rt 9093a35c599fe41278606a20b51095ea8bd5a081 "
25
- " https://llvm.googlesource.com/libcxx llvm/runtimes/libcxx 607e0c71ec4f7fd377ad3f6c47b08dbe89f66eaa "
26
- " https://llvm.googlesource.com/libcxxabi llvm/runtimes/libcxxabi 0a3a1a8a5ca5ef69e0f6b7d5b9d13e63e6fd2c19 "
27
- " https://llvm.googlesource.com/libunwind llvm/runtimes/libunwind e128003563d99d9ee62247c4cee40f07d21c03e3 "
20
+ " https://llvm.googlesource.com/llvm llvm 65bdf0ae4a87e6992c24f06e2612909952468710 "
21
+ " https://llvm.googlesource.com/clang llvm/tools/clang 914987de45cf83636537909ce09156aa7a37d6ec "
22
+ " https://llvm.googlesource.com/lld llvm/tools/lld f8ed4483c589b390daafac92e28f4680ad052643 "
23
+ " https://llvm.googlesource.com/lldb llvm/tools/lldb 55cf8753321782668cb7e2d879457ee1ad57a2b9 "
24
+ " https://llvm.googlesource.com/compiler-rt llvm/runtimes/compiler-rt a8682fdf74d3cb93769b7394f2cdffc5cefb8bd8 "
25
+ " https://llvm.googlesource.com/libcxx llvm/runtimes/libcxx 5f919fe349450b3da0e29611ae37f6a940179290 "
26
+ " https://llvm.googlesource.com/libcxxabi llvm/runtimes/libcxxabi caa78daf9285dada17e3e6b8aebcf7d128427f83 "
27
+ " https://llvm.googlesource.com/libunwind llvm/runtimes/libunwind 469bacd2ea64679c15bb4d86adf000f2f2c27328 "
28
28
)
29
29
30
30
fetch () {
@@ -41,27 +41,7 @@ for i in "${SRCS[@]}"; do
41
41
fetch $i
42
42
done
43
43
44
- # Remove this once https://reviews.llvm.org/D28791 is resolved
45
- cd llvm/runtimes/compiler-rt
46
- patch -Np1 < /tmp/compiler-rt-dso-handle.patch
47
- cd ../../..
48
-
49
- # Build toolchain
50
- cd llvm
51
- mkdir build
52
- cd build
53
- hide_output cmake -GNinja \
54
- -DFUCHSIA_SYSROOT=${PWD} /../../zircon/third_party/ulib/musl \
55
- -DLLVM_ENABLE_LTO=OFF \
56
- -DCLANG_BOOTSTRAP_PASSTHROUGH=LLVM_ENABLE_LTO \
57
- -C ../tools/clang/cmake/caches/Fuchsia.cmake \
58
- ..
59
- hide_output ninja stage2-distribution
60
- hide_output ninja stage2-install-distribution
61
- cd ../..
62
-
63
44
# Build sysroot
64
- rm -rf llvm/runtimes/compiler-rt
65
45
./zircon/scripts/download-toolchain
66
46
67
47
build_sysroot () {
@@ -77,40 +57,26 @@ build_sysroot() {
77
57
mkdir -p $dst
78
58
cp -r zircon/build-${tgt} /sysroot/include $dst /
79
59
cp -r zircon/build-${tgt} /sysroot/lib $dst /
80
-
81
- cd llvm
82
- mkdir build-runtimes-${arch}
83
- cd build-runtimes-${arch}
84
- hide_output cmake -GNinja \
85
- -DCMAKE_C_COMPILER=clang \
86
- -DCMAKE_CXX_COMPILER=clang++ \
87
- -DCMAKE_AR=/usr/local/bin/llvm-ar \
88
- -DCMAKE_RANLIB=/usr/local/bin/llvm-ranlib \
89
- -DCMAKE_INSTALL_PREFIX= \
90
- -DLLVM_MAIN_SRC_DIR=${PWD} /.. \
91
- -DLLVM_BINARY_DIR=${PWD} /../build \
92
- -DLLVM_ENABLE_WERROR=OFF \
93
- -DCMAKE_BUILD_TYPE=Release \
94
- -DLLVM_INCLUDE_TESTS=ON \
95
- -DCMAKE_SYSTEM_NAME=Fuchsia \
96
- -DCMAKE_C_COMPILER_TARGET=${arch} -fuchsia \
97
- -DCMAKE_CXX_COMPILER_TARGET=${arch} -fuchsia \
98
- -DUNIX=1 \
99
- -DLIBCXX_HAS_MUSL_LIBC=ON \
100
- -DLIBCXXABI_USE_LLVM_UNWINDER=ON \
101
- -DCMAKE_SYSROOT=${dst} \
102
- -DCMAKE_C_COMPILER_FORCED=TRUE \
103
- -DCMAKE_CXX_COMPILER_FORCED=TRUE \
104
- -DLLVM_ENABLE_LIBCXX=ON \
105
- -DCMAKE_EXE_LINKER_FLAGS=" -nodefaultlibs -lc" \
106
- -DCMAKE_SHARED_LINKER_FLAGS=" $( clang --target=${arch} -fuchsia -print-libgcc-file-name) " \
107
- ../runtimes
108
- hide_output env DESTDIR=" ${dst} " ninja install
109
- cd ../..
110
60
}
111
61
112
- build_sysroot " x86_64"
113
- build_sysroot " aarch64"
62
+ for arch in x86_64 aarch64; do
63
+ build_sysroot ${arch}
64
+ done
65
+
66
+ # Build toolchain
67
+ cd llvm
68
+ mkdir build
69
+ cd build
70
+ hide_output cmake -GNinja \
71
+ -DFUCHSIA_x86_64_SYSROOT=/usr/local/x86_64-unknown-fuchsia \
72
+ -DFUCHSIA_aarch64_SYSROOT=/usr/local/aarch64-unknown-fuchsia \
73
+ -DLLVM_ENABLE_LTO=OFF \
74
+ -DCLANG_BOOTSTRAP_PASSTHROUGH=LLVM_ENABLE_LTO \
75
+ -C ../tools/clang/cmake/caches/Fuchsia.cmake \
76
+ ..
77
+ hide_output ninja stage2-distribution
78
+ hide_output ninja stage2-install-distribution
79
+ cd ../..
114
80
115
81
rm -rf zircon llvm
116
82
0 commit comments