powerdns.spec 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. ##
  2. ## powerdns.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2003 Cable & Wireless <http://www.cw.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 information
  26. Name: powerdns
  27. Summary: PowerDNS high performance authoritative-only name server
  28. URL: http://www.powerdns.com/products/powerdns/
  29. Vendor: PowerDNS.COM BV
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG [EVAL]
  32. Group: DNS
  33. License: GPL
  34. Version: 2.9.11
  35. Release: 20031009
  36. # package options
  37. %option with_fsl yes
  38. %option with_pipe no
  39. %option with_mysql no
  40. %option with_pgsql no
  41. # list of sources
  42. Source0: http://downloads.powerdns.com/releases/pdns-%{version}.tar.gz
  43. Source1: rc.powerdns
  44. Source2: fsl.powerdns
  45. Source3: powerdnssetup
  46. Patch0: powerdns.patch
  47. # build information
  48. Prefix: %{l_prefix}
  49. BuildRoot: %{l_buildroot}
  50. BuildPreReq: OpenPKG, openpkg >= 20030718
  51. PreReq: OpenPKG, openpkg >= 20030718
  52. %if "%{with_fsl}" == "yes"
  53. BuildPreReq: fsl >= 1.3.0
  54. PreReq: fsl >= 1.3.0
  55. %endif
  56. %if "%{with_mysql}" == "yes"
  57. BuildPreReq: mysql
  58. PreReq: mysql
  59. %endif
  60. %if "%{with_pgsql}" == "yes"
  61. BuildPreReq: postgresql, postgresql::with_cxx = yes
  62. PreReq: postgresql, postgresql::with_cxx = yes
  63. %endif
  64. AutoReq: no
  65. AutoReqProv: no
  66. Conflicts: bind, bind8
  67. %description
  68. The PowerDNS name server is a modern, advanced and high
  69. performance authoritative-only nameserver. It is written
  70. from scratch in ISO C++ and conforms to all the relevant
  71. DNS standards documents. The PowerDNS name server utilizes
  72. a flexible backend architecture which can access DNS
  73. information from any data source. This includes many file
  74. formats, Bind zone files, or LDAP directories. PowerDNS
  75. can connect directly to a relational database as well, and
  76. benefit from immediate zone updates on any changes to the
  77. database (no traditional reloading is needed). Lastly, a
  78. Backend Developers Kit exists to negotiate between
  79. PowerDNS and your data or logic.
  80. %prep
  81. %setup -q -n pdns-%{version}
  82. %patch -p1
  83. %{l_shtool} subst \
  84. -e 's;\([^a-zA-Z0-9]\)PC\([^a-zA-Z0-9]\);\1PCa\2;g' \
  85. pdns/packethandler.cc \
  86. pdns/tcpreceiver.cc \
  87. pdns/ueberbackend.cc \
  88. pdns/dynhandler.cc \
  89. pdns/dnsproxy.cc \
  90. pdns/common_startup.cc \
  91. pdns/common_startup.hh
  92. %build
  93. MODULES=""
  94. %if "%{with_pipe}" == "yes"
  95. MODULES="$MODULES pipe"
  96. %endif
  97. %if "%{with_mysql}" == "yes"
  98. MODULES="$MODULES gmysql"
  99. %endif
  100. %if "%{with_pgsql}" == "yes"
  101. MODULES="$MODULES gpgsql"
  102. %endif
  103. MODULES=`echo "$MODULES" | sed 's;^ ;;'`
  104. CC="%{l_cc}" \
  105. CXX="%{l_cxx}" \
  106. CFLAGS="%{l_cflags -O}" \
  107. CXXFLAGS="%{l_cxxflags -O}" \
  108. CPPFLAGS="%{l_cppflags}" \
  109. LDFLAGS="%{l_fsl_ldflags}" \
  110. ./configure \
  111. --prefix=%{l_prefix} \
  112. --sysconfdir=%{l_prefix}/etc/powerdns \
  113. %if "%{with_mysql}" == "yes"
  114. --enable-mysql \
  115. --with-mysql=%{l_prefix} \
  116. %else
  117. --disable-mysql \
  118. %endif
  119. %if "%{with_pgsql}" == "yes"
  120. --enable-pgsql \
  121. --with-pgsql=%{l_prefix} \
  122. --with-pgsql-includes=%{l_prefix}/include/libpq++ \
  123. --with-pgsql-lib=%{l_prefix}/lib \
  124. %else
  125. --disable-pgsql \
  126. %endif
  127. --with-modules="$MODULES" \
  128. --with-dynmodules="" \
  129. --disable-shared
  130. %{l_make} %{l_mflags -O} LDADD="%{l_fsl_libs}"
  131. %install
  132. rm -rf $RPM_BUILD_ROOT
  133. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/var/powerdns
  134. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  135. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  136. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  137. # clean up installation
  138. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib
  139. # setup config file
  140. mv $RPM_BUILD_ROOT%{l_prefix}/etc/powerdns/pdns.conf-dist \
  141. $RPM_BUILD_ROOT%{l_prefix}/etc/powerdns/pdns.conf
  142. %{l_shtool} subst %{l_value -s -a} \
  143. $RPM_BUILD_ROOT%{l_prefix}/etc/powerdns/pdns.conf
  144. # provide some reasonable default configuration values
  145. %{l_shtool} subst \
  146. -e 's;# \(daemon=\)no;\1yes;' \
  147. -e 's;# \(launch=\);\1bind;' \
  148. -e 's;# \(local-address=\)0.0.0.0;\1127.0.0.1;' \
  149. -e 's;# \(logfile=\)pdns.log;\1%{l_prefix}/var/powerdns/pdns.log;' \
  150. -e 's;# \(setgid=\);\1%{l_mgid};' \
  151. -e 's;# \(setuid=\);\1%{l_muid};' \
  152. -e 's;# \(socket-dir=\)/var/run;\1%{l_prefix}/var/powerdns;' \
  153. -e 's;# \(use-logfile=\)no;\1yes;' \
  154. $RPM_BUILD_ROOT%{l_prefix}/etc/powerdns/pdns.conf
  155. # install run-command script
  156. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  157. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  158. %{SOURCE rc.powerdns} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  159. # install setup script
  160. %{l_shtool} install -c -m 755 \
  161. %{SOURCE powerdnssetup} $RPM_BUILD_ROOT%{l_prefix}/sbin/
  162. # install OSSP fsl configuration
  163. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  164. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  165. %{SOURCE fsl.powerdns} \
  166. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  167. # determine installation files
  168. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  169. %{l_files_std} \
  170. '%not %dir %{l_prefix}/etc/fsl' \
  171. '%config %{l_prefix}/etc/fsl/fsl.powerdns' \
  172. '%dir %attr(0775,%{l_susr},%{l_mgrp}) %{l_prefix}/var/powerdns' \
  173. '%dir %attr(0700,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/powerdns' \
  174. '%config %attr(0600,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/powerdns/*'
  175. %files -f files
  176. %clean
  177. rm -rf $RPM_BUILD_ROOT
  178. %post
  179. # after upgrade, restart service
  180. [ $1 -eq 2 ] || exit 0
  181. eval `%{l_rc} powerdns status 2>/dev/null`
  182. [ ".$powerdns_active" = .yes ] && %{l_rc} powerdns restart
  183. exit 0
  184. %preun
  185. # before erase, stop service and remove log files
  186. [ $1 -eq 0 ] || exit 0
  187. %{l_rc} powerdns stop 2>/dev/null
  188. rm -f $RPM_INSTALL_PREFIX/var/powerdns/*.log* >/dev/null 2>&1 || true
  189. exit 0