Skip to content

Instantly share code, notes, and snippets.

@rigred
Created August 20, 2019 09:27
Show Gist options
  • Save rigred/e1733744168f7547c4be0354ff99f66e to your computer and use it in GitHub Desktop.
Save rigred/e1733744168f7547c4be0354ff99f66e to your computer and use it in GitHub Desktop.
PKGBUILD for ROCm hcc - should be easily updateable with just a pkgver increment and updpkgsums
# Submitter: Olaf Leidinger <[email protected]>
# Maintainer: Jakub Okoński <[email protected]>
# Maintainer: Rigo Reddig <[email protected]> ;)
pkgname=hcc
pkgver=2.7.0
pkgrel=1
pkgdesc="HCC is an Open Source, Optimizing C++ Compiler for Heterogeneous Compute"
arch=('x86_64')
url="https://github.com/RadeonOpenCompute/hcc"
license=('NCSAOSL')
depends=(rocr-runtime z3)
makedepends=(git cmake gcc ninja z3)
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
options=(!staticlibs strip)
source=(
"hcc-$pkgver.tar.gz::https://github.com/RadeonOpenCompute/hcc/archive/roc-hcc-$pkgver.tar.gz"
"llvm-$pkgver.tar.gz::https://github.com/RadeonOpenCompute/llvm/archive/roc-ocl-$pkgver.tar.gz"
"compiler-rt-$pkgver.tar.gz::https://github.com/RadeonOpenCompute/compiler-rt/archive/roc-hcc-$pkgver.tar.gz"
"hcc-clan-upgrade-$pkgver.tar.gz::https://github.com/RadeonOpenCompute/hcc-clang-upgrade/archive/roc-hcc-$pkgver.tar.gz"
"clang-tools-extra-$pkgver.tar.gz::https://github.com/RadeonOpenCompute/clang-tools-extra/archive/roc-hcc-$pkgver.tar.gz"
"lld-$pkgver.tar.gz::https://github.com/RadeonOpenCompute/lld/archive/roc-ocl-$pkgver.tar.gz"
"ROCm-Device-Libs-$pkgver.tar.gz::https://github.com/RadeonOpenCompute/ROCm-Device-Libs/archive/roc-ocl-$pkgver.tar.gz"
)
sha256sums=('b7067eba8cc3c4859bfa59f72afbd5c34c1d5183a0799876017b3c6a5aa994bd'
'1ed635c23a5e7e64f9b2a299caee658991dde5f2fbc4291e3a53336f340aff68'
'e4efc373633cbe7a43f1706d518faf22385cdd9589525e8e30ada4b489d5d5c3'
'1f5154350f3988b80fc9d0fa76c4ab930e4390f8fa35eee9adcb3d388961f4ca'
'7731bdd28a5fbf1753af76e1ccd0c8dd0d63228a04a3e0323e34e73d8a3fe42e'
'e1a686e50833b42ab65016a2015d93a3ffb279991aa7c935f79f05884edbdd94'
'fd55cd5f9f5caa358dbfb660a2d68b4b5964f35be0b36914ab2895a6b2c9b533')
prepare() {
cd "$srcdir"
mv -T llvm-roc-ocl-$pkgver hcc-roc-hcc-$pkgver/compiler
mv -T compiler-rt-roc-hcc-$pkgver hcc-roc-hcc-$pkgver/compiler-rt
mv -T hcc-clang-upgrade-roc-hcc-$pkgver hcc-roc-hcc-$pkgver/clang
mv -T clang-tools-extra-roc-hcc-$pkgver hcc-roc-hcc-$pkgver/clang-tools-extra
mv -T lld-roc-ocl-$pkgver hcc-roc-hcc-$pkgver/lld
mv -T ROCm-Device-Libs-roc-ocl-$pkgver hcc-roc-hcc-$pkgver/rocdl
}
build() {
mkdir -p "$srcdir/build"
cd "$srcdir/build"
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$pkgdir/opt/rocm/hcc" \
-G Ninja \
"$srcdir/hcc-roc-hcc-$pkgver"
ninja
}
package() {
ninja -C "$srcdir/build" install
# add links
mkdir -p "$pkgdir/usr/bin"
for fn in hcc hcc-config
do
ln -s /opt/rocm/hcc/bin/$fn "$pkgdir/usr/bin/$fn"
done
# additional link to make hcc demos happy
mkdir -p "$pkgdir/opt/rocm/include"
ln -s /opt/rocm/hcc/include "$pkgdir/opt/rocm/include/hcc"
# additional link to make clang-ocl work
ln -s /opt/rocm/hcc/bin "$pkgdir/opt/rocm/hcc/bin/x86_64"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment