# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Laurent Carlier <lordheavym@gmail.com>

pkgname=libclc
pkgver=18.1.8
pkgrel=1
pkgdesc="Library requirements of the OpenCL C programming language"
arch=(any)
url="https://libclc.llvm.org/"
license=('MIT')
makedepends=('clang' 'llvm' 'cmake' 'ninja' 'python' 'spirv-llvm-translator')
_source_base=https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver
source=($_source_base/libclc-$pkgver.src.tar.xz{,.sig})
sha256sums=('905bd59e9f810d6bd0ae6874725a8f8a3c91cb416199c03f2b98b57437cfb32e'
            'SKIP')
validpgpkeys=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstellar@redhat.com>

prepare() {
  cd $pkgname-$pkgver.src
  mkdir build
}

build() {
  cd $pkgname-$pkgver.src/build

  cmake .. -G Ninja \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr
  ninja
}

package() {
  cd $pkgname-$pkgver.src/build

  DESTDIR="$pkgdir" ninja install
  install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

