# Maintainer: Your Name <your@email.com>
pkgname=xrt-base
pkgver=202610.2.21.0
pkgrel=1
pkgdesc="Xilinx RunTime - Base package"
arch=('x86_64')
url="https://github.com/Xilinx/XRT"
license=('Apache-2.0')
depends=('boost' 'libdrm' 'ocl-icd' 'protobuf' 'rapidjson' 'python')
provides=('xrt-base')
conflicts=('xrt-base')

# Set this to your XRT build directory (relative to PKGBUILD location)
: ${XRT_BUILD_DIR:="../Release"}

package() {
  cd "$srcdir"

  # Extract the tarball directly into the package directory
  # The tarball should be at $startdir/$XRT_BUILD_DIR/xrt_*--base.tar.gz
  local tarball=$(ls $startdir/${XRT_BUILD_DIR}/xrt_*--base.tar.gz 2>/dev/null | head -1)
  if [ -z "$tarball" ]; then
    error "XRT base tarball not found in ${XRT_BUILD_DIR}"
    error "Please build XRT first: cd .. && ./build.sh -npu -opt"
    return 1
  fi

  msg2 "Extracting $tarball"
  tar -xzf "$tarball" -C "$pkgdir"
}
