bind.spec 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. ##
  2. ## bind.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package versions
  26. %define V_bind 9.2.2
  27. %define V_dlz 0.4.1
  28. # package information
  29. Name: bind
  30. Summary: Berkeley Internet Name Domain (BIND)
  31. URL: http://www.isc.org/products/BIND/
  32. Vendor: Internet Software Foundation
  33. Packager: The OpenPKG Project
  34. Distribution: OpenPKG [BASE]
  35. Group: DNS
  36. License: ISC
  37. Version: %{V_bind}
  38. Release: 20030415
  39. # package options
  40. %option with_dlz_mysql no
  41. %option with_dlz_postgres no
  42. %option with_dlz_filesystem no
  43. %option with_dlz_stub no
  44. %option with_dlz_bdb no
  45. # aggregate option
  46. %if "%{with_dlz_mysql}" == "yes" || "%{with_dlz_postgres}" == "yes" || "%{with_dlz_filesystem}" == "yes" || "%{with_dlz_stub}" == "yes" || "%{with_dlz_bdb}" == "yes"
  47. %define with_dlz yes
  48. %else
  49. %define with_dlz no
  50. %endif
  51. # list of sources
  52. Source0: ftp://ftp.isc.org/isc/bind9/%{version}/bind-%{V_bind}.tar.gz
  53. Source2: db.root
  54. Source3: db.root.sh
  55. Source4: db.localhost
  56. Source5: db.localhost.ipv4
  57. Source6: db.localhost.ipv6
  58. Source7: named.conf
  59. Source8: rndc.conf
  60. Source9: rc.bind
  61. Source10: http://osdn.dl.sourceforge.net/bind-dlz/DLZ-%{V_dlz}.tar.gz
  62. Patch0: bind.patch
  63. # build information
  64. Prefix: %{l_prefix}
  65. BuildRoot: %{l_buildroot}
  66. BuildPreReq: OpenPKG, openpkg >= 20021002, make, openssl
  67. PreReq: OpenPKG, openpkg >= 20021002
  68. %if "%{with_dlz_mysql}" == "yes"
  69. BuildPreReq: MYSQL
  70. PreReq: MYSQL
  71. %endif
  72. %if "%{with_dlz_postgres}" == "yes"
  73. BuildPreReq: postgresql
  74. PreReq: postgresql
  75. %endif
  76. %if "%{with_dlz_bdb}" == "yes"
  77. BuildPreReq: db
  78. PreReq: db
  79. %endif
  80. AutoReq: no
  81. AutoReqProv: no
  82. Conflicts: bind8
  83. %description
  84. Berkeley Internet Name Domain (BIND) is an implementation of
  85. the Domain Name System (DNS) protocols and provides an openly
  86. redistributable reference implementation of the major components
  87. of the Domain Name System, including a Domain Name System server
  88. (named)
  89. %prep
  90. %setup -q
  91. %if "%{with_dlz}" == "yes"
  92. echo "WITH DLZ"
  93. %setup -q -T -D -a 10
  94. %patch0 -p0
  95. #
  96. # adjust DLZ patch for bind-9.22
  97. %{l_patch} -p1 <dlz.patch
  98. #
  99. # fix up DLZ link libraries for MYSQL
  100. %{l_shtool} subst \
  101. -e '/-lmysqlclient/s;-lnsl;;' \
  102. configure
  103. %endif
  104. %if "%{with_dlz_bdb}" != "yes"
  105. #
  106. # dlzbdb utility breaks build if not configured
  107. %{l_shtool} subst \
  108. -e '/^SUBDIRS =/s;dlzbdb ;;' \
  109. bin/Makefile.in
  110. %endif
  111. %build
  112. CC="%{l_cc}" \
  113. CFLAGS="%{l_cflags -O}" \
  114. ./configure \
  115. --prefix=%{l_prefix} \
  116. --sysconfdir=%{l_prefix}/etc/bind \
  117. --localstatedir=%{l_prefix}/var/bind \
  118. %if "%{with_dlz_mysql}" == "yes"
  119. --with-dlz-mysql="%{l_prefix}" \
  120. %else
  121. --with-dlz-mysql=no \
  122. %endif
  123. %if "%{with_dlz_postgres}" == "yes"
  124. --with-dlz-postgres="%{l_prefix}" \
  125. %else
  126. --with-dlz-postgres=no \
  127. %endif
  128. %if "%{with_dlz_filesystem}" == "yes"
  129. --with-dlz-filesystem=yes \
  130. %else
  131. --with-dlz-filesystem=no \
  132. %endif
  133. %if "%{with_dlz_stub}" == "yes"
  134. --with-dlz-stub=yes \
  135. %else
  136. --with-dlz-stub=no \
  137. %endif
  138. %if "%{with_dlz_bdb}" == "yes"
  139. --with-dlz-bdb=yes \
  140. %else
  141. --with-dlz-bdb=no \
  142. %endif
  143. --with-openssl=%{l_prefix} \
  144. --with-libtool \
  145. --without-libbind \
  146. --disable-threads \
  147. --disable-shared \
  148. --disable-nls
  149. %{l_make} %{l_mflags}
  150. %install
  151. rm -rf $RPM_BUILD_ROOT
  152. # perform standard install procedure
  153. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  154. # strip down installation
  155. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  156. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  157. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/isc-config.sh
  158. rm -rf $RPM_BUILD_ROOT%{l_prefix}/include
  159. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib
  160. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
  161. # install BIND9 ARM
  162. %{l_shtool} mkdir -f -p -m 755 \
  163. $RPM_BUILD_ROOT%{l_prefix}/share/bind
  164. %{l_shtool} install -c -m 644 \
  165. doc/arm/*.html $RPM_BUILD_ROOT%{l_prefix}/share/bind/
  166. # install run-command script
  167. %{l_shtool} mkdir -f -p -m 755 \
  168. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  169. %{l_shtool} install -c -m 755 \
  170. -e 's;@l_prefix@;%{l_prefix};g' \
  171. -e 's;@l_susr@;%{l_susr};g' \
  172. -e 's;@l_musr@;%{l_musr};g' \
  173. -e 's;@l_mgrp@;%{l_mgrp};g' \
  174. %{SOURCE rc.bind} \
  175. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  176. # install a reasonable default configuration
  177. %{l_shtool} mkdir -f -p -m 755 \
  178. $RPM_BUILD_ROOT%{l_prefix}/etc/bind
  179. %{l_shtool} install -c -m 644 -e 's;@l_prefix@;%{l_prefix};g' \
  180. %{SOURCE named.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/bind/
  181. %{l_shtool} install -c -m 644 -e 's;@l_prefix@;%{l_prefix};g' \
  182. %{SOURCE rndc.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/bind/
  183. %{l_shtool} mkdir -f -p -m 755 \
  184. $RPM_BUILD_ROOT%{l_prefix}/etc/bind/named.db
  185. %{l_shtool} install -c -m 644 \
  186. %{SOURCE db.localhost} \
  187. %{SOURCE db.localhost.ipv4} \
  188. %{SOURCE db.localhost.ipv6} \
  189. %{SOURCE db.root} \
  190. %{SOURCE db.root.sh} \
  191. $RPM_BUILD_ROOT%{l_prefix}/etc/bind/named.db/
  192. # create an empty var directory
  193. %{l_shtool} mkdir -f -p -m 755 \
  194. $RPM_BUILD_ROOT%{l_prefix}/var/bind
  195. # determine the installed files
  196. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  197. %{l_files_std} \
  198. '%config %{l_prefix}/etc/bind/*.conf' \
  199. '%config %{l_prefix}/etc/bind/named.db/*' \
  200. '%dir %attr(-,root,%{l_mgrp}) %{l_prefix}/var/bind'
  201. %files -f files
  202. %clean
  203. rm -rf $RPM_BUILD_ROOT
  204. %post
  205. if [ $1 -eq 1 ]; then
  206. # generate local rndc key
  207. ( echo "Generating RSA key for RNDC operation in $RPM_INSTALL_PREFIX/etc/bind/rndc.key."
  208. echo "Please be patient, this takes a non-deterministic amount of time."
  209. ) | %{l_rpmtool} msg -b -t notice
  210. $RPM_INSTALL_PREFIX/sbin/rndc-confgen -a
  211. chown %{l_musr}:%{l_mgrp} $RPM_INSTALL_PREFIX/etc/bind/rndc.key
  212. elif [ $1 -gt 1 ]; then
  213. # reload daemon
  214. $RPM_INSTALL_PREFIX/sbin/rndc reload >/dev/null 2>&1 || true
  215. fi
  216. %preun
  217. if [ $1 -eq 0 ]; then
  218. # stop daemon
  219. $RPM_INSTALL_PREFIX/sbin/rndc stop >/dev/null 2>&1 || true
  220. # remove dynamically generated files
  221. rm -f $RPM_INSTALL_PREFIX/etc/bind/rndc.key
  222. rm -f $RPM_INSTALL_PREFIX/var/bind/*
  223. fi