pound.spec 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. ##
  2. ## pound.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package information
  24. Name: pound
  25. Summary: HTTP/HTTPS Reverse Proxy
  26. URL: http://www.apsis.ch/pound/
  27. Vendor: APSIS
  28. Packager: OpenPKG Foundation e.V.
  29. Distribution: OpenPKG Community
  30. Class: EVAL
  31. Group: Web
  32. License: GPL
  33. Version: 2.4
  34. Release: 20080211
  35. # package options
  36. %option with_fsl yes
  37. # list of sources
  38. Source0: http://www.apsis.ch/pound/Pound-%{version}.tgz
  39. Source1: pound.cfg
  40. Source2: pound.pem
  41. Source3: rc.pound
  42. Source4: fsl.pound
  43. Patch0: pound.patch
  44. # build information
  45. Prefix: %{l_prefix}
  46. BuildRoot: %{l_buildroot}
  47. BuildPreReq: OpenPKG, openpkg >= 20060823
  48. PreReq: OpenPKG, openpkg >= 20060823
  49. BuildPreReq: pcre, openssl, openssl::with_threads = yes
  50. PreReq: pcre, openssl, openssl::with_threads = yes
  51. BuildPreReq: pth, pth::with_pthread = yes
  52. PreReq: pth, pth::with_pthread = yes
  53. %if "%{with_fsl}" == "yes"
  54. BuildPreReq: fsl
  55. PreReq: fsl
  56. %endif
  57. AutoReq: no
  58. AutoReqProv: no
  59. %description
  60. The Pound program is a reverse proxy, load balancer and HTTPS
  61. front-end for Web server(s). Pound was developed to enable
  62. distributing the load among several Web-servers and to allow for a
  63. convenient SSL wrapper for those Web servers that do not offer it
  64. natively.
  65. %track
  66. prog pound = {
  67. version = %{version}
  68. url = http://www.apsis.ch/pound/
  69. regex = Pound-(\d+(\.\d+)+)\.tgz
  70. }
  71. %prep
  72. %setup -q -n Pound-%{version}
  73. %patch -p0
  74. # force to use PCRE instead of vendor regex(3)
  75. %{l_shtool} subst \
  76. -e 's;regex\.h;pcreposix.h;' \
  77. -e 's;HAVE_REGEX_H;HAVE_PCREPOSIX_H;' \
  78. configure
  79. %{l_shtool} subst \
  80. -e 's;HAVE_REGEX_H;HAVE_PCREPOSIX_H;' \
  81. config.h.in
  82. %{l_shtool} subst \
  83. -e 's;HAVE_REGEX_H;HAVE_PCREPOSIX_H;' \
  84. -e 's;<regex\.h>;<pcreposix.h>;' \
  85. pound.h
  86. # adjust hard-coded paths
  87. %{l_shtool} subst \
  88. -e 's;/usr/local/etc/pound/pound.cfg;%{l_prefix}/etc/pound/pound.cfg;' \
  89. -e 's;/var/run/pound.pid;%{l_prefix}/var/pound/pound.pid;' \
  90. Makefile.in pound.8 pound.c pound.h
  91. %build
  92. # configure package
  93. CC="%{l_cc}" \
  94. CFLAGS="%{l_cflags -O} `%{l_prefix}/bin/pthread-config --all --cflags`" \
  95. LDFLAGS="%{l_ldflags} `%{l_prefix}/bin/pthread-config --all --ldflags`" \
  96. LIBS="`%{l_prefix}/bin/pthread-config --all --libs` %{l_fsl_libs} -lpcreposix -lpcre" \
  97. ./configure \
  98. --prefix=%{l_prefix} \
  99. --sysconfdir=%{l_prefix}/etc/pound \
  100. --with-ssl=%{l_prefix}
  101. # build package
  102. %{l_make} %{l_mflags -O}
  103. %install
  104. rm -rf $RPM_BUILD_ROOT
  105. # create installation hierarchy
  106. %{l_shtool} mkdir -f -p -m 755 \
  107. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  108. $RPM_BUILD_ROOT%{l_prefix}/etc/pound \
  109. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  110. $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
  111. $RPM_BUILD_ROOT%{l_prefix}/var/pound
  112. # install program and manual page
  113. %{l_shtool} install -c -s -m 755 \
  114. pound poundctl $RPM_BUILD_ROOT%{l_prefix}/sbin/
  115. %{l_shtool} install -c -m 644 \
  116. pound.8 poundctl.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
  117. # install default configuration
  118. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  119. %{SOURCE pound.cfg} $RPM_BUILD_ROOT%{l_prefix}/etc/pound/
  120. %{l_shtool} install -c -m 644 \
  121. %{SOURCE pound.pem} $RPM_BUILD_ROOT%{l_prefix}/etc/pound/
  122. # install run-command script
  123. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  124. %{SOURCE rc.pound} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  125. # install OSSP fsl configuration
  126. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  127. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  128. %{SOURCE fsl.pound} \
  129. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  130. # determine installation files
  131. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  132. %{l_files_std} \
  133. '%config %{l_prefix}/etc/fsl/fsl.pound' \
  134. '%config %{l_prefix}/etc/pound/*'
  135. %files -f files
  136. %clean
  137. rm -rf $RPM_BUILD_ROOT
  138. %post
  139. # after upgrade, restart service
  140. [ $1 -eq 2 ] || exit 0
  141. eval `%{l_rc} pound status 2>/dev/null`
  142. [ ".$pound_active" = .yes ] && %{l_rc} pound restart
  143. exit 0
  144. %preun
  145. # before erase, stop service and remove log files
  146. [ $1 -eq 0 ] || exit 0
  147. %{l_rc} pound stop 2>/dev/null
  148. rm -f $RPM_INSTALL_PREFIX/var/pound/*.log* >/dev/null 2>&1 || true
  149. exit 0