提交 1fdbfa99 编写于 作者: P Petr Hosek 提交者: James Tucker

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.
上级 0ef87cc1
......@@ -3,7 +3,6 @@ FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
......@@ -11,16 +10,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
git \
sudo \
bzip2 \
xz-utils \
swig \
libedit-dev \
libncurses5-dev \
patch \
unzip
RUN curl -L https://cmake.org/files/v3.9/cmake-3.9.2-Linux-x86_64.tar.gz | \
tar xzf - -C /usr/local --strip-components=1
WORKDIR /tmp
COPY dist-fuchsia/shared.sh dist-fuchsia/build-toolchain.sh /tmp/
RUN /tmp/build-toolchain.sh
......
......@@ -14,38 +14,22 @@
set -ex
source shared.sh
# Download sources
SRCS=(
"https://fuchsia.googlesource.com/zircon zircon e9a26dbc70d631029f8ee9763103910b7e3a2fe1"
"https://llvm.googlesource.com/llvm llvm 65bdf0ae4a87e6992c24f06e2612909952468710"
"https://llvm.googlesource.com/clang llvm/tools/clang 914987de45cf83636537909ce09156aa7a37d6ec"
"https://llvm.googlesource.com/clang-tools-extra llvm/tools/clang/tools/extra 83de24124250a7cdc7a0fdc61b7e3c3d64b80225"
"https://llvm.googlesource.com/lld llvm/tools/lld f8ed4483c589b390daafac92e28f4680ad052643"
"https://llvm.googlesource.com/lldb llvm/tools/lldb 55cf8753321782668cb7e2d879457ee1ad57a2b9"
"https://llvm.googlesource.com/compiler-rt llvm/runtimes/compiler-rt a8682fdf74d3cb93769b7394f2cdffc5cefb8bd8"
"https://llvm.googlesource.com/libcxx llvm/runtimes/libcxx 5f919fe349450b3da0e29611ae37f6a940179290"
"https://llvm.googlesource.com/libcxxabi llvm/runtimes/libcxxabi caa78daf9285dada17e3e6b8aebcf7d128427f83"
"https://llvm.googlesource.com/libunwind llvm/runtimes/libunwind 469bacd2ea64679c15bb4d86adf000f2f2c27328"
)
ZIRCON=e9a26dbc70d631029f8ee9763103910b7e3a2fe1
fetch() {
mkdir -p $2
pushd $2 > /dev/null
git init
git remote add origin $1
git fetch --depth=1 origin $3
git reset --hard FETCH_HEAD
popd > /dev/null
}
mkdir -p zircon
pushd zircon > /dev/null
for i in "${SRCS[@]}"; do
fetch $i
done
# Download sources
git init
git remote add origin https://fuchsia.googlesource.com/zircon
git fetch --depth=1 origin $ZIRCON
git reset --hard FETCH_HEAD
# Build sysroot
./zircon/scripts/download-toolchain
# Download toolchain
./scripts/download-toolchain
cp -a prebuilt/downloads/clang+llvm-x86_64-linux/. /usr/local
build_sysroot() {
build() {
local arch="$1"
case "${arch}" in
......@@ -53,33 +37,20 @@ build_sysroot() {
aarch64) tgt="zircon-qemu-arm64" ;;
esac
hide_output make -C zircon -j$(getconf _NPROCESSORS_ONLN) $tgt
hide_output make -j$(getconf _NPROCESSORS_ONLN) $tgt
dst=/usr/local/${arch}-unknown-fuchsia
mkdir -p $dst
cp -r zircon/build-${tgt}/sysroot/include $dst/
cp -r zircon/build-${tgt}/sysroot/lib $dst/
cp -a build-${tgt}/sysroot/include $dst/
cp -a build-${tgt}/sysroot/lib $dst/
}
# Build sysroot
for arch in x86_64 aarch64; do
build_sysroot ${arch}
build ${arch}
done
# Build toolchain
cd llvm
mkdir build
cd build
hide_output cmake -GNinja \
-DFUCHSIA_x86_64_SYSROOT=/usr/local/x86_64-unknown-fuchsia \
-DFUCHSIA_aarch64_SYSROOT=/usr/local/aarch64-unknown-fuchsia \
-DLLVM_ENABLE_LTO=OFF \
-DCLANG_BOOTSTRAP_PASSTHROUGH=LLVM_ENABLE_LTO \
-C ../tools/clang/cmake/caches/Fuchsia.cmake \
..
hide_output ninja stage2-distribution
hide_output ninja stage2-install-distribution
cd ../..
rm -rf zircon llvm
popd > /dev/null
rm -rf zircon
for arch in x86_64 aarch64; do
for tool in clang clang++; do
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册