pound.spec 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. ##
  2. ## pound.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2007 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: pound
  26. Summary: HTTP/HTTPS Reverse Proxy
  27. URL: http://www.apsis.ch/pound/
  28. Vendor: APSIS
  29. Packager: OpenPKG Foundation e.V.
  30. Distribution: OpenPKG Community
  31. Class: EVAL
  32. Group: Web
  33. License: GPL
  34. Version: 2.2.2
  35. Release: 20070116
  36. # package options
  37. %option with_fsl yes
  38. # list of sources
  39. Source0: http://www.apsis.ch/pound/Pound-%{version}.tgz
  40. Source1: pound.cfg
  41. Source2: pound.pem
  42. Source3: rc.pound
  43. Source4: fsl.pound
  44. Patch0: pound.patch
  45. # build information
  46. Prefix: %{l_prefix}
  47. BuildRoot: %{l_buildroot}
  48. BuildPreReq: OpenPKG, openpkg >= 20060823
  49. PreReq: OpenPKG, openpkg >= 20060823
  50. BuildPreReq: pcre, openssl, openssl::with_threads = yes
  51. PreReq: pcre, openssl, openssl::with_threads = yes
  52. BuildPreReq: pth, pth::with_pthread = yes
  53. PreReq: pth, pth::with_pthread = yes
  54. %if "%{with_fsl}" == "yes"
  55. BuildPreReq: fsl >= 1.3.0
  56. PreReq: fsl >= 1.3.0
  57. %endif
  58. AutoReq: no
  59. AutoReqProv: no
  60. %description
  61. The Pound program is a reverse proxy, load balancer and HTTPS
  62. front-end for Web server(s). Pound was developed to enable
  63. distributing the load among several Web-servers and to allow for a
  64. convenient SSL wrapper for those Web servers that do not offer it
  65. natively.
  66. %track
  67. prog pound = {
  68. version = %{version}
  69. url = http://www.apsis.ch/pound/
  70. regex = Pound-(__VER__)\.tgz
  71. }
  72. %prep
  73. %setup -q -n Pound-%{version}
  74. %patch -p0
  75. # force to use PCRE instead of vendor regex(3)
  76. %{l_shtool} subst \
  77. -e 's;regex\.h;pcreposix.h;' \
  78. -e 's;HAVE_REGEX_H;HAVE_PCREPOSIX_H;' \
  79. configure
  80. %{l_shtool} subst \
  81. -e 's;HAVE_REGEX_H;HAVE_PCREPOSIX_H;' \
  82. config.h.in
  83. %{l_shtool} subst \
  84. -e 's;HAVE_REGEX_H;HAVE_PCREPOSIX_H;' \
  85. -e 's;<regex\.h>;<pcreposix.h>;' \
  86. pound.h
  87. # adjust hard-coded paths
  88. %{l_shtool} subst \
  89. -e 's;/usr/local/etc/pound/pound.cfg;%{l_prefix}/etc/pound/pound.cfg;' \
  90. -e 's;/var/run/pound.pid;%{l_prefix}/var/pound/pound.pid;' \
  91. Makefile.in pound.8 pound.c pound.h
  92. %build
  93. # configure package
  94. CC="%{l_cc}" \
  95. CFLAGS="%{l_cflags -O} `%{l_prefix}/bin/pthread-config --all --cflags`" \
  96. LDFLAGS="%{l_ldflags} `%{l_prefix}/bin/pthread-config --all --ldflags`" \
  97. LIBS="`%{l_prefix}/bin/pthread-config --all --libs` %{l_fsl_libs} -lpcreposix -lpcre" \
  98. ./configure \
  99. --prefix=%{l_prefix} \
  100. --sysconfdir=%{l_prefix}/etc/pound \
  101. --with-ssl=%{l_prefix}
  102. # build package
  103. %{l_make} %{l_mflags -O}
  104. %install
  105. rm -rf $RPM_BUILD_ROOT
  106. # create installation hierarchy
  107. %{l_shtool} mkdir -f -p -m 755 \
  108. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  109. $RPM_BUILD_ROOT%{l_prefix}/etc/pound \
  110. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  111. $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
  112. $RPM_BUILD_ROOT%{l_prefix}/var/pound
  113. # install program and manual page
  114. %{l_shtool} install -c -s -m 755 \
  115. pound poundctl $RPM_BUILD_ROOT%{l_prefix}/sbin/
  116. %{l_shtool} install -c -m 644 \
  117. pound.8 poundctl.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
  118. # install default configuration
  119. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  120. %{SOURCE pound.cfg} $RPM_BUILD_ROOT%{l_prefix}/etc/pound/
  121. %{l_shtool} install -c -m 644 \
  122. %{SOURCE pound.pem} $RPM_BUILD_ROOT%{l_prefix}/etc/pound/
  123. # install run-command script
  124. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  125. %{SOURCE rc.pound} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  126. # install OSSP fsl configuration
  127. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  128. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  129. %{SOURCE fsl.pound} \
  130. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  131. # determine installation files
  132. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  133. %{l_files_std} \
  134. '%not %dir %{l_prefix}/etc/fsl' \
  135. '%config %{l_prefix}/etc/fsl/fsl.pound' \
  136. '%config %{l_prefix}/etc/pound/*'
  137. %files -f files
  138. %clean
  139. rm -rf $RPM_BUILD_ROOT
  140. %post
  141. # after upgrade, restart service
  142. [ $1 -eq 2 ] || exit 0
  143. eval `%{l_rc} pound status 2>/dev/null`
  144. [ ".$pound_active" = .yes ] && %{l_rc} pound restart
  145. exit 0
  146. %preun
  147. # before erase, stop service and remove log files
  148. [ $1 -eq 0 ] || exit 0
  149. %{l_rc} pound stop 2>/dev/null
  150. rm -f $RPM_INSTALL_PREFIX/var/pound/*.log* >/dev/null 2>&1 || true
  151. exit 0