aboutsummaryrefslogtreecommitdiffstats
path: root/testing/libcypher-parser/APKBUILD
blob: ba7893eb9eaa0fc7f53f7fa1368916c4201a59fa (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
# Contributor: Chris Leishman <chris@leishman.org>
# Maintainer: Chris Leishman <chris@leishman.org>
pkgname=libcypher-parser
pkgver=0.6.0
pkgrel=0
pkgdesc="Parsing library for the Cypher query language"
url="https://github.com/cleishm/libcypher-parser"
arch="all"
license="Apache-2.0"
depends=""
depends_dev=""
makedepends="$depends_dev automake autoconf libtool check-dev doxygen pkgconfig"
install=""
subpackages="$pkgname-dev $pkgname-doc::noarch cypher-lint cypher-lint-doc::noarch"
source="https://github.com/cleishm/libcypher-parser/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz"

builddir="$srcdir"/"$pkgname-$pkgver"
build() {
    cd "$builddir"
    ./configure \
            --prefix=/usr
    make
    make doc
}

check() {
    cd "$builddir"
    make check
}

package() {
    cd "$builddir"
    make DESTDIR="$pkgdir" install
    mkdir -p "$pkgdir"/usr/share/doc/libcypher-parser
    mv doc/html/* "$pkgdir"/usr/share/doc/libcypher-parser/
}

doc() {
    depends="$depends_doc"
    pkgdesc="$pkgdesc (documentation)"
    install_if="docs $pkgname=$pkgver-r$pkgrel"

    if [ "$subpkgname" = "libcypher-parser-doc" ]; then
        mkdir -p "$subpkgdir"/usr/share
        mv "$pkgdir"/usr/share/doc "$subpkgdir"/usr/share/
    elif [ "$subpkgname" = "cypher-lint-doc" ]; then
        mkdir -p "$subpkgdir"/usr/share
        mv "$pkgdir"/usr/share/man "$subpkgdir"/usr/share/
        find "$subpkgdir"/usr/share/man/ -type f | xargs gzip -9
    else
        die "Unknown doc package $pkgname"
    fi

    # remove if empty, ignore error (not empty)
    rmdir "$pkgdir"/usr/share "$pkgdir"/usr || true 2>/dev/null
    return 0
}

lint() {
    pkgdesc="Lint tool for the Cypher query language"

    mkdir -p "$subpkgdir"/usr
    mv "$pkgdir"/usr/bin "$subpkgdir"/usr/

    # remove if empty, ignore error (not empty)
    rmdir "$pkgdir"/usr/bin "$pkgdir"/usr || true 2>/dev/null
    return 0
}

sha512sums="5faabbfe09a98ad5805a533dfdf1ba3e3357d4320a274242472ef27fc3696d48a4b0bad1606ab6092aae111fc1d7f7c9c3fa875433d6c94bc1e03f2428ca889e  libcypher-parser-0.6.0.tar.gz"