powerdns.spec 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. ##
  2. ## powerdns.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2006 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2006 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package information
  25. Name: powerdns
  26. Summary: High-Performance Authoritative-Only DNS Server
  27. URL: http://www.powerdns.com/products/powerdns/
  28. Vendor: PowerDNS.COM BV
  29. Packager: OpenPKG
  30. Distribution: OpenPKG
  31. Class: EVAL
  32. Group: DNS
  33. License: GPL
  34. Version: 2.9.20
  35. Release: 20060925
  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 >= 20060823, boost
  51. PreReq: OpenPKG, openpkg >= 20060823, boost
  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 performance
  69. authoritative-only nameserver. It is written from scratch in ISO
  70. C++ and conforms to all the relevant DNS standards documents. The
  71. PowerDNS name server utilizes a flexible backend architecture which
  72. can access DNS information from any data source. This includes
  73. many file formats, Bind zone files, or LDAP directories. PowerDNS
  74. can connect directly to a relational database as well, and benefit
  75. from immediate zone updates on any changes to the database (no
  76. traditional reloading is needed). Lastly, a Backend Developers Kit
  77. exists to negotiate between PowerDNS and your data or logic.
  78. %track
  79. prog powerdns = {
  80. version = %{version}
  81. url = http://downloads.powerdns.com/releases/
  82. regex = pdns-(__VER__)\.tar\.gz
  83. }
  84. %prep
  85. %setup -q -n pdns-%{version}
  86. %patch -p0
  87. %{l_shtool} subst \
  88. -e 's;\([^a-zA-Z0-9]\)PC\([^a-zA-Z0-9]\);\1PCa\2;g' \
  89. pdns/communicator.cc \
  90. pdns/packethandler.cc \
  91. pdns/tcpreceiver.cc \
  92. pdns/ueberbackend.cc \
  93. pdns/dynhandler.cc \
  94. pdns/dnsproxy.cc \
  95. pdns/common_startup.cc \
  96. pdns/common_startup.hh
  97. %build
  98. MODULES=""
  99. %if "%{with_pipe}" == "yes"
  100. MODULES="$MODULES pipe"
  101. %endif
  102. %if "%{with_mysql}" == "yes"
  103. MODULES="$MODULES gmysql"
  104. %endif
  105. %if "%{with_pgsql}" == "yes"
  106. MODULES="$MODULES gpgsql"
  107. %endif
  108. MODULES=`echo "$MODULES" | sed 's;^ ;;'`
  109. CC="%{l_cc}" \
  110. CXX="%{l_cxx}" \
  111. CFLAGS="%{l_cflags -O}" \
  112. CXXFLAGS="%{l_cxxflags -O}" \
  113. CPPFLAGS="%{l_cppflags}" \
  114. LDFLAGS="%{l_fsl_ldflags}" \
  115. ./configure \
  116. --prefix=%{l_prefix} \
  117. --sysconfdir=%{l_prefix}/etc/powerdns \
  118. %if "%{with_mysql}" == "yes"
  119. --enable-mysql \
  120. --with-mysql=%{l_prefix} \
  121. %else
  122. --disable-mysql \
  123. %endif
  124. %if "%{with_pgsql}" == "yes"
  125. --enable-pgsql \
  126. --with-pgsql=%{l_prefix} \
  127. --with-pgsql-includes=%{l_prefix}/include/libpq++ \
  128. --with-pgsql-lib=%{l_prefix}/lib \
  129. %else
  130. --disable-pgsql \
  131. %endif
  132. --with-modules="$MODULES" \
  133. --with-dynmodules="" \
  134. --disable-shared
  135. %{l_make} %{l_mflags -O} LDADD="%{l_fsl_libs}"
  136. %install
  137. rm -rf $RPM_BUILD_ROOT
  138. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  139. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  140. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  141. # clean up installation
  142. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib
  143. # setup config file
  144. mv $RPM_BUILD_ROOT%{l_prefix}/etc/powerdns/pdns.conf-dist \
  145. $RPM_BUILD_ROOT%{l_prefix}/etc/powerdns/pdns.conf
  146. %{l_shtool} subst %{l_value -s -a} \
  147. $RPM_BUILD_ROOT%{l_prefix}/etc/powerdns/pdns.conf
  148. # provide some reasonable default configuration values
  149. %{l_shtool} subst \
  150. -e 's;# \(daemon=\)no;\1yes;' \
  151. -e 's;# \(launch=\);\1bind;' \
  152. -e 's;# \(local-address=\)0.0.0.0;\1127.0.0.1;' \
  153. -e 's;# \(logfile=\)pdns.log;\1%{l_prefix}/var/powerdns/log/pdns.log;' \
  154. -e 's;# \(setgid=\);\1%{l_mgid};' \
  155. -e 's;# \(setuid=\);\1%{l_muid};' \
  156. -e 's;# \(socket-dir=\)/var/run;\1%{l_prefix}/var/powerdns;' \
  157. -e 's;# \(use-logfile=\)no;\1yes;' \
  158. $RPM_BUILD_ROOT%{l_prefix}/etc/powerdns/pdns.conf
  159. # install run-command script
  160. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  161. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  162. %{SOURCE rc.powerdns} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  163. # install setup script
  164. %{l_shtool} install -c -m 755 \
  165. %{SOURCE powerdnssetup} $RPM_BUILD_ROOT%{l_prefix}/sbin/
  166. # install OSSP fsl configuration
  167. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  168. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  169. %{SOURCE fsl.powerdns} \
  170. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  171. # create an empty var and log directory
  172. %{l_shtool} mkdir -f -p -m 755 \
  173. $RPM_BUILD_ROOT%{l_prefix}/var/powerdns/log
  174. # determine installation files
  175. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  176. %{l_files_std} \
  177. '%not %dir %{l_prefix}/etc/fsl' \
  178. '%config %{l_prefix}/etc/fsl/fsl.powerdns' \
  179. '%dir %attr(0775,%{l_susr},%{l_mgrp}) %{l_prefix}/var/powerdns' \
  180. '%dir %attr(0775,%{l_susr},%{l_mgrp}) %{l_prefix}/var/powerdns/log' \
  181. '%dir %attr(0700,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/powerdns' \
  182. '%config %attr(0600,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/powerdns/*'
  183. %files -f files
  184. %clean
  185. rm -rf $RPM_BUILD_ROOT
  186. %post
  187. # after upgrade, restart service
  188. [ $1 -eq 2 ] || exit 0
  189. eval `%{l_rc} powerdns status 2>/dev/null`
  190. [ ".$powerdns_active" = .yes ] && %{l_rc} powerdns restart
  191. exit 0
  192. %preun
  193. # before erase, stop service and remove log files
  194. [ $1 -eq 0 ] || exit 0
  195. %{l_rc} powerdns stop 2>/dev/null
  196. rm -f $RPM_INSTALL_PREFIX/var/powerdns/log/* >/dev/null 2>&1 || true
  197. exit 0