Skip to content

Commit 1fdbfa9

Browse files
petrhosekraggi
authored andcommitted
Use Zircon's Clang rather than building our own
This toolchain is already used to build Zircon itself and is the official Clang toolchain used by all Fuchsia developers.
1 parent 0ef87cc commit 1fdbfa9

File tree

2 files changed

+19
-57
lines changed

2 files changed

+19
-57
lines changed

src/ci/docker/dist-fuchsia/Dockerfile

-9
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,15 @@ FROM ubuntu:16.04
33
RUN apt-get update && apt-get install -y --no-install-recommends \
44
g++ \
55
make \
6-
ninja-build \
76
file \
87
curl \
98
ca-certificates \
109
python2.7-dev \
1110
git \
1211
sudo \
1312
bzip2 \
14-
xz-utils \
15-
swig \
16-
libedit-dev \
17-
libncurses5-dev \
18-
patch \
1913
unzip
2014

21-
RUN curl -L https://cmake.org/files/v3.9/cmake-3.9.2-Linux-x86_64.tar.gz | \
22-
tar xzf - -C /usr/local --strip-components=1
23-
2415
WORKDIR /tmp
2516
COPY dist-fuchsia/shared.sh dist-fuchsia/build-toolchain.sh /tmp/
2617
RUN /tmp/build-toolchain.sh

src/ci/docker/dist-fuchsia/build-toolchain.sh

+19-48
Original file line numberDiff line numberDiff line change
@@ -14,72 +14,43 @@
1414
set -ex
1515
source shared.sh
1616

17-
# Download sources
18-
SRCS=(
19-
"https://fuchsia.googlesource.com/zircon zircon e9a26dbc70d631029f8ee9763103910b7e3a2fe1"
20-
"https://llvm.googlesource.com/llvm llvm 65bdf0ae4a87e6992c24f06e2612909952468710"
21-
"https://llvm.googlesource.com/clang llvm/tools/clang 914987de45cf83636537909ce09156aa7a37d6ec"
22-
"https://llvm.googlesource.com/clang-tools-extra llvm/tools/clang/tools/extra 83de24124250a7cdc7a0fdc61b7e3c3d64b80225"
23-
"https://llvm.googlesource.com/lld llvm/tools/lld f8ed4483c589b390daafac92e28f4680ad052643"
24-
"https://llvm.googlesource.com/lldb llvm/tools/lldb 55cf8753321782668cb7e2d879457ee1ad57a2b9"
25-
"https://llvm.googlesource.com/compiler-rt llvm/runtimes/compiler-rt a8682fdf74d3cb93769b7394f2cdffc5cefb8bd8"
26-
"https://llvm.googlesource.com/libcxx llvm/runtimes/libcxx 5f919fe349450b3da0e29611ae37f6a940179290"
27-
"https://llvm.googlesource.com/libcxxabi llvm/runtimes/libcxxabi caa78daf9285dada17e3e6b8aebcf7d128427f83"
28-
"https://llvm.googlesource.com/libunwind llvm/runtimes/libunwind 469bacd2ea64679c15bb4d86adf000f2f2c27328"
29-
)
17+
ZIRCON=e9a26dbc70d631029f8ee9763103910b7e3a2fe1
3018

31-
fetch() {
32-
mkdir -p $2
33-
pushd $2 > /dev/null
34-
git init
35-
git remote add origin $1
36-
git fetch --depth=1 origin $3
37-
git reset --hard FETCH_HEAD
38-
popd > /dev/null
39-
}
19+
mkdir -p zircon
20+
pushd zircon > /dev/null
4021

41-
for i in "${SRCS[@]}"; do
42-
fetch $i
43-
done
22+
# Download sources
23+
git init
24+
git remote add origin https://fuchsia.googlesource.com/zircon
25+
git fetch --depth=1 origin $ZIRCON
26+
git reset --hard FETCH_HEAD
4427

45-
# Build sysroot
46-
./zircon/scripts/download-toolchain
28+
# Download toolchain
29+
./scripts/download-toolchain
30+
cp -a prebuilt/downloads/clang+llvm-x86_64-linux/. /usr/local
4731

48-
build_sysroot() {
32+
build() {
4933
local arch="$1"
5034

5135
case "${arch}" in
5236
x86_64) tgt="zircon-pc-x86-64" ;;
5337
aarch64) tgt="zircon-qemu-arm64" ;;
5438
esac
5539

56-
hide_output make -C zircon -j$(getconf _NPROCESSORS_ONLN) $tgt
40+
hide_output make -j$(getconf _NPROCESSORS_ONLN) $tgt
5741
dst=/usr/local/${arch}-unknown-fuchsia
5842
mkdir -p $dst
59-
cp -r zircon/build-${tgt}/sysroot/include $dst/
60-
cp -r zircon/build-${tgt}/sysroot/lib $dst/
43+
cp -a build-${tgt}/sysroot/include $dst/
44+
cp -a build-${tgt}/sysroot/lib $dst/
6145
}
6246

47+
# Build sysroot
6348
for arch in x86_64 aarch64; do
64-
build_sysroot ${arch}
49+
build ${arch}
6550
done
6651

67-
# Build toolchain
68-
cd llvm
69-
mkdir build
70-
cd build
71-
hide_output cmake -GNinja \
72-
-DFUCHSIA_x86_64_SYSROOT=/usr/local/x86_64-unknown-fuchsia \
73-
-DFUCHSIA_aarch64_SYSROOT=/usr/local/aarch64-unknown-fuchsia \
74-
-DLLVM_ENABLE_LTO=OFF \
75-
-DCLANG_BOOTSTRAP_PASSTHROUGH=LLVM_ENABLE_LTO \
76-
-C ../tools/clang/cmake/caches/Fuchsia.cmake \
77-
..
78-
hide_output ninja stage2-distribution
79-
hide_output ninja stage2-install-distribution
80-
cd ../..
81-
82-
rm -rf zircon llvm
52+
popd > /dev/null
53+
rm -rf zircon
8354

8455
for arch in x86_64 aarch64; do
8556
for tool in clang clang++; do

0 commit comments

Comments
 (0)