#!/usr/bin/env modbuild


pbuild::prep() { :; }

pbuild::configure() { :; }

pbuild::compile() { :; }

pbuild::install() {
    # Release tag on gitea.psi.ch/mx/Jungfraujoch matches the module version,
    # so the tarball is fetched per-version instead of shipped in the buildblock.
    # https://gitea.psi.ch/mx/Jungfraujoch/releases/download/1.0.0-rc.164/rugnux-1.0.0-rc.164-linux-x86_64-cuda12.tgz
    local -r tarball="rugnux-${V}-linux-x86_64-cuda12.tgz"
    mkdir -p "${PREFIX}/bin"
    cd "${PREFIX}/bin"
    curl -fLO "https://gitea.psi.ch/mx/Jungfraujoch/releases/download/${V}/${tarball}"
    curl -fLO "https://gitea.psi.ch/mx/Jungfraujoch/releases/download/${V}/${tarball}"
    tar -xzf "${tarball}" --strip-components=1
    rm "${tarball}"
}
