summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 22cb0c48cd86de2de3b83f4da395294693154354 (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
# Contributor: Luis Sarmiento < Luis.Sarmiento-ala-nuclear.lu.se >
pkgname=mcnptools
pkgver=5.3.1
pkgrel=1
tag=v${pkgver}
pkgdesc="Several utility programs to perform common tasks when interacting with the MCNP® code"
url="https://github.com/lanl/mcnptools"
license=('BSD-3')
arch=('x86_64')
makedepends=('git' 'cmake')
depends=('hdf5' 'python')
source=($pkgname::git+https://github.com/lanl/mcnptools.git)
sha256sums=('SKIP')

prepare(){
    cd ${srcdir}/${pkgname}
    msg "Verify whether we are already at the wanted tag"
    if git rev-parse "${pkgname}-${tag}" >/dev/null 2>&1; then
        msg " => tag exists";
        msg "git checkout ${pkgname}-${tag}"
        git checkout ${pkgname}-${tag}
    else
        msg " => tag does not exist"
        msg "git checkout main"
        git checkout main
        msg "git fetch origin"
        git fetch origin
        msg "git checkout ${tag}"
        git checkout ${tag}
    fi
}

build() {
    rm -rf ${srcdir}/build
    mkdir ${srcdir}/build
    cd ${srcdir}/build
    cmake -D CMAKE_INSTALL_PREFIX=/usr \
          -D mcnptools.python_install=User \
          ../${pkgname}
    cmake --build . --config Release
}

check(){
    cd ${srcdir}/build
    ctest --build-config Release
}

package() {
    cd ${srcdir}/build
    DESTDIR="$pkgdir" cmake --install . --config Release
}