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


                                     
                                                  

                                                                       
 
                                                                      
                                                            


                       

                                                                         
                                         





                       
                                                                  


                           



                                                                               




                                         

                                       
                                         
                                     
                            






                                               








                                          

                      
                                                                                                    


                     
         
                                                      

                           



                                                              


           
                                      

























                                                                               

                                                                                                                                                                        
# Contributor: Vince Mele <vmele@inoc.com>
# Maintainer:
pkgname=dnsdist
pkgver=1.5.1
pkgrel=10
pkgdesc="dnsdist is a highly DNS-, DoS-, and abuse-aware loadbalancer."
url="https://dnsdist.org/"
arch="all !s390x !mips64 !mips64el" # limited by h2o
license="GPL-2.0-only WITH OpenSSL-Exception"
_lua_version=5.4
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 luajit-dev h2o-dev wslay-dev"
pkgusers="dnsdist"
pkggroups="dnsdist"
install="$pkgname-common.pre-install"
subpackages="$pkgname-common::noarch $pkgname-doc"
source="https://downloads.powerdns.com/releases/dnsdist-$pkgver.tar.bz2
pdns-boost-containers-exception.patch"

[ "$CARCH" = "aarch64" ] || subpackages="$subpackages $pkgname-luajit"
[ "$CARCH" = "ppc64le" ] && options="!check" # failing tests

prepare() {
	default_prepare
	# aarch64 tests fail https://github.com/PowerDNS/pdns/issues/8655
	[ "$CARCH" = "aarch64" ] && return 0
	cp -a "$builddir" "$builddir-jit"
}

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

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

	cd "$builddir$_arg"

	# LIBH2OEVLOOP_LIBS env variable is because of a pkgconfig bug as per
	# https://bugs.launchpad.net/ubuntu/+source/h2o/+bug/1826152 and can be
	# removed when fixed upstream.
	LIBH2OEVLOOP_LIBS="-lh2o-evloop -lwslay" ./configure \
		--build="$CBUILD" \
		--host="$CHOST" \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--enable-dnscrypt \
		--enable-dns-over-tls \
		--enable-dns-over-https \
		--enable-unit-tests \
		--with-re2 \
		--with-protobuf \
		--with-boost=/usr/include \
		--with-net-snmp \
		--with-lua${_luajit:+=$_luajit}
}

build() {
	_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() {
	make check || _cat_found_file 'test-suite.log'
	./dnsdist --version

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

package() {
	make 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="68fe5f55fd081ed80a620933af9f8310be0e21c86ba449a9c557975b5c83f4b64e3002e6032dc002582d081e70e1ec2ff080c5d8389fd46a9896bdafd5a41f9f  dnsdist-1.5.1.tar.bz2
3bbbb11ed3036f19af880a8b30ee936cb34110f3542d260860aed0c8f27fbb0f0fb1b4b049e4a1ff8f2a532202311013b22459ee32077f53ac631602b32e68e2  pdns-boost-containers-exception.patch"