summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 02c9261d2b8de76a61cfcb2dfec5a4e356437815 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Maintainer: George Tsiamasiotis <george+aur@tsiamasiotis.gr>

pkgname=(dnst-git dnst-ldns-git)
_pkgname=dnst
pkgver=git
pkgrel=1
pkgdesc='A DNS administration toolbox'
arch=('x86_64')
url='https://github.com/NLnetLabs/dnst'
license=(BSD-3-Clause)

provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")

depends=(
    openssl
    glibc
    gcc-libs
)
makedepends=(
    git

    cargo

    python-toml
    python-sphinx
    python-sphinx_rtd_theme
    python-sphinx-tabs
    python-sphinx-copybutton
    python-sphinx-notfound-page
)

options=(!lto)
source=("git+https://github.com/NLnetLabs/dnst.git")
sha256sums=('SKIP')

export RUSTUP_TOOLCHAIN="stable"
export CARGO_TARGET_DIR="target"
export CARGO_BUILD_TARGET="$CARCH-unknown-linux-gnu"

pkgver() {
    cd "$_pkgname"
    git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'
}

prepare() {
    cd "$_pkgname"
    cargo fetch --locked
}

build() {
    cd "$_pkgname"
    make -C doc/manual man
    cargo build --frozen --release --bin dnst
}

check() {
    cd "$_pkgname"
    cargo test
}

package_dnst-git() {
    cd "$_pkgname"

    # Install the final binary into `/usr/bin`.
    install -Dm0755 "target/$CARGO_BUILD_TARGET/release/dnst" -t "$pkgdir/usr/bin/"

    # Install man (1) pages for dnst.
    for page in doc/manual/build/man/dnst*.1
    do
        install -Dm0644 -t "$pkgdir/usr/share/man/man1" $page
    done

    # Install the license file (this is required for BSD-3-Clause).
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/dnst/LICENSE"
}

package_dnst-ldns-git() {
    cd "$_pkgname"

    pkgdesc='dnst re-implementation of important ldns programs'
    depends=(dnst)
    provides=(ldns)
    conflicts=(ldns)

    # Install compatibility symlinks.
    install -dm0755 "$pkgdir/usr/bin"
    for cmd in key2ds notify keygen nsec3-hash signzone update
    do
        ln -s dnst "$pkgdir/usr/bin/ldns-$cmd"
    done

    # Install man (1) pages for dnst ldns wrappers.
    for page in doc/manual/build/man/ldns*.1
    do
        install -Dm0644 -t "$pkgdir/usr/share/man/man1" $page
    done
}