# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 inherit autotools flag-o-matic multiprocessing MY_PN=${PN//-tools} MY_PV=${PV/_p/-P} MY_PV=${MY_PV/_rc/rc} MY_P="${MY_PN}-${MY_PV}" DESCRIPTION="bind tools: dig, nslookup, host, nsupdate, dnssec-keygen" HOMEPAGE="https://www.isc.org/software/bind https://gitlab.isc.org/isc-projects/bind9" SRC_URI="https://downloads.isc.org/isc/bind9/${PV}/${MY_P}.tar.xz" LICENSE="Apache-2.0 BSD BSD-2 GPL-2 HPND ISC MPL-2.0" SLOT="0" #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris" KEYWORDS="" IUSE="+caps +dnssec-autoval +doh fixed-rrset gssapi idn +jemalloc libedit moretools readline test xml" # IUSE notes: # - jemalloc is recommended by the build system, so enable by default. # * USE 'lazy-lock' MUST be disabled or will get this error: # : Error in dlsym(RTLD_NEXT, "pthread_create") # Aborted # - DoH is enabled by default in 9.18+ by the build system, so mimic. # - DNSSEC auto-validation is enabled by default by build system, so mimic. # - No PKCS11 currently as it requires OpenSSL to be patched; see bug #409687. RESTRICT="!test? ( test )" # libuv lower bound should be the highest value seen at # https://gitlab.isc.org/isc-projects/bind9/-/blob/v9_18/lib/isc/netmgr/netmgr.c#L202 # to avoid issues with matching stable/testing, etc. COMMON_DEPEND=" >=dev-libs/libuv-1.42.0:= dev-libs/openssl:= caps? ( sys-libs/libcap ) doh? ( net-libs/nghttp2:= ) xml? ( dev-libs/libxml2 ) idn? ( net-dns/libidn2:= ) jemalloc? ( dev-libs/jemalloc[-lazy-lock] ) gssapi? ( virtual/krb5 ) libedit? ( dev-libs/libedit ) !libedit? ( readline? ( sys-libs/readline:= ) ) " DEPEND="${COMMON_DEPEND}" RDEPEND="${COMMON_DEPEND}" BDEPEND=" virtual/pkgconfig test? ( dev-util/cmocka dev-util/kyua ) " S="${WORKDIR}/${MY_P}" src_prepare() { default append-ldflags "-L${ESYSROOT}/usr/$(get_libdir)" # Do not disable thread local storage on Solaris, it works with our # toolchain, and it breaks further configure checks. if [[ ${CHOST} == *-solaris* ]]; then sed -i -e '/LDFLAGS=/s/-zrelax=transtls//' configure.ac configure || die fi # 'libisccc' isn't used by any of the tools we install, so it can be # excluded from the build. sed -i -r -e 's/(SUBDIRS\s*=.*)isccc\s(.*)/\1\2/g' lib/Makefile.am # Build some additional/uncommon tools; see bug #548124. if use moretools; then echo "SUBDIRS = check confgen delv dig dnssec nsupdate tools" > bin/Makefile.am else echo "SUBDIRS = delv dig dnssec nsupdate" > bin/Makefile.am sed -i -z -e '/\s*dnssec-cds\s*\\/d' bin/dnssec/Makefile.am fi eautoreconf } src_configure() { # Set localstatedir to /var, for nsupdate -l; see bug #395785. local myeconfargs=( --localstatedir="${EPREFIX}"/var --without-json-c --without-zlib --without-lmdb --without-maxminddb --disable-geoip --with-openssl="${ESYSROOT}"/usr $(use_with gssapi) $(use_with idn libidn2 "${ESYSROOT}"/usr) $(use_with jemalloc) $(use_with xml libxml2) $(use_enable caps linux-caps) $(use_enable dnssec-autoval auto-validation) $(use_enable doh) $(use_enable fixed-rrset) ) # bind-9.18 changed how this switch works and it no longer takes a # linker switch as an argument; see the original bug #607400. if use libedit ; then myeconfargs+=( --with-readline=libedit ) elif use readline ; then myeconfargs+=( --with-readline=readline ) else myeconfargs+=( --without-readline ) fi econf "${myeconfargs[@]}" } src_compile() { # In bind-9.18, bind.keys.h is not present in the shipped source # and must be generated via this make target first. emake bind.keys.h # Build shared libs first, binaries second, and docs last. emake -C lib emake -C bin emake -C doc/man man } src_test() { # System tests ('emake test') require network configuration for IPs addrs, # so only run the unit tests instead. TEST_PARALLEL_JOBS="$(makeopts_jobs)" emake unit } src_install() { dodoc README.md CHANGES # Install libs first and binaries second. # # Note1: We can't copy them out like in 9.16, as the updated build # system uses libtool during the 'install' phase to complete the # linking process. # # Note2: Use the install-exec target to avoid installing header # files. Shared libs are installed, but they are not meant to be # linked against by anything other than the tools built by this # package. emake DESTDIR="${D}" -C lib install-exec emake DESTDIR="${D}" -C bin install-exec # Remove any libtool .la files. find "${ED}" -type f -name '*.la' -delete || die # Install just the needed man files. # # Note: Don't use 'emake' to install here, as it will attempt to build # and run a program in the doc/misc dir, cfg_test, and the output of # this program is not needed when only building the tools. cd "${S}/doc/man" doman \ delv.1 \ dig.1 \ dnssec-dsfromkey.1 \ dnssec-importkey.1 \ dnssec-keyfromlabel.1 \ dnssec-keygen.1 \ dnssec-revoke.1 \ dnssec-settime.1 \ dnssec-signzone.1 \ dnssec-verify.1 \ host.1 \ nslookup.1 \ nsupdate.1 # Build some additional/uncommon tools; see bug #548124. if use moretools; then doman \ arpaname.1 \ dnssec-cds.1 \ mdig.1 \ named-checkconf.1 \ named-checkzone.1 \ named-journalprint.1 \ named-rrchecker.1 \ nsec3hash.1 \ rndc-confgen.8 \ tsig-keygen.8 fi }