1 # Maintainer: Frederik Schwan <freswa at archlinux dot org>
3 pkgname=wasi-compiler-rt
6 pkgdesc='WASI LLVM compiler runtime'
8 url='https://compiler-rt.llvm.org/'
9 license=('custom:Apache 2.0 with LLVM Exception')
11 makedepends=('cmake' 'ninja' 'llvm' 'clang' 'lld')
12 source=(https://github.com/llvm/llvm-project/releases/download/llvmorg-${pkgver}/compiler-rt-${pkgver}.src.tar.xz{,.sig}
13 https://github.com/llvm/llvm-project/releases/download/llvmorg-${pkgver}/cmake-$pkgver.src.tar.xz{,.sig}
16 b2sums=('33ca4fa481f713c1c6830db0145faef3790d7450c582cca3a7afb35b2a287955d650aaad8f4c795720706a3f1e39a50b377c09eba3087bc7cd278784ab43239a'
18 'a8baee6eb1e0447d3733337c28f7903f2112a2bc1c954afcb533a0de537295308b467fa3b497f9904a398fc992ba1aa27c62788530bba251977d9925ae380f6d'
20 'c829d807c257921fddb8c4d3752ad2291a2beb116d414dd31e34b7f6b01599d8c4807db87ef9930456ed8c9f30e8648e77028fa0b903c3a5ea840514f6022cf4'
21 '74c63bb838bc2e6d7980370fb3d47f8fd2f1dd8b6dc82302c7cc0b80e0fb1e8e21c1c62d6de0b78e478fc22611a5867e52b1ef7a566796fe831fffd98b17c940')
22 options=('staticlibs')
24 '474E22316ABF4785A88C6E8EA2C794A986419D8A' # Tom Stellard <tstellar@redhat.com>
25 'D574BD5D1D0E98895E3BF90044F2485E45D59042' # Tobias Hieta <tobias@hieta.se>
29 # Platform files have been copied from here https://github.com/WebAssembly/wasi-sdk
30 mv cmake{-$pkgver.src,}
31 mkdir -p cmake/Platform
32 cp WASI.cmake cmake/Platform
36 # Build options are derived from here https://github.com/WebAssembly/wasi-sdk/blob/main/Makefile
38 # Currently, wasi-sdk requires C++ code be compiled with -fno-exceptions. libc++abi is compiled, however is is currently compiled with exception-handling support disabled.
39 # https://github.com/WebAssembly/wasi-sdk/issues/52#issuecomment-530619365
40 cmake -B build -G Ninja \
41 -DCMAKE_BUILD_TYPE=Release \
42 -DCMAKE_C_COMPILER_WORKS=ON \
43 -DCMAKE_CXX_COMPILER_WORKS=ON \
44 -DCMAKE_MODULE_PATH="${srcdir}"/make \
45 -DCMAKE_TOOLCHAIN_FILE="${srcdir}"/wasi-toolchain.cmake \
46 -DCOMPILER_RT_BAREMETAL_BUILD=On \
47 -DCOMPILER_RT_INCLUDE_TESTS=OFF \
48 -DCOMPILER_RT_HAS_FPIC_FLAG=OFF \
49 -DCOMPILER_RT_DEFAULT_TARGET_ONLY=On \
50 -DCOMPILER_RT_OS_DIR=wasi \
51 -DWASI_SDK_PREFIX=/usr \
52 -DCMAKE_C_FLAGS="-fno-exceptions --sysroot=/usr/share/wasi-sysroot" \
53 -DCMAKE_INSTALL_PREFIX=/usr/lib/clang/${pkgver}/ \
54 compiler-rt-${pkgver}.src/lib/builtins
55 cmake --build build -v
59 DESTDIR="${pkgdir}" cmake --install build -v
61 install -Dm644 compiler-rt-${pkgver}.src/LICENSE.TXT "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE