summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: dd6cc0b37fee6da4cbb19643a95c8b32c0de5494 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Maintainer: Camille 'DrasLorus' Monière <draslorus@draslorus.fr>

pkgname=libmatio-cpp
pkgver=0.2.1
pkgrel=2
pkgdesc="A C++ wrapper of the matio library, with memory ownership handling."
arch=('x86_64')
url="https://github.com/ami-iit/matio-cpp"
license=('BSD')
groups=()
depends=('libmatio')
makedepends=('cmake')
checkdepends=('catch2>3.0.0')
provides=("$pkgname" "visit_struct")
conflicts=("$pkgname-git")
replaces=()
backup=()
options=()
install=
source=("libmatio-cpp-${pkgver}.tar.gz::https://github.com/ami-iit/matio-cpp/archive/v${pkgver}.tar.gz"
    "visit_struct.zip::https://github.com/ami-iit/visit_struct/archive/969fc563477906432a9fcc91addf2c1e13c56f4c.zip")
noextract=()
sha256sums=('a9144816e79f517b52593d2d934d6e727ff136495fee3b37d3eb6ebaf892b355'
            '3df656403aa1e2969a4c7b8606002014adcfb21123cca209e58c18f3e35d3422')

prepare() {
    cd "$srcdir"
    mv matio-cpp-"$pkgver" "$pkgname-$pkgver"
    mv visit_struct-969fc563477906432a9fcc91addf2c1e13c56f4c visit_struct
}

# Needed since Arch currently ship catch2 v2, catch2 v3 is only provided by catch2-git on the AUR
_enable_check() {
    _catch2_ver=$(pacman -Q catch2 | cut -d ' ' -f 2)
    printf -v versions "%s\n%s" "$_catch2_ver" "3.0.0"
    if [[ $versions = "$(sort -V <<< "$versions")" ]]; then
        echo OFF
    else
        echo ON
    fi
}

build() {
    cd "$srcdir/visit_struct"
    cmake -B build -S . -DCMAKE_BUILD_TYPE=None \
        -Wno-dev \
        -DCMAKE_INSTALL_PREFIX="$srcdir/.local/usr"
    cmake --build build -j
    cmake --build build -t install 
    
    cd "$srcdir/$pkgname-$pkgver"

    cmake -B build -S . -DCMAKE_BUILD_TYPE=None \
                -Wno-dev \
                -DCMAKE_GENERATOR="Unix Makefiles" \
                -DCMAKE_PREFIX_PATH="$srcdir/.local/usr" \
                -DCMAKE_INSTALL_PREFIX=/usr \
                -DBUILD_TESTING=$(_enable_check)
    cmake --build build -j
}

check() {
    cd "$pkgname-$pkgver/build"
    ctest
}

package() {
    cd "$srcdir/visit_struct/build"
    cmake .. -DCMAKE_INSTALL_PREFIX="/usr"
    make && make DESTDIR="$pkgdir/" install
    install -Dm644 "$srcdir/visit_struct/LICENSE" "$pkgdir/usr/share/licenses/visit_struct/LICENSE"
    cd "$srcdir/$pkgname-$pkgver/build"
    make DESTDIR="$pkgdir/" install
    install -Dm644 "$srcdir/$pkgname-$pkgver/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}