aboutsummaryrefslogblamecommitdiffstats
path: root/community/dnsdist/APKBUILD
blob: 6ac1d283d41317a0f50a35c3cfae0e20cea509f9 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                          
             
                 
              
        

                                                                       
          
                      

                                          
                        



























                                                                                                                    
                         




                                                                    





                                                                               





                                         




                                       
                                

















                                               





                                                                                                  

                      
                                                      




                                          
                                                      































                                                                               
                                                                                                                                                                    
# Contributor: Vince Mele <vmele@inoc.com>
# Maintainer:
pkgname="dnsdist"
pkgver="1.3.3"
pkgrel=7
pkgdesc="dnsdist is a highly DNS-, DoS-, and abuse-aware loadbalancer."
url="https://dnsdist.org"
arch="all"
license="GPL-2.0-only"
_lua_version="5.1"
depends="$pkgname-common !$pkgname-luajit"
checkdepends="findutils"
makedepends="boost-dev fstrm-dev libedit-dev libsodium-dev lua${_lua_version}-dev net-snmp-dev protobuf-dev re2-dev"
pkgusers="dnsdist"
pkggroups="dnsdist"
install="$pkgname-common.pre-install"
subpackages="$pkgname-common::noarch $pkgname-doc"
source="https://downloads.powerdns.com/releases/$pkgname-$pkgver.tar.bz2"
builddir="$srcdir/$pkgname-$pkgver"

# luajit is not available for s390x
case "$CARCH" in
	s390x) ;;
	*)
		makedepends="$makedepends luajit-dev"
		subpackages="$subpackages $pkgname-luajit"
		;;
esac

prepare() {
	default_prepare

	case "$subpackages" in
		*-luajit*) cp -a "$builddir" "$builddir-jit";;
	esac
}

_configure() {
	local _arg="$1"
	local _luajit
	local _unit_tests

	[ "$_arg" = '-jit' ] || _arg='' _luajit="lua${_lua_version}"

	cd "$builddir$_arg"

	# builds are timing out on armhf
	_unit_tests='--enable-unit-tests'
	case "${DRONE_REPO_OWNER}-${DRONE_RUNNER_PLATFORM}-${CARCH}" in
		alpinelinux-linux/arm-armhf) _unit_tests="${_unit_tests}=no" ;;
	esac

	./configure \
		--build="$CBUILD" \
		--host="$CHOST" \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--enable-dnscrypt \
		--enable-dns-over-tls \
		--enable-fstrm \
		--enable-libsodium \
		--enable-re2 \
		${_unit_tests} \
		--with-protobuf \
		--with-boost=/usr/include \
		--with-net-snmp \
		--with-lua${_luajit:+=$_luajit}
}

build() {
	cd "$builddir"

	_configure
	make

	[ -d "$builddir-jit" ] || return 0

	_configure -jit
	make
}

_cat_found_file() {
	local _rc="$?"
	find -name "$1" -type f -ls -printf '%P {{{\n' -exec cat -v -n '{}' ';' -printf '}}} %P\n'
	return "$_rc"
}

check() {
	cd "$builddir"
	make check || _cat_found_file 'test-suite.log'
	./dnsdist --version

	[ -d "$builddir-jit" ] || return 0

	cd "$builddir-jit"
	make check || _cat_found_file 'test-suite.log'
	./dnsdist --version
}

package() {
	cd "$builddir"
	make -j1 DESTDIR="$pkgdir" install

	mv "$pkgdir/usr/bin/$pkgname" "$pkgdir/usr/bin/$pkgname-lua"

	if cd "$builddir-jit"; then
		make -j1 DESTDIR="$pkgdir" install-exec
		mv "$pkgdir/usr/bin/$pkgname" "$pkgdir/usr/bin/$pkgname-luajit"
	fi

	mv "$pkgdir/usr/bin/$pkgname-lua" "$pkgdir/usr/bin/$pkgname"
}

common() {
	pkgdesc="$pkgname common files"
	depends=""

	mkdir -p "$subpkgdir"
}

luajit() {
	pkgdesc="$pkgname with luajit bindings"
	depends="$pkgname-common !$pkgname"

	mkdir -p "$subpkgdir/usr/bin"
	mv "$pkgdir/usr/bin/$pkgname-luajit" "$subpkgdir/usr/bin/$pkgname"
}

sha512sums="c0e3435eafc1f7bcdf41346cecf7b089cc142716f94058f9ec262d0c6ad16467e0b8bed5abc648829c597120c94f998602849ded574e75bfc1a1fb70c1b719ad  dnsdist-1.3.3.tar.bz2"