summaryrefslogtreecommitdiff
path: root/libs/rocm-rocr-runtime/MAKEPKG
blob: 7615891787323e1b436ccdfc60b7f111749f9863 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/mkpkg
# description: AMD ROCm HSA Runtime (ROCr)
# url: https://github.com/ROCm/ROCR-Runtime

name=rocm-rocr-runtime
_name=therock
version=10.0
release=1
depends=(libdrm libelf numactl)
makedeps=(cmake ninja rocm-llvm)
source=(
    https://github.com/ROCm/rocm-systems/releases/download/$_name-$version/rocr-runtime.tar.gz
    fix-hsa-signal-less.awk
    fix-executable-null.awk
)
renames=($name-$version.tar.gz
    ""
    ""
)

sha256sums=(
    "007bba7a393abf5bb41fd191033e015eba2fffa6fdb605e1ed4e488742752ca5"
    "b6f63254560b1cfcbeced1764bb522767fc5eefa88bb4e7938d1b894736bbddb"
    "d4e2fe154741800dbf0a1b65e7ddbd7c6f9a6787bd53892e0f34d7d1ab0080f1"
)

patch() {
    cd rocr-runtime

    # Add operator< to hsa_signal_t for libc++ 22 std::map compatibility
    awk -f "$SRC/fix-hsa-signal-less.awk" \
        runtime/hsa-runtime/inc/hsa.h > hsa.h.tmp
    mv hsa.h.tmp runtime/hsa-runtime/inc/hsa.h

    # Fix NULL return where uint64_t expected (musl defines NULL as nullptr)
    awk -f "$SRC/fix-executable-null.awk" \
        runtime/hsa-runtime/loader/executable.cpp > executable.cpp.tmp
    mv executable.cpp.tmp runtime/hsa-runtime/loader/executable.cpp

}

build() {
    cd rocr-runtime

    cmake -B build -G Ninja -Wno-dev \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_INSTALL_LIBDIR=lib \
        -DCMAKE_C_COMPILER=/usr/lib/rocm/llvm/bin/clang \
        -DCMAKE_CXX_COMPILER=/usr/lib/rocm/llvm/bin/clang++ \
        -DCMAKE_PREFIX_PATH="/usr;/usr/lib/rocm/llvm" \
        -DClang_DIR=/usr/lib/rocm/llvm/lib/cmake/clang \
        -DBUILD_SHARED_LIBS=ON \
        -DIMAGE_SUPPORT=ON \
        -DBUILD_ROCR=ON \
        -DBUILD_TESTS=OFF \
        -DROCM_PATCH_VERSION=0

    ninja -C build
    DESTDIR=$PKG ninja -C build install
}

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

# vim: filetype=sh