summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 43ba18baa7bd350991bf6e21595207d1c6dc51fc (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
# Maintainer: Max Mertens <max.mail@dameweb.de>

pkgbase=structstore
pkgname=(structstore structstore_py)
pkgver=0.2.2
pkgrel=1
pkgdesc='Structured object storage, dynamically typed, to be shared between processes'
arch=('x86_64')
url='https://github.com/mertemba/structstore'
license=('BSD-3-Clause')
depends=('glibc' 'gcc-libs' 'yaml-cpp')
makedepends=('cmake' 'ninja' 'gcc' 'yaml-cpp' 'python' 'python-pip')
source=("git+https://github.com/mertemba/structstore.git")
sha256sums=('SKIP')
options=(!debug)

pkgver() {
    cd "$pkgbase"
    # cutting off 'v' prefix that presents in the git tag
    git describe --long --tags --abbrev=7 --always | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
    cd "${srcdir}/${pkgbase}"
    venvdir="${srcdir}/venv"
    python -m venv "${venvdir}"
    source "${venvdir}/bin/activate"
    pip install -r requirements.txt
    cmake -B build -S "." \
        -G Ninja \
        -DBUILD_WITH_PYTHON=ON \
        -DCMAKE_BUILD_TYPE:STRING='None' \
        -DCMAKE_INSTALL_PREFIX:PATH='/usr' \
        -Wno-dev
    cmake --build build
}

check() {
    # ctest --test-dir build --output-on-failure
    true
}

package_structstore() {
    provides+=('libstructstore.so')

    cd "${srcdir}/${pkgbase}"
    venvdir="${srcdir}/venv"
    source "${venvdir}/bin/activate"
    DESTDIR="$pkgdir" cmake --install build

    # keep only non-Python files
    find "$pkgdir" -type f | sed "s@$pkgdir@@" | grep -i py \
        | while IFS='' read f; do rm "$pkgdir/$f"; done
    find "$pkgdir" -type d -empty -delete
}

package_structstore_py() {
    depends+=('python' 'structstore')

    cd "${srcdir}/${pkgbase}"
    venvdir="${srcdir}/venv"
    source "${venvdir}/bin/activate"
    DESTDIR="$pkgdir" cmake --install build

    # keep only Python files
    find "$pkgdir" -type f | sed "s@$pkgdir@@" | grep -i -v py \
        | while IFS='' read f; do rm "$pkgdir/$f"; done
    find "$pkgdir" -type d -empty -delete
}