diff --git a/taskcluster/ci/build/linux.yml b/taskcluster/ci/build/linux.yml index 69000046b0..af77168a4d 100644 --- a/taskcluster/ci/build/linux.yml +++ b/taskcluster/ci/build/linux.yml @@ -151,6 +151,7 @@ linux/opt: - linux64-binutils - linux64-cbindgen - linux64-clang + - linux64-clang-lib32cxx - linux32-libotr - linux64-nasm - linux64-node @@ -196,6 +197,7 @@ linux-shippable/opt: - linux64-binutils - linux64-cbindgen - linux64-clang + - linux64-clang-lib32cxx - linux32-libotr - linux64-nasm - linux64-node @@ -232,6 +234,7 @@ linux/debug: - linux64-binutils - linux64-cbindgen - linux64-clang + - linux64-clang-lib32cxx - linux64-fix-stacks # see bug 1614626 - linux32-libotr - linux64-nasm diff --git a/taskcluster/ci/toolchain/kind.yml b/taskcluster/ci/toolchain/kind.yml index 73d55679b0..342be8c771 100644 --- a/taskcluster/ci/toolchain/kind.yml +++ b/taskcluster/ci/toolchain/kind.yml @@ -73,3 +73,4 @@ transforms: jobs-from: - libotr.yml + - libcxx.yml diff --git a/taskcluster/ci/toolchain/libcxx.yml b/taskcluster/ci/toolchain/libcxx.yml new file mode 100644 index 0000000000..2f8fcca436 --- /dev/null +++ b/taskcluster/ci/toolchain/libcxx.yml @@ -0,0 +1,28 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +--- +job-defaults: + treeherder: + kind: build + platform: toolchains/opt + tier: 1 + run-on-projects: [] + +linux64-clang-lib32cxx: + description: "libc++ for linux32" + treeherder: + symbol: TL(lib32-libcxx) + worker-type: b-linux + worker: + max-run-time: 1800 + run: + using: comm-toolchain-script + script: build-lib32cxx.sh + toolchain-artifact: public/build/lib32cxx.tar.xz + fetches: + fetch: + - clang-9 # Need to keep current with linux64-clang + toolchain: + - linux64-clang-9 + - linux64-gcc-7 # Use what linux64-clang uses diff --git a/taskcluster/scripts/build-lib32cxx.sh b/taskcluster/scripts/build-lib32cxx.sh new file mode 100755 index 0000000000..54409bdaa9 --- /dev/null +++ b/taskcluster/scripts/build-lib32cxx.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +set -x -E -v + +# This script is for building libc++.a (linux32) + +# Environment variables that are set by Taskcluster. +GECKO_PATH=${GECKO_PATH:-"/builds/worker/checkouts/gecko"} +MOZ_FETCHES_DIR=${MOZ_FETCHES_DIR:-"/builds/worker/workspace/fetches"} +UPLOAD_DIR=${UPLOAD_DIR:-"/builds/worker/artifacts"} + +cd $GECKO_PATH + +if [ -n "$TOOLTOOL_MANIFEST" ]; then + . taskcluster/scripts/misc/tooltool-download.sh +fi + +if [ -d "$MOZ_FETCHES_DIR/binutils/bin" ]; then + export PATH="$MOZ_FETCHES_DIR/binutils/bin:$PATH" +fi +if [ -d "$MOZ_FETCHES_DIR/gcc/bin" ]; then + export PATH="$MOZ_FETCHES_DIR/gcc/bin:$PATH" +fi +if [ -d "$MOZ_FETCHES_DIR/clang/bin" ]; then + export PATH="$MOZ_FETCHES_DIR/clang/bin:$PATH" +fi + +PKGDIR="${MOZ_FETCHES_DIR}/pkgdir" + +prepare() { + cd $MOZ_FETCHES_DIR/llvm-project + mkdir build-libcxxabi build-libcxx + return 0 +} + +build() { + local base_cmake_args="-G Ninja + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_INSTALL_PREFIX=$PKGDIR/lib32-libc++ + -DLLVM_LIBDIR_SUFFIX=32 + -DLLVM_LINK_LLVM_DYLIB=ON + -DLLVM_ENABLE_RTTI=ON + -DLLVM_MAIN_SRC_DIR=$MOZ_FETCHES_DIR/llvm-project" + + local abi_cmake_args="-DLIBCXXABI_INCLUDE_TESTS=OFF" + local cxx_cmake_args="-DPYTHON_EXECUTABLE=/usr/bin/python2.7 + -DLIBCXX_CXX_ABI=libcxxabi + -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${MOZ_FETCHES_DIR}/llvm-project/libcxxabi/include + -DLIBCXX_CXX_ABI_LIBRARY_PATH=${PKGDIR}/lib32-libc++/lib32" + + cd "${MOZ_FETCHES_DIR}/llvm-project/build-libcxxabi" + cmake ../libcxxabi -DCMAKE_C_FLAGS:STRING="-m32 -fPIC" -DCMAKE_CXX_FLAGS:STRING="-m32 -fPIC" \ + ${base_cmake_args} ${abi_cmake_args} + ninja && ninja install + + cd "${MOZ_FETCHES_DIR}/llvm-project/build-libcxx" + cmake ../libcxx -DCMAKE_C_FLAGS:STRING="-m32 -fPIC" -DCMAKE_CXX_FLAGS:STRING="-m32 -fPIC" \ + ${base_cmake_args} ${cxx_cmake_args} + ninja && ninja install + + return 0 +} + +package() { + cd "${PKGDIR}" + mv lib32-libc++ clang # This is so when unpacked, the files overlay the clang toolchain + rm -rf clang/include + + mkdir -p "${UPLOAD_DIR}" + tar cfJ "${UPLOAD_DIR}"/lib32cxx.tar.xz clang + + return 0 +} + +# Basic dependency structure. +# Each step depends on the previous completing successfully. +# The packaging block depends on the build block's success. +{ + prepare && + build && + package +} && exit 0 + +# Ideally, the "exit 0" above ran after the packaging block ran successfully. +# In case it didn't, error out here so CI catches it. +exit 1