bind/bind.spec

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 556
d927b76d07e3
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

     1 ##
     2 ##  bind.spec -- OpenPKG RPM Package Specification
     3 ##  Copyright (c) 2000-2012 OpenPKG Foundation e.V. <http://openpkg.net/>
     4 ##
     5 ##  Permission to use, copy, modify, and distribute this software for
     6 ##  any purpose with or without fee is hereby granted, provided that
     7 ##  the above copyright notice and this permission notice appear in all
     8 ##  copies.
     9 ##
    10 ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    11 ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    12 ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    13 ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    14 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    15 ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    16 ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    17 ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    18 ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    19 ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    20 ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    21 ##  SUCH DAMAGE.
    22 ##
    24 #   package version
    25 %define       V_opkg  9.9.1p1
    26 %define       V_dist  9.9.1-P1
    28 #   package information
    29 Name:         bind
    30 Summary:      Berkeley Internet Name Domain (BIND)
    31 URL:          https://www.isc.org/software/bind
    32 Vendor:       Internet Software Foundation
    33 Packager:     OpenPKG Foundation e.V.
    34 Distribution: OpenPKG Community
    35 Class:        BASE
    36 Group:        DNS
    37 License:      ISC
    38 Version:      %{V_opkg}
    39 Release:      20120800
    41 #   package options
    42 %option       with_dnssec    yes
    43 %option       with_threads   no
    44 %option       with_pgsql     no
    45 %option       with_mysql     no
    46 %option       with_odbc      no
    47 %option       with_bdb       no
    48 %option       with_fs        no
    49 %option       with_ldap      no
    51 #   list of sources
    52 Source0:      ftp://ftp.isc.org/isc/bind9/%{V_dist}/bind-%{V_dist}.tar.gz
    53 Source1:      bind.txt
    54 Source2:      rc.bind
    55 Patch0:       bind.patch
    57 #   build information
    58 BuildPreReq:  OpenPKG, openpkg >= 20100101, make, pkgconfig
    59 PreReq:       OpenPKG, openpkg >= 20100101
    60 %if "%{with_dnssec}" == "yes"
    61 BuildPreReq:  openssl
    62 PreReq:       openssl
    63 %endif
    64 %if "%{with_pgsql}" == "yes"
    65 BuildPreReq:  postgresql, openssl
    66 PreReq:       postgresql, openssl
    67 %endif
    68 %if "%{with_mysql}" == "yes"
    69 BuildPreReq:  mysql
    70 PreReq:       mysql
    71 %endif
    72 %if "%{with_odbc}" == "yes"
    73 BuildPreReq:  ODBC
    74 PreReq:       ODBC
    75 %endif
    76 %if "%{with_bdb}" == "yes"
    77 BuildPreReq:  db
    78 PreReq:       db
    79 %endif
    80 %if "%{with_ldap}" == "yes"
    81 BuildPreReq:  openldap, openssl
    82 PreReq:       openldap, openssl
    83 %endif
    84 Conflicts:    powerdns
    86 %description
    87     Berkeley Internet Name Domain (BIND) is an implementation of
    88     the Domain Name System (DNS) protocols and provides an openly
    89     redistributable reference implementation of the major components
    90     of the Domain Name System, including a Domain Name System server
    91     (named)
    93 %track
    94     prog bind = {
    95         version   = %{V_dist}
    96         url       = ftp://ftp.isc.org/isc/bind9/
    97         regex     = (\d+\.\d+\.\d+(?:-P\d+)?)
    98         url       = ftp://ftp.isc.org/isc/bind9/__NEWVER__/
    99         regex     = bind-(\d+\.\d+\.\d+(?:-P\d+)?)\.tar\.gz
   100     }
   102 %prep
   103     %setup -q -n bind-%{V_dist}
   104     %patch -p0
   106 %build
   107     #   configure program
   108     %{l_shtool} subst \
   109         -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
   110         configure
   111     export CC="%{l_cc}"
   112     export CFLAGS="%{l_cflags -O} %{l_cppflags}"
   113     export LDFLAGS="%{l_ldflags}"
   114     export LIBS=""
   115 %if "%{with_pgsql}" == "yes"
   116     CFLAGS="$CFLAGS %{l_cppflags postgresql .}"
   117 %endif
   118 %if "%{with_dnssec}" == "yes"
   119     LIBS="$LIBS `pkg-config openssl --libs`"
   120 %endif
   121     GREP="grep" \
   122     ./configure \
   123         --prefix=%{l_prefix} \
   124         --mandir=%{l_prefix}/man \
   125         --sysconfdir=%{l_prefix}/etc/bind \
   126         --localstatedir=%{l_prefix}/var/bind \
   127 %if "%{with_dnssec}" == "yes"
   128         --with-openssl=%{l_prefix} \
   129 %else
   130         --without-openssl \
   131 %endif
   132 %if "%{with_threads}" == "yes"
   133         --enable-threads \
   134 %else
   135         --disable-threads \
   136 %endif
   137 %if "%{with_pgsql}" == "yes"
   138         --with-dlz-postgres=%{l_prefix} \
   139 %endif
   140 %if "%{with_mysql}" == "yes"
   141         --with-dlz-mysql=%{l_prefix} \
   142 %endif
   143 %if "%{with_odbc}" == "yes"
   144         --with-dlz-odbc=%{l_prefix} \
   145 %endif
   146 %if "%{with_bdb}" == "yes"
   147         --with-dlz-bdb=%{l_prefix} \
   148 %endif
   149 %if "%{with_fs}" == "yes"
   150         --with-dlz-filesystem \
   151 %endif
   152 %if "%{with_ldap}" == "yes"
   153         --with-dlz-ldap=%{l_prefix} \
   154 %endif
   155         --without-libbind \
   156         --without-libxml2 \
   157         --without-gssapi \
   158         --with-libtool \
   159         --disable-shared \
   160         --disable-nls
   162     #   build program
   163     %{l_make} %{l_mflags -O}
   165 %install
   167     #   perform standard install procedure
   168     %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   170     #   strip down installation
   171     strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
   172     strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
   173     rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/isc-config.sh
   174     rm -rf $RPM_BUILD_ROOT%{l_prefix}/include
   175     rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib
   176     rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
   177     rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/bind/run
   179     #   install BIND9 ARM
   180     %{l_shtool} mkdir -f -p -m 755 \
   181         $RPM_BUILD_ROOT%{l_prefix}/share/bind
   182     %{l_shtool} install -c -m 644 \
   183         doc/arm/*ARM*.html $RPM_BUILD_ROOT%{l_prefix}/share/bind/
   185     #   install run-command script
   186     %{l_shtool} mkdir -f -p -m 755 \
   187         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   188     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   189         %{SOURCE rc.bind} \
   190         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   192     #   install default configuration
   193     %{l_shtool} mkdir -f -p -m 755 \
   194         $RPM_BUILD_ROOT%{l_prefix}/etc/bind \
   195         $RPM_BUILD_ROOT%{l_prefix}/etc/bind/named.db
   196     for name in `grep "^<file" %{SOURCE bind.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do
   197         name_escaped=`echo "$name" | sed -e 's;/;\\\\/;g'`
   198         (echo ""; cat %{SOURCE bind.txt}; echo "") |\
   199             sed -e "1,/^<file name=\"$name_escaped\">/d" -e "/<\/file>/,\$d" >tmp.txt
   200         %{l_shtool} install -c -m 644 %{l_value -s -a} \
   201             tmp.txt $RPM_BUILD_ROOT%{l_prefix}/etc/bind/$name
   202     done
   204     #   create an empty var directory
   205     %{l_shtool} mkdir -f -p -m 755 \
   206         $RPM_BUILD_ROOT%{l_prefix}/var/bind
   208     #   determine the installed files
   209     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   210         %{l_files_std} \
   211         '%config %attr(640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bind/*.conf' \
   212         '%config %attr(775,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bind/named.db' \
   213         '%config %attr(644,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bind/named.db/*' \
   214         '%dir %attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bind'
   216 %files -f files
   218 %clean
   220 %post
   221     if [ ! -f $RPM_INSTALL_PREFIX/etc/bind/rndc.key ]; then
   222         #   generate local rndc(8) key
   223         ( echo "Generating RSA key for RNDC operation in $RPM_INSTALL_PREFIX/etc/bind/rndc.key."
   224           echo "Please be patient, this takes a non-deterministic amount of time."
   225         ) | %{l_rpmtool} msg -b -t notice
   226         $RPM_INSTALL_PREFIX/sbin/rndc-confgen -a
   227         chown %{l_musr}:%{l_rgrp} $RPM_INSTALL_PREFIX/etc/bind/rndc.key
   228         chmod 640 $RPM_INSTALL_PREFIX/etc/bind/rndc.key
   229     fi
   231     #   after upgrade, restart service
   232     [ $1 -eq 2 ] || exit 0
   233     eval `%{l_rc} bind status 2>/dev/null`
   234     [ ".$bind_active" = .yes ] && %{l_rc} bind restart
   235     exit 0
   237 %preun
   238     #   before erase, stop service and remove log files
   239     [ $1 -eq 0 ] || exit 0
   240     %{l_rc} bind stop 2>/dev/null
   241     rm -f $RPM_INSTALL_PREFIX/etc/bind/rndc.key
   242     rm -f $RPM_INSTALL_PREFIX/var/bind/*
   243     exit 0

mercurial