File PKGBUILD of Package knot-resolver

# Maintainer:	Knot Resolver team <knot-resolver@labs.nic.cz>
# Maintainer:	Vladimír Čunát <vladimir.cunat@nic.cz>
# Contributor:	Nicki Křížek <nicki@isc.org>
# Contributor:	Ondřej Surý <ondrej@sury.org>
# Contributor:	Oto Šťáva <oto.stava@gmail.com>
# SPDX-License-Identifier: GPL-3.0-or-later

pkgname=knot-resolver
pkgver=6.0.8.dev45+900c01
pkgrel=1
pkgdesc='Caching DNSSEC-validating DNS resolver'
arch=('x86_64' 'armv7h')
url='https://www.knot-resolver.cz/'
license=('GPL3')
depends=(
    'dnssec-anchors'
    'gnutls'
    'knot'
    'libuv'
    'lmdb'
    'luajit'
    'systemd'
    'libcap-ng'
    'libnghttp2'
    'jemalloc'
    'python'
    'python-yaml'
    'python-aiohttp'
    'python-typing_extensions'
    'python-jinja'
    'supervisor'
)
makedepends=(
    'cmocka'
    'meson'
    'pkgconfig'
    'python-build'
    'python-installer'
    'python-poetry'
    'python-wheel'
    'systemd-libs'
)
optdepends=(
    'lua51-basexx: experimental_dot_auth module'
    'lua51-cqueues: http and dns64 module, policy.rpz() function'
    'lua51-http: http and prefill modules, trust_anchors bootstrap'
    'lua51-psl: policy.slice_randomize_psl() function'
    'python-prometheus_client: stats and metrics in Prometheus format'
)
backup=('etc/knot-resolver/config.yaml')
options=(debug strip)
source=("knot-resolver_${pkgver}.orig.tar.xz")
sha256sums=('SKIP')

build() {
    cd "${srcdir}/${pkgname}-${pkgver}"
    meson setup build \
        --buildtype=release \
        --prefix=/usr \
        --sbindir=bin \
        -D keyfile_default=/etc/trusted-key.key \
        -D systemd_files=enabled \
        -D malloc=jemalloc \
        -D unit_tests=enabled
    ninja -C build
    pushd build/python
    python -Pm build --wheel --no-isolation
    popd
    pushd manager
    python -Pm build --wheel --no-isolation
    popd
}

check() {
    cd "${srcdir}/${pkgname}-${pkgver}"
    meson test -C build
}

package() {
    cd "${srcdir}/${pkgname}-${pkgver}"
    DESTDIR=${pkgdir} ninja -C build install

    # add knot-resolver.service to multi-user.target.wants to support enabling the service
    install -d -m 0755 "${pkgdir}/usr/lib/systemd/system/multi-user.target.wants"
    ln -s ../knot-resolver.service ${pkgdir}/usr/lib/systemd/system/multi-user.target.wants/knot-resolver.service

    # remove modules with missing dependencies
    rm "${pkgdir}/usr/lib/knot-resolver/kres_modules/etcd.lua"

    # install knot-resolver metadata Python module
    pushd build/python
    python -Pm installer --destdir="$pkgdir" dist/*.whl
    popd

    # install knot-resolver-manager
    pushd manager
    python -Pm installer --destdir="$pkgdir" dist/*.whl
    install -m 644 -D etc/knot-resolver/config.yaml ${pkgdir}/etc/knot-resolver/config.yaml
    install -m 644 -D shell-completion/client.bash ${pkgdir}/usr/share/bash-completion/completions/kresctl
    install -m 644 -D shell-completion/client.fish ${pkgdir}/usr/share/fish/completions/kresctl.fish
    popd

}
openSUSE Build Service is sponsored by