Bug 1634209 - Build lib32libc++ as a toolchain job. r=darktrojan

There is no 32-bit libc++ built as part of the Clang toolchain, this builds
a standalone version using the same source tar file that the rest of the
Clang toolchain is built with.

Differential Revision: https://phabricator.services.mozilla.com/D80223

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Rob Lemley 2020-06-18 22:22:36 +00:00
Родитель c9f4ed2034
Коммит 8dab7fb85d
4 изменённых файлов: 121 добавлений и 0 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -73,3 +73,4 @@ transforms:
jobs-from:
- libotr.yml
- 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

Просмотреть файл

@ -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