|
| 1 | +# Note that this script can accept some limited command-line arguments, run |
| 2 | +# `julia build_tarballs.jl --help` to see a usage message. |
| 3 | +using BinaryBuilder |
| 4 | + |
| 5 | +name = "LLVMCompilerRT" |
| 6 | +version = v"12.0.0" |
| 7 | + |
| 8 | +sources = [ |
| 9 | + ArchiveSource( |
| 10 | + "https://github.com/llvm/llvm-project/releases/download/llvmorg-$(version)/compiler-rt-$(version).src.tar.xz", |
| 11 | + "85a8cd0a62413eaa0457d8d02f8edac38c4dc0c96c00b09dc550260c23268434" |
| 12 | + ), |
| 13 | + DirectorySource("./bundled"), |
| 14 | +] |
| 15 | + |
| 16 | +# Bash recipe for building across all platforms |
| 17 | +script = raw""" |
| 18 | +cd $WORKSPACE/srcdir/compiler-rt*/ |
| 19 | +
|
| 20 | +# We'll codesign during audit |
| 21 | +atomic_patch -p1 ../patches/do-not-codesign.patch |
| 22 | +
|
| 23 | +FLAGS=() |
| 24 | +if [[ "${target}" == *-apple-* ]]; then |
| 25 | + # Fake `PlistBuddy` to make detection of aarch64 support work |
| 26 | + mkdir -p /usr/libexec |
| 27 | + cat > /usr/libexec/PlistBuddy << EOF |
| 28 | +#!/bin/bash |
| 29 | +
|
| 30 | +if [[ "${target}" == aarch64-* ]]; then |
| 31 | + echo " arm64" |
| 32 | +else |
| 33 | + echo " $(uname -m)" |
| 34 | +fi |
| 35 | +EOF |
| 36 | + chmod +x /usr/libexec/PlistBuddy |
| 37 | +
|
| 38 | + # We use could use `${MACOSX_DEPLOYMENT_TARGET}` to specify the SDK version, but it's |
| 39 | + # set to 10.10 on x86_64, but compiler-rt requires at least 10.12 and we actually use |
| 40 | + # 10.12. On aarch64 it's 11.0, but the CMake script doesn't seem to like values greater |
| 41 | + # than 10, so let's just use 10.12 everywhere. |
| 42 | + FLAGS+=( |
| 43 | + -DDARWIN_macosx_OVERRIDE_SDK_VERSION:STRING=10.12 |
| 44 | + -DDARWIN_macosx_CACHED_SYSROOT=/opt/${target}/${target}/sys-root |
| 45 | + ) |
| 46 | +fi |
| 47 | +
|
| 48 | +mkdir build && cd build |
| 49 | +cmake -DCMAKE_INSTALL_PREFIX=${prefix} \ |
| 50 | + -DCMAKE_TOOLCHAIN_FILE="${CMAKE_TARGET_TOOLCHAIN}" \ |
| 51 | + -DCMAKE_BUILD_TYPE=Release \ |
| 52 | + "${FLAGS[@]}" \ |
| 53 | + .. |
| 54 | +make -j${nproc} |
| 55 | +make install |
| 56 | +""" |
| 57 | + |
| 58 | +# These are the platforms we will build for by default, unless further |
| 59 | +# platforms are passed in on the command line |
| 60 | +platforms = supported_platforms() |
| 61 | +# Exclude failing platforms. This package is a stop-gap solution for being able to link |
| 62 | +# some packages on aarch64-apple-darwin, so there is little need to spend time on getting |
| 63 | +# this to build for _all_ platforms. The long-term plan is to have these libraries as part |
| 64 | +# of LLVMBootstrap: https://github.com/JuliaPackaging/Yggdrasil/pull/1681 |
| 65 | +filter!(p -> arch(p) != "powerpc64le" && !(BinaryBuilder.proc_family(p) == "intel" && libc(p) == "musl"), platforms) |
| 66 | + |
| 67 | +# The products that we will ensure are always built |
| 68 | +products = LibraryProduct[ |
| 69 | +] |
| 70 | + |
| 71 | +# Dependencies that must be installed before this package can be built |
| 72 | +dependencies = Dependency[ |
| 73 | +] |
| 74 | + |
| 75 | +# Build the tarballs, and possibly a `build.jl` as well. |
| 76 | +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version=v"8") |
0 commit comments