Remove old mason

This commit is contained in:
Patrick Niklaus
2016-12-15 09:39:46 +00:00
parent 38b2ad298d
commit 708ac04562
733 changed files with 0 additions and 30715 deletions
-9
View File
@@ -1,9 +0,0 @@
language: generic
env:
global:
- secure: "clCFM3prHnDocZ8lXlimPxAogvFirD1Zx8cMcFJ/XpkTA/0pCgnhpArM4y/NzLHR57pNZTSCr3p6XZI1c1iTG4Zm8x0sK2A4aTFRahypXNy/e+LzAbtd1y1+dEEDwlJvNNGxizQX4frhOgSNQFDFnWLtmF3stlft5YWyc2kI+FI="
- secure: "jKJErCng8Sk8YJ0IN2FX3lhv7G1LeudMfFBAXViZaXn8w/gWPs+SlfXQmIJ5SruU7U2GQKnAhzbjwXjVAgAh8OAblzny0DDm5Lh5WmwkgAP8JH1LpsBwCYx2S/v8qyR4DX1RVhHS8mQu298180ZDVgGccw+hd8xrE/S5TEQcNfQ="
script:
- echo "nothing to do since travis cannot compile something as large as llvm"
-7
View File
@@ -1,7 +0,0 @@
### llvm v3.8.1
This is a package of all llvm tools. Multiple packages are based on repackaging the binaries from this one including:
- clang++ 3.8.1
- clang-tidy 3.8.1
- clang-format 3.8.1
-24
View File
@@ -1,24 +0,0 @@
#!/usr/bin/env bash
# dynamically determine the path to this package
HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
# dynamically take name of package from directory
MASON_NAME=$(basename $(dirname $HERE))
# dynamically take the version of the package from directory
MASON_VERSION=$(basename $HERE)
# inherit all functions from llvm base
source ${HERE}/../../${MASON_NAME}/base/common.sh
function setup_release() {
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/llvm-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/ 6de84b7bb71e49ef2764d364c4318e01fda1e1e3
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/cfe-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/tools/clang 9a05f9c1c8dc865c064782dedbbbfb533c3909ac
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/compiler-rt-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/projects/compiler-rt 678cbff6e177a18f4e2d0662901a744163da3347
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/libcxx-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/projects/libcxx d15220e86eb8480e58a4378a4c977bbb5463fb79
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/libcxxabi-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/projects/libcxxabi b7508c64ab8e670062ee57a12ae1e542bcb2bfb4
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/libunwind-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/projects/libunwind 90c0184ca72e1999fec304f76bfa10340f038ee5
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/lld-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/tools/lld 416c36ded12ead42dc4739d52eabf22267300883
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/clang-tools-extra-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/tools/clang/tools/extra ea40e36d54dc8c9bb21cbebcc872a3221a2ed685
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/lldb-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/tools/lldb c8c38fa9ab92f9021067678f1a1c8f07ea75ac93
}
mason_run "$@"
-9
View File
@@ -1,9 +0,0 @@
language: generic
env:
global:
- secure: "clCFM3prHnDocZ8lXlimPxAogvFirD1Zx8cMcFJ/XpkTA/0pCgnhpArM4y/NzLHR57pNZTSCr3p6XZI1c1iTG4Zm8x0sK2A4aTFRahypXNy/e+LzAbtd1y1+dEEDwlJvNNGxizQX4frhOgSNQFDFnWLtmF3stlft5YWyc2kI+FI="
- secure: "jKJErCng8Sk8YJ0IN2FX3lhv7G1LeudMfFBAXViZaXn8w/gWPs+SlfXQmIJ5SruU7U2GQKnAhzbjwXjVAgAh8OAblzny0DDm5Lh5WmwkgAP8JH1LpsBwCYx2S/v8qyR4DX1RVhHS8mQu298180ZDVgGccw+hd8xrE/S5TEQcNfQ="
script:
- echo "nothing to do since travis cannot compile something as large as llvm"
-124
View File
@@ -1,124 +0,0 @@
### llvm v3.9.0
This is a package of all llvm tools. Multiple packages are based on repackaging the binaries from this one including:
- clang++ 3.9.0
- clang-tidy 3.9.0
- clang-format 3.9.0
### Details of package
This package inherits from `scripts/llvm/base/common.sh`, which is a base configuration and not an actual package itself.
Therefore to see the intricacies of how this package is built look in `scripts/llvm/base/common.sh`.
The `scripts/llvm/base/common.sh` is used by both llvm 3.8.1 and llvm 3.9.0 packages (and future ones). It reduces duplication of package code and makes it easier to update the builds in one place to benefit all versions.
The `scripts/llvm/3.9.0/script.sh` therefore sources `scripts/llvm/base/common.sh` and then overrides just the functions that need to be customized. At the time of writing this is only the `setup_release` function. It is customized in order to provide version specific md5 values which can ensure that upstream packages do not change without us noticing.
### Details of builds
- Done on Sept 22, 2016 by @springmeyer
- OS X build done on OS X 10.11
- Linux build done on ubuntu precise
The order and method of building was generally:
```sh
VERSION=3.9.0
./mason build llvm ${VERSION}
./mason publish llvm ${VERSION}
./mason build clang++ ${VERSION}
./mason publish clang++ ${VERSION}
./mason build clang-tidy ${VERSION}
./mason publish clang-tidy ${VERSION}
./mason build clang-format ${VERSION}
./mason publish clang-format ${VERSION}
./mason build lldb ${VERSION}
./mason publish lldb ${VERSION}
./mason build llvm-cov ${VERSION}
./mason publish llvm-cov ${VERSION}
```
#### OSX details
On macOS we use the apple system clang++ to compile and link against the apple system libc++.
```sh
$ clang++ -v
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
```
Therefore the llvm package was built like:
```sh
./mason build llvm 3.9.0
```
#### Linux details
On linux we use precise in order to ensure that binaries can be run on ubuntu precise and newer platforms.
We still want to compile clang++ in c++11 mode so we compile clang++ using a mason provided clang++.
To support c++11 we'd normally need to upgrade libstdc++ which would make it problematic for the resulting binary to be portable to linux systems without that upgraded libstdc++. So we avoid this issue by instead linking clang++ to libc++, which itself will travel inside the clang++ package.
To accomplish this (c++11 build of clang++ and linking to libc++ instead of an upgraded libstdc++) we did:
```sh
./mason install clang++ 3.9.0
CLANG_39_PREFIX=$(./mason prefix clang++ 3.9.0)
export CXX=${CLANG_39_PREFIX}/bin/clang++-3.9
export CC=${CLANG_39_PREFIX}/bin/clang-3.9
./mason build llvm 3.9.0
```
The reason `LD_LIBRARY_PATH` is set before the build is so that libc++.so can be found during linking. Once linked clang++ automatically uses the right @rpath on macOS and linux to find its own libc++.so at runtime.
TODO:
- Modify the llvm 3.9.0 build scripts to build libc++ and libc++abi first.
- Then we should be able to point LD_LIBRARY_PATH at llvm 3.9.0's libc++.so to avoid potential ABI mismatch with the version provided by 3.8.0
- LD_LIBRARY_PATH would be pointed at the theoretical location of llvm 3.9.0's libc++, and that location would exist and become valid before llvm 3.9.0's clang++ is linked.
### Testing of these new tools
Once these packages were built I needed to test that they could be used to build and publish other mason packages. And I needed to be able to test that these packages worked for downstream users.
To accomplish this I branched mason and changed the `MASON_PLATFORM_ID` to enable publishing new binaries with llvm 3.9.0 tools without overwriting existing binaries.
```
diff --git a/mason.sh b/mason.sh
index 800216d..ccc1fcb 100644
--- a/mason.sh
+++ b/mason.sh
@@ -259,7 +259,7 @@ MASON_SLUG=${MASON_NAME}-${MASON_VERSION}
if [[ ${MASON_HEADER_ONLY} == true ]]; then
MASON_PLATFORM_ID=headers
else
- MASON_PLATFORM_ID=${MASON_PLATFORM}-${MASON_PLATFORM_VERSION}
+ MASON_PLATFORM_ID=${MASON_PLATFORM}-${MASON_PLATFORM_VERSION}-llvm390
fi
MASON_PREFIX=${MASON_ROOT}/${MASON_PLATFORM_ID}/${MASON_NAME}/${MASON_VERSION}
MASON_BINARIES=${MASON_PLATFORM_ID}/${MASON_NAME}/${MASON_VERSION}.tar.gz
```
But changing the `MASON_PLATFORM_ID` also means that you loose access to all existing binaries for building packages. To ensure I could still bootstrap the builds I seeded this new `MASON_PLATFORM_ID` with key build tools, including the previously built llvm tools being discussed here.
```
CUSTOM_PATH="llvm390"
aws s3 sync --acl public-read s3://mason-binaries/linux-x86_64/llvm/ s3://mason-binaries/linux-x86_64-{CUSTOM_PATH}/llvm/
aws s3 sync --acl public-read s3://mason-binaries/linux-x86_64/clang++/ s3://mason-binaries/linux-x86_64-{CUSTOM_PATH}/clang++/
aws s3 sync --acl public-read s3://mason-binaries/linux-x86_64/cmake/ s3://mason-binaries/linux-x86_64-{CUSTOM_PATH}/cmake/
aws s3 sync --acl public-read s3://mason-binaries/linux-x86_64/ccache/ s3://mason-binaries/linux-x86_64-{CUSTOM_PATH}/ccache/
aws s3 sync --acl public-read s3://mason-binaries/linux-x86_64/ninja/ s3://mason-binaries/linux-x86_64-{CUSTOM_PATH}/ninja/
aws s3 sync --acl public-read s3://mason-binaries/osx-x86_64/llvm/ s3://mason-binaries/osx-x86_64-{CUSTOM_PATH}/llvm/
aws s3 sync --acl public-read s3://mason-binaries/osx-x86_64/clang++/ s3://mason-binaries/osx-x86_64-{CUSTOM_PATH}/clang++/
aws s3 sync --acl public-read s3://mason-binaries/osx-x86_64/cmake/ s3://mason-binaries/osx-x86_64-{CUSTOM_PATH}/cmake/
aws s3 sync --acl public-read s3://mason-binaries/osx-x86_64/ccache/ s3://mason-binaries/osx-x86_64-{CUSTOM_PATH}/ccache/
aws s3 sync --acl public-read s3://mason-binaries/osx-x86_64/ninja/ s3://mason-binaries/osx-x86_64-{CUSTOM_PATH}/ninja/
```
-24
View File
@@ -1,24 +0,0 @@
#!/usr/bin/env bash
# dynamically determine the path to this package
HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
# dynamically take name of package from directory
MASON_NAME=$(basename $(dirname $HERE))
# dynamically take the version of the package from directory
MASON_VERSION=$(basename $HERE)
# inherit all functions from llvm base
source ${HERE}/../../${MASON_NAME}/base/common.sh
function setup_release() {
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/llvm-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/ 00f5268479117c9c7f90d0f9e2f06485875f5444
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/cfe-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/tools/clang 465e70cfb1d8b3fb5d1f6577933f7b5014aca3bd
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/compiler-rt-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/projects/compiler-rt 7a2ea8a7257a739330d8f7cfe2bcb70939476f31
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/libcxx-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/projects/libcxx 248635c4821b9f2e4b620364c21a2596eed514cd
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/libcxxabi-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/projects/libcxxabi 04ffa28577ec3d935dcd69d137a2e478e71f2704
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/libunwind-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/projects/libunwind 32e17eaf6a5b769c244480bd32ab3c9cbdf6c97d
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/lld-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/tools/lld e1829cd47a5c44ad6c68957056afe63879ad9610
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/clang-tools-extra-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/tools/clang/tools/extra 8e7e118a769c76e70d5fb2ede66c8f5a2952f8d9
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/lldb-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/tools/lldb 988766cbb3d4a295b33dd11f51f7f20811bfa8f2
}
mason_run "$@"
-9
View File
@@ -1,9 +0,0 @@
language: generic
env:
global:
- secure: "clCFM3prHnDocZ8lXlimPxAogvFirD1Zx8cMcFJ/XpkTA/0pCgnhpArM4y/NzLHR57pNZTSCr3p6XZI1c1iTG4Zm8x0sK2A4aTFRahypXNy/e+LzAbtd1y1+dEEDwlJvNNGxizQX4frhOgSNQFDFnWLtmF3stlft5YWyc2kI+FI="
- secure: "jKJErCng8Sk8YJ0IN2FX3lhv7G1LeudMfFBAXViZaXn8w/gWPs+SlfXQmIJ5SruU7U2GQKnAhzbjwXjVAgAh8OAblzny0DDm5Lh5WmwkgAP8JH1LpsBwCYx2S/v8qyR4DX1RVhHS8mQu298180ZDVgGccw+hd8xrE/S5TEQcNfQ="
script:
- echo "nothing to do since travis cannot compile something as large as llvm"
-3
View File
@@ -1,3 +0,0 @@
### llvm v4.x
Development package of llvm git head
-27
View File
@@ -1,27 +0,0 @@
#!/usr/bin/env bash
# dynamically determine the path to this package
HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
# dynamically take name of package from directory
MASON_NAME=$(basename $(dirname $HERE))
# dynamically take the version of the package from directory
MASON_VERSION=$(basename $HERE)
# inherit all functions from llvm base
source ${HERE}/../../${MASON_NAME}/base/common.sh
# git_get https://github.com/include-what-you-use/include-what-you-use.git ${LLVM_RELEASE}/llvm/tools/clang/tools/include-what-you-use
function setup_release() {
get_llvm_project "http://llvm.org/git/llvm.git" ${MASON_BUILD_PATH}
get_llvm_project "http://llvm.org/git/clang.git" ${MASON_BUILD_PATH}/tools/clang
get_llvm_project "http://llvm.org/git/compiler-rt.git" ${MASON_BUILD_PATH}/projects/compiler-rt
get_llvm_project "http://llvm.org/git/libcxx.git" ${MASON_BUILD_PATH}/projects/libcxx
get_llvm_project "http://llvm.org/git/libcxxabi.git" ${MASON_BUILD_PATH}/projects/libcxxabi
get_llvm_project "http://llvm.org/git/libunwind.git" ${MASON_BUILD_PATH}/projects/libunwind
get_llvm_project "http://llvm.org/git/lld.git" ${MASON_BUILD_PATH}/tools/lld
get_llvm_project "http://llvm.org/git/clang-tools-extra.git" ${MASON_BUILD_PATH}/tools/clang/tools/extra
get_llvm_project "http://llvm.org/git/lldb.git" ${MASON_BUILD_PATH}/tools/lldb
}
mason_run "$@"
-207
View File
@@ -1,207 +0,0 @@
#!/usr/bin/env bash
MASON_NAME=llvm
MASON_LIB_FILE=bin/clang
. ${MASON_DIR}/mason.sh
# we use this custom function rather than "mason_download" since we need to easily grab multiple packages
function get_llvm_project() {
local URL=${1}
local TO_DIR=${2}
if [[ ${TO_DIR:-false} == false ]]; then
mason_error "TO_DIR unset"
exit 1
fi
local EXPECTED_HASH=${3:-false}
local file_basename=$(basename ${URL})
local local_file_or_checkout=$(pwd)/${file_basename}
if [[ ${URL} =~ '.git' ]]; then
if [ ! -d ${local_file_or_checkout} ] ; then
mason_step "cloning ${URL} to ${local_file_or_checkout}"
git clone --depth 1 ${URL} ${local_file_or_checkout}
else
mason_substep "already cloned ${URL}, pulling to update"
(cd ${local_file_or_checkout} && git pull)
fi
mason_step "moving ${local_file_or_checkout} into place at ${TO_DIR}"
cp -r ${local_file_or_checkout} ${TO_DIR}
else
if [ ! -f ${local_file_or_checkout} ] ; then
mason_step "Downloading ${URL} to ${local_file_or_checkout}"
curl --retry 3 -f -L -O "${URL}"
else
mason_substep "already downloaded $1 to ${local_file_or_checkout}"
fi
export OBJECT_HASH=$(git hash-object ${local_file_or_checkout})
if [[ ${EXPECTED_HASH:-false} == false ]]; then
mason_error "Warning: no expected hash provided by script.sh, actual was ${OBJECT_HASH}"
else
if [[ $3 != ${OBJECT_HASH} ]]; then
mason_error "Error: hash mismatch ${EXPECTED_HASH} (expected) != ${OBJECT_HASH} (actual)"
exit 1
else
mason_success "Success: hash matched: ${EXPECTED_HASH} (expected) == ${OBJECT_HASH} (actual)"
fi
fi
mason_step "uncompressing ${local_file_or_checkout}"
tar xf ${local_file_or_checkout}
local uncompressed_dir=${file_basename/.tar.xz}
mason_step "moving ${uncompressed_dir} into place at ${TO_DIR}"
mv ${uncompressed_dir} ${TO_DIR}
fi
}
# Note: override this function to set custom hash
function setup_release() {
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/llvm-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/cfe-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/tools/clang
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/compiler-rt-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/projects/compiler-rt
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/libcxx-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/projects/libcxx
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/libcxxabi-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/projects/libcxxabi
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/libunwind-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/projects/libunwind
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/lld-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/tools/lld
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/clang-tools-extra-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/tools/clang/tools/extra
get_llvm_project "http://llvm.org/releases/${MASON_VERSION}/lldb-${MASON_VERSION}.src.tar.xz" ${MASON_BUILD_PATH}/tools/lldb
}
function mason_load_source {
mkdir -p "${MASON_ROOT}/.cache"
cd "${MASON_ROOT}/.cache"
export MASON_BUILD_PATH=${MASON_ROOT}/.build/llvm-${MASON_VERSION}
mkdir -p "${MASON_ROOT}/.build"
if [[ -d ${MASON_BUILD_PATH}/ ]]; then
rm -rf ${MASON_BUILD_PATH}/
fi
# NOTE: this setup_release can be overridden per package to assert on different hash
setup_release
}
function mason_prepare_compile {
CCACHE_VERSION=3.3.1
CMAKE_VERSION=3.6.2
NINJA_VERSION=1.7.1
${MASON_DIR}/mason install ccache ${CCACHE_VERSION}
MASON_CCACHE=$(${MASON_DIR}/mason prefix ccache ${CCACHE_VERSION})
${MASON_DIR}/mason install cmake ${CMAKE_VERSION}
MASON_CMAKE=$(${MASON_DIR}/mason prefix cmake ${CMAKE_VERSION})
${MASON_DIR}/mason install ninja ${NINJA_VERSION}
MASON_NINJA=$(${MASON_DIR}/mason prefix ninja ${NINJA_VERSION})
if [[ $(uname -s) == 'Linux' ]]; then
BINUTILS_VERSION=2.27
${MASON_DIR}/mason install binutils ${BINUTILS_VERSION}
LLVM_BINUTILS_INCDIR=$(${MASON_DIR}/mason prefix binutils ${BINUTILS_VERSION})/include
fi
}
function mason_compile {
export CXX="${CXX:-clang++}"
export CC="${CC:-clang}"
# knock out lldb doc building, to remove doxygen dependency
perl -i -p -e "s/add_subdirectory\(docs\)//g;" tools/lldb/CMakeLists.txt
mkdir -p ./build
cd ./build
CMAKE_EXTRA_ARGS=""
if [[ $(uname -s) == 'Darwin' ]]; then
# This is a stable location for libc++ headers from the system
SYSTEM_LIBCXX_HEADERS="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/"
# This is the location of C headers on 10.11
OSX_10_11_SDK_C_HEADERS="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/"
# This is the location of C headers on >= 10.12 which is a symlink to the versioned SDK
OSX_10_12_AND_GREATER_SDK_HEADERS="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/"
# This allows this version of clang to find the headers from only a command line tools install (no xcode installed)
# It is debatable whether this should be supported
COMMAND_LINE_TOOLS_C_HEADERS="/usr/include"
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DC_INCLUDE_DIRS=:${SYSTEM_LIBCXX_HEADERS}:${OSX_10_12_AND_GREATER_SDK_HEADERS}:${OSX_10_11_SDK_C_HEADERS}:${COMMAND_LINE_TOOLS_C_HEADERS}"
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DCLANG_DEFAULT_CXX_STDLIB=libc++"
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DDEFAULT_SYSROOT=/"
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11"
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DLLVM_CREATE_XCODE_TOOLCHAIN=ON -DLLVM_EXTERNALIZE_DEBUGINFO=ON"
fi
MAJOR_MINOR=$(echo $MASON_VERSION | cut -d '.' -f1-2)
if [[ $(uname -s) == 'Linux' ]]; then
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DLLVM_BINUTILS_INCDIR=${LLVM_BINUTILS_INCDIR}"
if [[ ${MAJOR_MINOR} == "3.8" ]]; then
# note: LIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON is only needed with llvm < 3.9.0 to avoid libcxx(abi) build breaking when only a static libc++ exists
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON"
fi
fi
# we link to libc++ even on linux to avoid runtime dependency on libstdc++:
# https://github.com/mapbox/mason/issues/252
export CXXFLAGS="-stdlib=libc++ ${CXXFLAGS//-mmacosx-version-min=10.8}"
export LDFLAGS="-stdlib=libc++ ${LDFLAGS//-mmacosx-version-min=10.8}"
if [[ $(uname -s) == 'Linux' ]]; then
export LDFLAGS="${LDFLAGS} -Wl,--start-group -L$(pwd)/lib -lc++ -lc++abi -pthread -lc -lgcc_s"
fi
# llvm may request c++14 instead so let's not force c++11
export CXXFLAGS="${CXXFLAGS//-std=c++11}"
# TODO: test this
#-DLLVM_ENABLE_LTO=ON \
${MASON_CMAKE}/bin/cmake ../ -G Ninja -DCMAKE_INSTALL_PREFIX=${MASON_PREFIX} \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_TARGETS_TO_BUILD="ARM;X86;AArch64" \
-DCMAKE_CXX_COMPILER_LAUNCHER="${MASON_CCACHE}/bin/ccache" \
-DCMAKE_CXX_COMPILER="$CXX" \
-DCMAKE_C_COMPILER="$CC" \
-DLIBCXX_ENABLE_ASSERTIONS=OFF \
-DLIBCXX_ENABLE_SHARED=OFF \
-DLIBCXXABI_ENABLE_SHARED=OFF \
-DLIBUNWIND_ENABLE_SHARED=OFF \
-DLIBCXXABI_USE_LLVM_UNWINDER=ON \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DCLANG_VENDOR="mapbox/mason" \
-DCLANG_REPOSITORY_STRING="https://github.com/mapbox/mason" \
-DCLANG_VENDOR_UTI="org.mapbox.llvm" \
-DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
-DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
-DLLDB_DISABLE_PYTHON=1 -DLLDB_DISABLE_CURSES=1 -DLLDB_DISABLE_LIBEDIT=1 -DLLVM_ENABLE_TERMINFO=0 \
-DCMAKE_MAKE_PROGRAM=${MASON_NINJA}/bin/ninja \
${CMAKE_EXTRA_ARGS}
${MASON_NINJA}/bin/ninja unwind -j${MASON_CONCURRENCY}
# make libc++ and libc++abi first
# this ensures that the LD_LIBRARY_PATH above will be valid
# and that clang++ on linux will be able to link itself to
# this same instance of libc++
${MASON_NINJA}/bin/ninja cxx -j${MASON_CONCURRENCY}
${MASON_NINJA}/bin/ninja lldb -j${MASON_CONCURRENCY}
# no move the host compilers libc++ and libc++abi shared libs out of the way
if [[ ${CXX_BOOTSTRAP:-false} != false ]]; then
mkdir -p /tmp/backup_shlibs
mv $(dirname $(dirname $CXX))/lib/*c++*so /tmp/backup_shlibs/
fi
# then make everything else
${MASON_NINJA}/bin/ninja -j${MASON_CONCURRENCY}
# install it all
${MASON_NINJA}/bin/ninja install
# set up symlinks for clang++ to match what llvm.org binaries provide
cd ${MASON_PREFIX}/bin/
ln -s "clang++" "clang++-${MAJOR_MINOR}"
# restore host compilers sharedlibs
if [[ ${CXX_BOOTSTRAP:-false} != false ]]; then
cp -r /tmp/backup_shlibs/* $(dirname $(dirname $CXX))/lib/
fi
}
function mason_cflags {
:
}
function mason_ldflags {
:
}
function mason_static_libs {
:
}