bind/bind.spec

changeset 556
d927b76d07e3
child 557
00e3ab20fe25
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/bind/bind.spec	Tue Aug 28 18:33:15 2012 +0200
     1.3 @@ -0,0 +1,244 @@
     1.4 +##
     1.5 +##  bind.spec -- OpenPKG RPM Package Specification
     1.6 +##  Copyright (c) 2000-2012 OpenPKG Foundation e.V. <http://openpkg.net/>
     1.7 +##
     1.8 +##  Permission to use, copy, modify, and distribute this software for
     1.9 +##  any purpose with or without fee is hereby granted, provided that
    1.10 +##  the above copyright notice and this permission notice appear in all
    1.11 +##  copies.
    1.12 +##
    1.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    1.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.24 +##  SUCH DAMAGE.
    1.25 +##
    1.26 +
    1.27 +#   package version
    1.28 +%define       V_opkg  9.9.1p1
    1.29 +%define       V_dist  9.9.1-P1
    1.30 +
    1.31 +#   package information
    1.32 +Name:         bind
    1.33 +Summary:      Berkeley Internet Name Domain (BIND)
    1.34 +URL:          https://www.isc.org/software/bind
    1.35 +Vendor:       Internet Software Foundation
    1.36 +Packager:     OpenPKG Foundation e.V.
    1.37 +Distribution: OpenPKG Community
    1.38 +Class:        BASE
    1.39 +Group:        DNS
    1.40 +License:      ISC
    1.41 +Version:      %{V_opkg}
    1.42 +Release:      20120707
    1.43 +
    1.44 +#   package options
    1.45 +%option       with_dnssec    yes
    1.46 +%option       with_threads   no
    1.47 +%option       with_pgsql     no
    1.48 +%option       with_mysql     no
    1.49 +%option       with_odbc      no
    1.50 +%option       with_bdb       no
    1.51 +%option       with_fs        no
    1.52 +%option       with_ldap      no
    1.53 +
    1.54 +#   list of sources
    1.55 +Source0:      ftp://ftp.isc.org/isc/bind9/%{V_dist}/bind-%{V_dist}.tar.gz
    1.56 +Source1:      bind.txt
    1.57 +Source2:      rc.bind
    1.58 +Patch0:       bind.patch
    1.59 +
    1.60 +#   build information
    1.61 +BuildPreReq:  OpenPKG, openpkg >= 20100101, make, pkgconfig
    1.62 +PreReq:       OpenPKG, openpkg >= 20100101
    1.63 +%if "%{with_dnssec}" == "yes"
    1.64 +BuildPreReq:  openssl
    1.65 +PreReq:       openssl
    1.66 +%endif
    1.67 +%if "%{with_pgsql}" == "yes"
    1.68 +BuildPreReq:  postgresql, openssl
    1.69 +PreReq:       postgresql, openssl
    1.70 +%endif
    1.71 +%if "%{with_mysql}" == "yes"
    1.72 +BuildPreReq:  mysql
    1.73 +PreReq:       mysql
    1.74 +%endif
    1.75 +%if "%{with_odbc}" == "yes"
    1.76 +BuildPreReq:  ODBC
    1.77 +PreReq:       ODBC
    1.78 +%endif
    1.79 +%if "%{with_bdb}" == "yes"
    1.80 +BuildPreReq:  db
    1.81 +PreReq:       db
    1.82 +%endif
    1.83 +%if "%{with_ldap}" == "yes"
    1.84 +BuildPreReq:  openldap, openssl
    1.85 +PreReq:       openldap, openssl
    1.86 +%endif
    1.87 +Conflicts:    powerdns
    1.88 +
    1.89 +%description
    1.90 +    Berkeley Internet Name Domain (BIND) is an implementation of
    1.91 +    the Domain Name System (DNS) protocols and provides an openly
    1.92 +    redistributable reference implementation of the major components
    1.93 +    of the Domain Name System, including a Domain Name System server
    1.94 +    (named)
    1.95 +
    1.96 +%track
    1.97 +    prog bind = {
    1.98 +        version   = %{V_dist}
    1.99 +        url       = ftp://ftp.isc.org/isc/bind9/
   1.100 +        regex     = (\d+\.\d+\.\d+(?:-P\d+)?)
   1.101 +        url       = ftp://ftp.isc.org/isc/bind9/__NEWVER__/
   1.102 +        regex     = bind-(\d+\.\d+\.\d+(?:-P\d+)?)\.tar\.gz
   1.103 +    }
   1.104 +
   1.105 +%prep
   1.106 +    %setup -q -n bind-%{V_dist}
   1.107 +    %patch -p0
   1.108 +
   1.109 +%build
   1.110 +    #   configure program
   1.111 +    %{l_shtool} subst \
   1.112 +        -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
   1.113 +        configure
   1.114 +    export CC="%{l_cc}"
   1.115 +    export CFLAGS="%{l_cflags -O} %{l_cppflags}"
   1.116 +    export LDFLAGS="%{l_ldflags}"
   1.117 +    export LIBS=""
   1.118 +%if "%{with_pgsql}" == "yes"
   1.119 +    CFLAGS="$CFLAGS %{l_cppflags postgresql .}"
   1.120 +%endif
   1.121 +%if "%{with_dnssec}" == "yes"
   1.122 +    LIBS="$LIBS `pkg-config openssl --libs`"
   1.123 +%endif
   1.124 +    GREP="grep" \
   1.125 +    ./configure \
   1.126 +        --prefix=%{l_prefix} \
   1.127 +        --mandir=%{l_prefix}/man \
   1.128 +        --sysconfdir=%{l_prefix}/etc/bind \
   1.129 +        --localstatedir=%{l_prefix}/var/bind \
   1.130 +%if "%{with_dnssec}" == "yes"
   1.131 +        --with-openssl=%{l_prefix} \
   1.132 +%else
   1.133 +        --without-openssl \
   1.134 +%endif
   1.135 +%if "%{with_threads}" == "yes"
   1.136 +        --enable-threads \
   1.137 +%else
   1.138 +        --disable-threads \
   1.139 +%endif
   1.140 +%if "%{with_pgsql}" == "yes"
   1.141 +        --with-dlz-postgres=%{l_prefix} \
   1.142 +%endif
   1.143 +%if "%{with_mysql}" == "yes"
   1.144 +        --with-dlz-mysql=%{l_prefix} \
   1.145 +%endif
   1.146 +%if "%{with_odbc}" == "yes"
   1.147 +        --with-dlz-odbc=%{l_prefix} \
   1.148 +%endif
   1.149 +%if "%{with_bdb}" == "yes"
   1.150 +        --with-dlz-bdb=%{l_prefix} \
   1.151 +%endif
   1.152 +%if "%{with_fs}" == "yes"
   1.153 +        --with-dlz-filesystem \
   1.154 +%endif
   1.155 +%if "%{with_ldap}" == "yes"
   1.156 +        --with-dlz-ldap=%{l_prefix} \
   1.157 +%endif
   1.158 +        --without-libbind \
   1.159 +        --without-libxml2 \
   1.160 +        --without-gssapi \
   1.161 +        --with-libtool \
   1.162 +        --disable-shared \
   1.163 +        --disable-nls
   1.164 +
   1.165 +    #   build program
   1.166 +    %{l_make} %{l_mflags}
   1.167 +
   1.168 +%install
   1.169 +
   1.170 +    #   perform standard install procedure
   1.171 +    %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   1.172 +
   1.173 +    #   strip down installation
   1.174 +    strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
   1.175 +    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
   1.176 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/isc-config.sh
   1.177 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/include
   1.178 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib
   1.179 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
   1.180 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/bind/run
   1.181 +
   1.182 +    #   install BIND9 ARM
   1.183 +    %{l_shtool} mkdir -f -p -m 755 \
   1.184 +        $RPM_BUILD_ROOT%{l_prefix}/share/bind
   1.185 +    %{l_shtool} install -c -m 644 \
   1.186 +        doc/arm/*ARM*.html $RPM_BUILD_ROOT%{l_prefix}/share/bind/
   1.187 +
   1.188 +    #   install run-command script
   1.189 +    %{l_shtool} mkdir -f -p -m 755 \
   1.190 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   1.191 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   1.192 +        %{SOURCE rc.bind} \
   1.193 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   1.194 +
   1.195 +    #   install default configuration
   1.196 +    %{l_shtool} mkdir -f -p -m 755 \
   1.197 +        $RPM_BUILD_ROOT%{l_prefix}/etc/bind \
   1.198 +        $RPM_BUILD_ROOT%{l_prefix}/etc/bind/named.db
   1.199 +    for name in `grep "^<file" %{SOURCE bind.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do
   1.200 +        name_escaped=`echo "$name" | sed -e 's;/;\\\\/;g'`
   1.201 +        (echo ""; cat %{SOURCE bind.txt}; echo "") |\
   1.202 +            sed -e "1,/^<file name=\"$name_escaped\">/d" -e "/<\/file>/,\$d" >tmp.txt
   1.203 +        %{l_shtool} install -c -m 644 %{l_value -s -a} \
   1.204 +            tmp.txt $RPM_BUILD_ROOT%{l_prefix}/etc/bind/$name
   1.205 +    done
   1.206 +
   1.207 +    #   create an empty var directory
   1.208 +    %{l_shtool} mkdir -f -p -m 755 \
   1.209 +        $RPM_BUILD_ROOT%{l_prefix}/var/bind
   1.210 +
   1.211 +    #   determine the installed files
   1.212 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   1.213 +        %{l_files_std} \
   1.214 +        '%config %attr(640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bind/*.conf' \
   1.215 +        '%config %attr(775,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bind/named.db' \
   1.216 +        '%config %attr(644,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bind/named.db/*' \
   1.217 +        '%dir %attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bind'
   1.218 +
   1.219 +%files -f files
   1.220 +
   1.221 +%clean
   1.222 +
   1.223 +%post
   1.224 +    if [ ! -f $RPM_INSTALL_PREFIX/etc/bind/rndc.key ]; then
   1.225 +        #   generate local rndc(8) key
   1.226 +        ( echo "Generating RSA key for RNDC operation in $RPM_INSTALL_PREFIX/etc/bind/rndc.key."
   1.227 +          echo "Please be patient, this takes a non-deterministic amount of time."
   1.228 +        ) | %{l_rpmtool} msg -b -t notice
   1.229 +        $RPM_INSTALL_PREFIX/sbin/rndc-confgen -a
   1.230 +        chown %{l_musr}:%{l_rgrp} $RPM_INSTALL_PREFIX/etc/bind/rndc.key
   1.231 +        chmod 640 $RPM_INSTALL_PREFIX/etc/bind/rndc.key
   1.232 +    fi
   1.233 +
   1.234 +    #   after upgrade, restart service
   1.235 +    [ $1 -eq 2 ] || exit 0
   1.236 +    eval `%{l_rc} bind status 2>/dev/null`
   1.237 +    [ ".$bind_active" = .yes ] && %{l_rc} bind restart
   1.238 +    exit 0
   1.239 +
   1.240 +%preun
   1.241 +    #   before erase, stop service and remove log files
   1.242 +    [ $1 -eq 0 ] || exit 0
   1.243 +    %{l_rc} bind stop 2>/dev/null
   1.244 +    rm -f $RPM_INSTALL_PREFIX/etc/bind/rndc.key
   1.245 +    rm -f $RPM_INSTALL_PREFIX/var/bind/*
   1.246 +    exit 0
   1.247 +

mercurial