bind.spec 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. ##
  2. ## bind.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2009 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. ##
  23. # package version
  24. %define V_opkg 9.6.0p1
  25. %define V_dist 9.6.0-P1
  26. # package information
  27. Name: bind
  28. Summary: Berkeley Internet Name Domain (BIND)
  29. URL: https://www.isc.org/software/bind
  30. Vendor: Internet Software Foundation
  31. Packager: OpenPKG Foundation e.V.
  32. Distribution: OpenPKG Community
  33. Class: BASE
  34. Group: DNS
  35. License: ISC
  36. Version: %{V_opkg}
  37. Release: 20090503
  38. # package options
  39. %option with_dnssec yes
  40. %option with_threads no
  41. %option with_pgsql no
  42. %option with_mysql no
  43. %option with_odbc no
  44. %option with_ldap no
  45. # list of sources
  46. Source0: ftp://ftp.isc.org/isc/bind9/%{V_dist}/bind-%{V_dist}.tar.gz
  47. Source1: bind.txt
  48. Source2: rc.bind
  49. Patch0: bind.patch
  50. # build information
  51. Prefix: %{l_prefix}
  52. BuildRoot: %{l_buildroot}
  53. BuildPreReq: OpenPKG, openpkg >= 20060823, make, pkgconfig
  54. PreReq: OpenPKG, openpkg >= 20060823
  55. %if "%{with_dnssec}" == "yes"
  56. BuildPreReq: openssl
  57. PreReq: openssl
  58. %endif
  59. %if "%{with_pgsql}" == "yes"
  60. BuildPreReq: postgresql, openssl
  61. PreReq: postgresql, openssl
  62. %endif
  63. %if "%{with_mysql}" == "yes"
  64. BuildPreReq: mysql
  65. PreReq: mysql
  66. %endif
  67. %if "%{with_odbc}" == "yes"
  68. BuildPreReq: ODBC
  69. PreReq: ODBC
  70. %endif
  71. %if "%{with_ldap}" == "yes"
  72. BuildPreReq: openldap, openssl
  73. PreReq: openldap, openssl
  74. %endif
  75. AutoReq: no
  76. AutoReqProv: no
  77. Conflicts: powerdns
  78. %description
  79. Berkeley Internet Name Domain (BIND) is an implementation of
  80. the Domain Name System (DNS) protocols and provides an openly
  81. redistributable reference implementation of the major components
  82. of the Domain Name System, including a Domain Name System server
  83. (named)
  84. %track
  85. prog bind = {
  86. version = %{V_dist}
  87. url = ftp://ftp.isc.org/isc/bind9/
  88. regex = (\d+\.\d+\.\d+(?:-P\d+)?)
  89. url = ftp://ftp.isc.org/isc/bind9/__NEWVER__/
  90. regex = bind-(\d+\.\d+\.\d+(?:-P\d+)?)\.tar\.gz
  91. }
  92. %prep
  93. %setup -q -n bind-%{V_dist}
  94. %patch -p0
  95. %build
  96. # configure program
  97. %{l_shtool} subst \
  98. -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
  99. configure
  100. export CC="%{l_cc}"
  101. export CFLAGS="%{l_cflags -O} %{l_cppflags}"
  102. export LDFLAGS="%{l_ldflags}"
  103. export LIBS=""
  104. %if "%{with_pgsql}" == "yes"
  105. CFLAGS="$CFLAGS %{l_cppflags postgresql .}"
  106. %endif
  107. %if "%{with_dnssec}" == "yes"
  108. LIBS="$LIBS `pkg-config openssl --libs`"
  109. %endif
  110. GREP="grep" \
  111. ./configure \
  112. --prefix=%{l_prefix} \
  113. --mandir=%{l_prefix}/man \
  114. --sysconfdir=%{l_prefix}/etc/bind \
  115. --localstatedir=%{l_prefix}/var/bind \
  116. %if "%{with_dnssec}" == "yes"
  117. --with-openssl=%{l_prefix} \
  118. %else
  119. --without-openssl \
  120. %endif
  121. %if "%{with_threads}" == "yes"
  122. --enable-threads \
  123. %else
  124. --disable-threads \
  125. %endif
  126. %if "%{with_pgsql}" == "yes"
  127. --with-dlz-postgres=%{l_prefix} \
  128. %endif
  129. %if "%{with_mysql}" == "yes"
  130. --with-dlz-mysql=%{l_prefix} \
  131. %endif
  132. %if "%{with_odbc}" == "yes"
  133. --with-dlz-odbc=%{l_prefix} \
  134. %endif
  135. %if "%{with_ldap}" == "yes"
  136. --with-dlz-ldap=%{l_prefix} \
  137. %endif
  138. --without-libbind \
  139. --without-libxml2 \
  140. --with-libtool \
  141. --disable-shared \
  142. --disable-nls
  143. # build program
  144. %{l_make} %{l_mflags}
  145. %install
  146. rm -rf $RPM_BUILD_ROOT
  147. # perform standard install procedure
  148. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  149. # strip down installation
  150. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  151. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  152. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/isc-config.sh
  153. rm -rf $RPM_BUILD_ROOT%{l_prefix}/include
  154. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib
  155. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
  156. rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/bind/run
  157. # install BIND9 ARM
  158. %{l_shtool} mkdir -f -p -m 755 \
  159. $RPM_BUILD_ROOT%{l_prefix}/share/bind
  160. %{l_shtool} install -c -m 644 \
  161. doc/arm/*ARM*.html $RPM_BUILD_ROOT%{l_prefix}/share/bind/
  162. # install run-command script
  163. %{l_shtool} mkdir -f -p -m 755 \
  164. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  165. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  166. %{SOURCE rc.bind} \
  167. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  168. # install default configuration
  169. %{l_shtool} mkdir -f -p -m 755 \
  170. $RPM_BUILD_ROOT%{l_prefix}/etc/bind \
  171. $RPM_BUILD_ROOT%{l_prefix}/etc/bind/named.db
  172. for name in `grep "^<file" %{SOURCE bind.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do
  173. name_escaped=`echo "$name" | sed -e 's;/;\\\\/;g'`
  174. (echo ""; cat %{SOURCE bind.txt}; echo "") |\
  175. sed -e "1,/^<file name=\"$name_escaped\">/d" -e "/<\/file>/,\$d" >tmp.txt
  176. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  177. tmp.txt $RPM_BUILD_ROOT%{l_prefix}/etc/bind/$name
  178. done
  179. # create an empty var directory
  180. %{l_shtool} mkdir -f -p -m 755 \
  181. $RPM_BUILD_ROOT%{l_prefix}/var/bind
  182. # determine the installed files
  183. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  184. %{l_files_std} \
  185. '%config %attr(640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bind/*.conf' \
  186. '%config %attr(775,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bind/named.db' \
  187. '%config %attr(644,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/bind/named.db/*' \
  188. '%dir %attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bind'
  189. %files -f files
  190. %clean
  191. rm -rf $RPM_BUILD_ROOT
  192. %post
  193. if [ ! -f $RPM_INSTALL_PREFIX/etc/bind/rndc.key ]; then
  194. # generate local rndc(8) key
  195. ( echo "Generating RSA key for RNDC operation in $RPM_INSTALL_PREFIX/etc/bind/rndc.key."
  196. echo "Please be patient, this takes a non-deterministic amount of time."
  197. ) | %{l_rpmtool} msg -b -t notice
  198. $RPM_INSTALL_PREFIX/sbin/rndc-confgen -a
  199. chown %{l_musr}:%{l_rgrp} $RPM_INSTALL_PREFIX/etc/bind/rndc.key
  200. chmod 640 $RPM_INSTALL_PREFIX/etc/bind/rndc.key
  201. fi
  202. # after upgrade, restart service
  203. [ $1 -eq 2 ] || exit 0
  204. eval `%{l_rc} bind status 2>/dev/null`
  205. [ ".$bind_active" = .yes ] && %{l_rc} bind restart
  206. exit 0
  207. %preun
  208. # before erase, stop service and remove log files
  209. [ $1 -eq 0 ] || exit 0
  210. %{l_rc} bind stop 2>/dev/null
  211. rm -f $RPM_INSTALL_PREFIX/etc/bind/rndc.key
  212. rm -f $RPM_INSTALL_PREFIX/var/bind/*
  213. exit 0