michael@556: ##
michael@556: ## bind.spec -- OpenPKG RPM Package Specification
michael@556: ## Copyright (c) 2000-2012 OpenPKG Foundation e.V.
michael@556: ##
michael@556: ## Permission to use, copy, modify, and distribute this software for
michael@556: ## any purpose with or without fee is hereby granted, provided that
michael@556: ## the above copyright notice and this permission notice appear in all
michael@556: ## copies.
michael@556: ##
michael@556: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@556: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@556: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@556: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@556: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@556: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@556: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@556: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@556: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@556: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@556: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@556: ## SUCH DAMAGE.
michael@556: ##
michael@556:
michael@556: # package version
michael@556: %define V_opkg 9.9.1p1
michael@556: %define V_dist 9.9.1-P1
michael@556:
michael@556: # package information
michael@556: Name: bind
michael@556: Summary: Berkeley Internet Name Domain (BIND)
michael@556: URL: https://www.isc.org/software/bind
michael@556: Vendor: Internet Software Foundation
michael@556: Packager: OpenPKG Foundation e.V.
michael@556: Distribution: OpenPKG Community
michael@556: Class: BASE
michael@556: Group: DNS
michael@556: License: ISC
michael@556: Version: %{V_opkg}
michael@557: Release: 20120800
michael@556:
michael@556: # package options
michael@556: %option with_dnssec yes
michael@556: %option with_threads no
michael@556: %option with_pgsql no
michael@556: %option with_mysql no
michael@556: %option with_odbc no
michael@556: %option with_bdb no
michael@556: %option with_fs no
michael@556: %option with_ldap no
michael@556:
michael@556: # list of sources
michael@556: Source0: ftp://ftp.isc.org/isc/bind9/%{V_dist}/bind-%{V_dist}.tar.gz
michael@556: Source1: bind.txt
michael@556: Source2: rc.bind
michael@556: Patch0: bind.patch
michael@556:
michael@556: # build information
michael@556: BuildPreReq: OpenPKG, openpkg >= 20100101, make, pkgconfig
michael@556: PreReq: OpenPKG, openpkg >= 20100101
michael@556: %if "%{with_dnssec}" == "yes"
michael@556: BuildPreReq: openssl
michael@556: PreReq: openssl
michael@556: %endif
michael@556: %if "%{with_pgsql}" == "yes"
michael@556: BuildPreReq: postgresql, openssl
michael@556: PreReq: postgresql, openssl
michael@556: %endif
michael@556: %if "%{with_mysql}" == "yes"
michael@556: BuildPreReq: mysql
michael@556: PreReq: mysql
michael@556: %endif
michael@556: %if "%{with_odbc}" == "yes"
michael@556: BuildPreReq: ODBC
michael@556: PreReq: ODBC
michael@556: %endif
michael@556: %if "%{with_bdb}" == "yes"
michael@556: BuildPreReq: db
michael@556: PreReq: db
michael@556: %endif
michael@556: %if "%{with_ldap}" == "yes"
michael@556: BuildPreReq: openldap, openssl
michael@556: PreReq: openldap, openssl
michael@556: %endif
michael@556: Conflicts: powerdns
michael@556:
michael@556: %description
michael@556: Berkeley Internet Name Domain (BIND) is an implementation of
michael@556: the Domain Name System (DNS) protocols and provides an openly
michael@556: redistributable reference implementation of the major components
michael@556: of the Domain Name System, including a Domain Name System server
michael@556: (named)
michael@556:
michael@556: %track
michael@556: prog bind = {
michael@556: version = %{V_dist}
michael@556: url = ftp://ftp.isc.org/isc/bind9/
michael@556: regex = (\d+\.\d+\.\d+(?:-P\d+)?)
michael@556: url = ftp://ftp.isc.org/isc/bind9/__NEWVER__/
michael@556: regex = bind-(\d+\.\d+\.\d+(?:-P\d+)?)\.tar\.gz
michael@556: }
michael@556:
michael@556: %prep
michael@556: %setup -q -n bind-%{V_dist}
michael@556: %patch -p0
michael@556:
michael@556: %build
michael@556: # configure program
michael@556: %{l_shtool} subst \
michael@556: -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
michael@556: configure
michael@556: export CC="%{l_cc}"
michael@556: export CFLAGS="%{l_cflags -O} %{l_cppflags}"
michael@556: export LDFLAGS="%{l_ldflags}"
michael@556: export LIBS=""
michael@556: %if "%{with_pgsql}" == "yes"
michael@556: CFLAGS="$CFLAGS %{l_cppflags postgresql .}"
michael@556: %endif
michael@556: %if "%{with_dnssec}" == "yes"
michael@556: LIBS="$LIBS `pkg-config openssl --libs`"
michael@556: %endif
michael@556: GREP="grep" \
michael@556: ./configure \
michael@556: --prefix=%{l_prefix} \
michael@556: --mandir=%{l_prefix}/man \
michael@556: --sysconfdir=%{l_prefix}/etc/bind \
michael@556: --localstatedir=%{l_prefix}/var/bind \
michael@556: %if "%{with_dnssec}" == "yes"
michael@556: --with-openssl=%{l_prefix} \
michael@556: %else
michael@556: --without-openssl \
michael@556: %endif
michael@556: %if "%{with_threads}" == "yes"
michael@556: --enable-threads \
michael@556: %else
michael@556: --disable-threads \
michael@556: %endif
michael@556: %if "%{with_pgsql}" == "yes"
michael@556: --with-dlz-postgres=%{l_prefix} \
michael@556: %endif
michael@556: %if "%{with_mysql}" == "yes"
michael@556: --with-dlz-mysql=%{l_prefix} \
michael@556: %endif
michael@556: %if "%{with_odbc}" == "yes"
michael@556: --with-dlz-odbc=%{l_prefix} \
michael@556: %endif
michael@556: %if "%{with_bdb}" == "yes"
michael@556: --with-dlz-bdb=%{l_prefix} \
michael@556: %endif
michael@556: %if "%{with_fs}" == "yes"
michael@556: --with-dlz-filesystem \
michael@556: %endif
michael@556: %if "%{with_ldap}" == "yes"
michael@556: --with-dlz-ldap=%{l_prefix} \
michael@556: %endif
michael@556: --without-libbind \
michael@556: --without-libxml2 \
michael@556: --without-gssapi \
michael@556: --with-libtool \
michael@556: --disable-shared \
michael@556: --disable-nls
michael@556:
michael@556: # build program
michael@557: %{l_make} %{l_mflags -O}
michael@556:
michael@556: %install
michael@556:
michael@556: # perform standard install procedure
michael@556: %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
michael@556:
michael@556: # strip down installation
michael@556: strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
michael@556: strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
michael@556: rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/isc-config.sh
michael@556: rm -rf $RPM_BUILD_ROOT%{l_prefix}/include
michael@556: rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib
michael@556: rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
michael@556: rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/bind/run
michael@556:
michael@556: # install BIND9 ARM
michael@556: %{l_shtool} mkdir -f -p -m 755 \
michael@556: $RPM_BUILD_ROOT%{l_prefix}/share/bind
michael@556: %{l_shtool} install -c -m 644 \
michael@556: doc/arm/*ARM*.html $RPM_BUILD_ROOT%{l_prefix}/share/bind/
michael@556:
michael@556: # install run-command script
michael@556: %{l_shtool} mkdir -f -p -m 755 \
michael@556: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@556: %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@556: %{SOURCE rc.bind} \
michael@556: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@556:
michael@556: # install default configuration
michael@556: %{l_shtool} mkdir -f -p -m 755 \
michael@556: $RPM_BUILD_ROOT%{l_prefix}/etc/bind \
michael@556: $RPM_BUILD_ROOT%{l_prefix}/etc/bind/named.db
michael@556: for name in `grep "^/d" -e "/<\/file>/,\$d" >tmp.txt
michael@556: %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@556: tmp.txt $RPM_BUILD_ROOT%{l_prefix}/etc/bind/$name
michael@556: done
michael@556:
michael@556: # create an empty var directory
michael@556: %{l_shtool} mkdir -f -p -m 755 \
michael@556: $RPM_BUILD_ROOT%{l_prefix}/var/bind
michael@556:
michael@556: # determine the installed files
michael@556: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@556: %{l_files_std} \
michael@556: '%config %attr(640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bind/*.conf' \
michael@556: '%config %attr(775,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bind/named.db' \
michael@556: '%config %attr(644,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bind/named.db/*' \
michael@556: '%dir %attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bind'
michael@556:
michael@556: %files -f files
michael@556:
michael@556: %clean
michael@556:
michael@556: %post
michael@556: if [ ! -f $RPM_INSTALL_PREFIX/etc/bind/rndc.key ]; then
michael@556: # generate local rndc(8) key
michael@556: ( echo "Generating RSA key for RNDC operation in $RPM_INSTALL_PREFIX/etc/bind/rndc.key."
michael@556: echo "Please be patient, this takes a non-deterministic amount of time."
michael@556: ) | %{l_rpmtool} msg -b -t notice
michael@556: $RPM_INSTALL_PREFIX/sbin/rndc-confgen -a
michael@556: chown %{l_musr}:%{l_rgrp} $RPM_INSTALL_PREFIX/etc/bind/rndc.key
michael@556: chmod 640 $RPM_INSTALL_PREFIX/etc/bind/rndc.key
michael@556: fi
michael@556:
michael@556: # after upgrade, restart service
michael@556: [ $1 -eq 2 ] || exit 0
michael@556: eval `%{l_rc} bind status 2>/dev/null`
michael@556: [ ".$bind_active" = .yes ] && %{l_rc} bind restart
michael@556: exit 0
michael@556:
michael@556: %preun
michael@556: # before erase, stop service and remove log files
michael@556: [ $1 -eq 0 ] || exit 0
michael@556: %{l_rc} bind stop 2>/dev/null
michael@556: rm -f $RPM_INSTALL_PREFIX/etc/bind/rndc.key
michael@556: rm -f $RPM_INSTALL_PREFIX/var/bind/*
michael@556: exit 0
michael@556: