summaryrefslogtreecommitdiff
path: root/devel/gcc-compat/MAKEPKG
blob: 4d0fcebbbe5a0e8a11271bd42bbb00dd68a01fd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/mkpkg
# description: GCC compatibility shims for pure LLVM/musl systems
name=gcc-compat
version=1.0.0
release=2
#depends=(llvm-toolchain)
depends=()
source=()

sha256sums=(
)

build() {
    mkdir -p $PKG/usr/lib
    mkdir -p $PKG/usr/bin

    # libgcc_s → libunwind
    ln -s libunwind.so.1 $PKG/usr/lib/libgcc_s.so.1
    printf 'INPUT(-lunwind)\n' > $PKG/usr/lib/libgcc_s.so

    # libgcc.a → compiler-rt builtins
    _builtins=$(clang --print-libgcc-file-name 2>/dev/null || true)
    if [ -n "$_builtins" ] && [ -f "$_builtins" ]; then
        printf 'INPUT(%s)\n' "$_builtins" > $PKG/usr/lib/libgcc.a
    else
        llvm-ar cr $PKG/usr/lib/libgcc.a
    fi

    # libstdc++ → libc++
    printf 'INPUT(-lc++)\n' > $PKG/usr/lib/libstdc++.so
    ln -s libc++.so.1 $PKG/usr/lib/libstdc++.so.6
    if [ -f /usr/lib/libc++.a ]; then
        printf 'INPUT(-lc++ -lc++abi)\n' > $PKG/usr/lib/libstdc++.a
    fi

    # rustc-wrapper — force dynamic linking on musl
    printf '#!/bin/sh\nexec /usr/bin/rustc -C target-feature=-crt-static "$@"\n' \
        > $PKG/usr/bin/rustc-wrapper
    chmod 755 $PKG/usr/bin/rustc-wrapper
}

signify() {
    untrusted comment: public key
    RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3
}

# vim: filetype=sh