bind.spec 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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.5.0
  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: 20030704
  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. %option with_dlz_odbc no
  46. # aggregate option
  47. %if "%{with_dlz_mysql}" == "yes" || "%{with_dlz_postgres}" == "yes" || "%{with_dlz_filesystem}" == "yes" || "%{with_dlz_stub}" == "yes" || "%{with_dlz_bdb}" == "yes" || "%{with_dlz_odbc}" == "yes"
  48. %define with_dlz yes
  49. %else
  50. %define with_dlz no
  51. %endif
  52. # list of sources
  53. Source0: ftp://ftp.isc.org/isc/bind9/%{version}/bind-%{V_bind}.tar.gz
  54. Source2: db.root
  55. Source3: db.root.sh
  56. Source4: db.localhost
  57. Source5: db.localhost.ipv4
  58. Source6: db.localhost.ipv6
  59. Source7: named.conf
  60. Source8: rndc.conf
  61. Source9: rc.bind
  62. Source10: http://osdn.dl.sourceforge.net/bind-dlz/DLZ-%{V_dlz}.tar.gz
  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. %if "%{with_dlz_odbc}" == "yes"
  81. BuildPreReq: unixodbc
  82. PreReq: unixodbc
  83. %endif
  84. AutoReq: no
  85. AutoReqProv: no
  86. Conflicts: bind8
  87. %description
  88. Berkeley Internet Name Domain (BIND) is an implementation of
  89. the Domain Name System (DNS) protocols and provides an openly
  90. redistributable reference implementation of the major components
  91. of the Domain Name System, including a Domain Name System server
  92. (named)
  93. %prep
  94. %setup -q
  95. %if "%{with_dlz}" == "yes"
  96. %setup -q -T -D -a 10
  97. #
  98. %{l_patch} -p1 <dlz.patch
  99. #
  100. # fix up DLZ link libraries for MySQL and PostgreSQL
  101. %{l_shtool} subst \
  102. -e '/-lmysqlclient/s;-l\(nsl\|z\|crypt\|m\)\( \|"\);\2;g' \
  103. -e 's;\(-lpq\);\1 -lssl -lcrypto;g' \
  104. configure
  105. %endif
  106. %build
  107. cf=""
  108. lf=""
  109. li=""
  110. %if "%{with_dlz_mysql}" == "yes"
  111. cf=`mysql_config --cflags`
  112. cf=`eval echo $cf`
  113. lf=`mysql_config --libs`
  114. lf=`eval echo $lf`
  115. %endif
  116. CC="%{l_cc}" \
  117. CFLAGS="%{l_cflags -O} $cf" \
  118. LDFLAGS="%{l_ldflags} $lf" \
  119. ./configure \
  120. --prefix=%{l_prefix} \
  121. --sysconfdir=%{l_prefix}/etc/bind \
  122. --localstatedir=%{l_prefix}/var/bind \
  123. %if "%{with_dlz_mysql}" == "yes"
  124. --with-dlz-mysql="%{l_prefix}" \
  125. %else
  126. --with-dlz-mysql=no \
  127. %endif
  128. %if "%{with_dlz_postgres}" == "yes"
  129. --with-dlz-postgres="%{l_prefix}" \
  130. %else
  131. --with-dlz-postgres=no \
  132. %endif
  133. %if "%{with_dlz_bdb}" == "yes"
  134. --with-dlz-bdb="%{l_prefix}" \
  135. %else
  136. --with-dlz-bdb=no \
  137. %endif
  138. %if "%{with_dlz_filesystem}" == "yes"
  139. --with-dlz-filesystem=yes \
  140. %else
  141. --with-dlz-filesystem=no \
  142. %endif
  143. %if "%{with_dlz_stub}" == "yes"
  144. --with-dlz-stub=yes \
  145. %else
  146. --with-dlz-stub=no \
  147. %endif
  148. %if "%{with_dlz_odbc}" == "yes"
  149. --with-dlz-odbc="%{l_prefix}" \
  150. %else
  151. --with-dlz-odbc=no \
  152. %endif
  153. --with-openssl=%{l_prefix} \
  154. --with-libtool \
  155. --without-libbind \
  156. --disable-threads \
  157. --disable-shared \
  158. --disable-nls
  159. %{l_make} %{l_mflags}
  160. %install
  161. rm -rf $RPM_BUILD_ROOT
  162. # perform standard install procedure
  163. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  164. # strip down installation
  165. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  166. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  167. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/isc-config.sh
  168. rm -rf $RPM_BUILD_ROOT%{l_prefix}/include
  169. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib
  170. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
  171. # install BIND9 ARM
  172. %{l_shtool} mkdir -f -p -m 755 \
  173. $RPM_BUILD_ROOT%{l_prefix}/share/bind
  174. %{l_shtool} install -c -m 644 \
  175. doc/arm/*.html $RPM_BUILD_ROOT%{l_prefix}/share/bind/
  176. # install run-command script
  177. %{l_shtool} mkdir -f -p -m 755 \
  178. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  179. %{l_shtool} install -c -m 755 \
  180. -e 's;@l_prefix@;%{l_prefix};g' \
  181. -e 's;@l_susr@;%{l_susr};g' \
  182. -e 's;@l_musr@;%{l_musr};g' \
  183. -e 's;@l_mgrp@;%{l_mgrp};g' \
  184. %{SOURCE rc.bind} \
  185. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  186. # install a reasonable default configuration
  187. %{l_shtool} mkdir -f -p -m 755 \
  188. $RPM_BUILD_ROOT%{l_prefix}/etc/bind
  189. %{l_shtool} install -c -m 644 -e 's;@l_prefix@;%{l_prefix};g' \
  190. %{SOURCE named.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/bind/
  191. %{l_shtool} install -c -m 644 -e 's;@l_prefix@;%{l_prefix};g' \
  192. %{SOURCE rndc.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/bind/
  193. %{l_shtool} mkdir -f -p -m 755 \
  194. $RPM_BUILD_ROOT%{l_prefix}/etc/bind/named.db
  195. %{l_shtool} install -c -m 644 \
  196. %{SOURCE db.localhost} \
  197. %{SOURCE db.localhost.ipv4} \
  198. %{SOURCE db.localhost.ipv6} \
  199. %{SOURCE db.root} \
  200. %{SOURCE db.root.sh} \
  201. $RPM_BUILD_ROOT%{l_prefix}/etc/bind/named.db/
  202. # create an empty var directory
  203. %{l_shtool} mkdir -f -p -m 755 \
  204. $RPM_BUILD_ROOT%{l_prefix}/var/bind
  205. # determine the installed files
  206. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  207. %{l_files_std} \
  208. '%config %{l_prefix}/etc/bind/*.conf' \
  209. '%config %{l_prefix}/etc/bind/named.db/*' \
  210. '%dir %attr(-,root,%{l_mgrp}) %{l_prefix}/var/bind'
  211. %files -f files
  212. %clean
  213. rm -rf $RPM_BUILD_ROOT
  214. %post
  215. if [ $1 -eq 1 ]; then
  216. # generate local rndc key
  217. ( echo "Generating RSA key for RNDC operation in $RPM_INSTALL_PREFIX/etc/bind/rndc.key."
  218. echo "Please be patient, this takes a non-deterministic amount of time."
  219. ) | %{l_rpmtool} msg -b -t notice
  220. $RPM_INSTALL_PREFIX/sbin/rndc-confgen -a
  221. chown %{l_musr}:%{l_mgrp} $RPM_INSTALL_PREFIX/etc/bind/rndc.key
  222. elif [ $1 -gt 1 ]; then
  223. # reload daemon
  224. $RPM_INSTALL_PREFIX/sbin/rndc reload >/dev/null 2>&1 || true
  225. fi
  226. %preun
  227. if [ $1 -eq 0 ]; then
  228. # stop daemon
  229. $RPM_INSTALL_PREFIX/sbin/rndc stop >/dev/null 2>&1 || true
  230. # remove dynamically generated files
  231. rm -f $RPM_INSTALL_PREFIX/etc/bind/rndc.key
  232. rm -f $RPM_INSTALL_PREFIX/var/bind/*
  233. fi