Lines Matching +full:libcxx +full:- +full:build

2 # ===----------------------------------------------------------------------===##
6 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 # ===----------------------------------------------------------------------===##
10 set -e
21 [-h|--help] Display this help and exit.
23 --llvm-root <DIR> Path to the root of the LLVM monorepo. Only the libcxx
26 --build-dir <DIR> Path to the directory to use for building. This will
27 contain intermediate build products.
29 --install-dir <DIR> Path to the directory to install the library to.
31 --symbols-dir <DIR> Path to the directory to install the .dSYM bundle to.
33 --architectures "<arch>..." A whitespace separated list of architectures to build for.
38 --headers-only Only install the header part of the library -- don't actually
39 build the full library.
41 --version X[.Y[.Z]] The version of the library to encode in the dylib.
45 while [[ $# -gt 0 ]]; do
47 -h|--help)
51 --llvm-root)
55 --build-dir)
59 --symbols-dir)
63 --install-dir)
67 --architectures)
71 --headers-only)
75 --version)
86 if [ -z ${!arg+x} ]; then
87 error "Missing required argument '--${arg//_/-}'"
89 error "Argument to --${arg//_/-} must not be empty"
103 separator="$(printf "%0.s-" $(seq 1 ${#1}))"
111 # Construct the target-triple that we're testing for. Otherwise, the target triple is currently detected
112 # as <arch>-apple-darwin<version> instead of <arch>-apple-macosx<version>, which trips up the test suite.
113 # TODO: This shouldn't be necessary anymore if `clang -print-target-triple` behaved properly, see https://llvm.org/PR61762.
115 target=$(xcrun clang -arch ${arch} -xc - -### 2>&1 | grep --only-matching -E '"-triple" ".+?"' | grep --only-matching -E '"[^ ]+-apple-[^ ]+?"' | tr -d '"')
117 mkdir -p "${build_dir}/${arch}"
120 shims_library="${build_dir}/${arch}/apple-system-shims.a"
121 # Note that this doesn't need to match the Standard version used to build the rest of the library.
122 xcrun clang++ -c -std=c++2b -target ${target} "${llvm_root}/libcxxabi/src/vendor/apple/shims.cpp" -static -o "${shims_library}"
125 xcrun cmake -S "${llvm_root}/runtimes" \
126 -B "${build_dir}/${arch}" \
127 -GNinja \
128 -DCMAKE_MAKE_PROGRAM="$(xcrun --find ninja)" \
129 -C "${llvm_root}/libcxx/cmake/caches/Apple.cmake" \
130 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
131 -DCMAKE_INSTALL_PREFIX="${build_dir}/${arch}-install" \
132 -DCMAKE_OSX_ARCHITECTURES="${arch}" \
133 -DLIBCXXABI_LIBRARY_VERSION="${version}" \
134 -DLIBCXX_LIBRARY_VERSION="${version}" \
135 -DLIBCXX_TEST_PARAMS="target_triple=${target};apple_system_shims=${shims_library}" \
136 -DLIBCXXABI_TEST_PARAMS="target_triple=${target};apple_system_shims=${shims_library}" \
137 -DLIBUNWIND_TEST_PARAMS="target_triple=${target};apple_system_shims=${shims_library}"
140 xcrun cmake --build "${build_dir}/${arch}" --target install-cxx-headers install-cxxabi-headers -- -v
142 xcrun cmake --build "${build_dir}/${arch}" --target install-cxx install-cxxabi -- -v
149 inputs=$(for arch in ${architectures}; do echo "${build_dir}/${arch}-install/lib/${dylib}"; done)
152 xcrun lipo -create ${inputs} -output "${build_dir}/${dylib}"
155 mkdir -p "${install_dir}/usr/lib"
157 xcrun strip -S "${install_dir}/usr/lib/${dylib}"
160 xcrun dsymutil "${build_dir}/${dylib}" -o "${symbols_dir}/${dylib}.dSYM"
167 (cd "${install_dir}/usr/lib" && ln -s "libc++.1.dylib" libc++.dylib)
169 experimental_libs=$(for arch in ${architectures}; do echo "${build_dir}/${arch}-install/lib/libc++experimental.a"; done)
170 xcrun lipo -create ${experimental_libs} -output "${install_dir}/usr/lib/libc++experimental.a"
176 any_arch=$(echo ${architectures} | cut -d ' ' -f 1)
177 mkdir -p "${install_dir}/usr/include"
178 ditto "${build_dir}/${any_arch}-install/include" "${install_dir}/usr/include"
179 if [[ $EUID -eq 0 ]]; then # Only chown if we're running as root
180 chown -R root:wheel "${install_dir}/usr/include"
185 mkdir -p "${install_dir}/usr/local/OpenSourceLicenses"
186 cp "${llvm_root}/libcxx/LICENSE.TXT" "${install_dir}/usr/local/OpenSourceLicenses/libcxx.txt"
190 libcxx_archives=$(for arch in ${architectures}; do echo "${build_dir}/${arch}-install/lib/libc++.a"; done)
191 libcxxabi_archives=$(for arch in ${architectures}; do echo "${build_dir}/${arch}-install/lib/libc++abi.a"; done)
193 mkdir -p "${install_dir}/usr/local/lib/libcxx"
194 xcrun libtool -static ${libcxx_archives} -o "${install_dir}/usr/local/lib/libcxx/libc++-static.a"
195 xcrun libtool -static ${libcxxabi_archives} -o "${install_dir}/usr/local/lib/libcxx/libc++abi-static.a"