portfwd.spec 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. ##
  2. ## portfwd.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2005 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2005 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: portfwd
  26. Summary: TCP/UDP Port Forwarding Daemon
  27. URL: http://portfwd.sourceforge.net/
  28. Vendor: Everton da Silva Marques
  29. Packager: OpenPKG
  30. Distribution: OpenPKG
  31. Class: PLUS
  32. Group: Network
  33. License: GPL
  34. Version: 0.28
  35. Release: 20050703
  36. # package options
  37. %option with_fsl yes
  38. # list of sources
  39. Source0: http://osdn.dl.sourceforge.net/sourceforge/portfwd/portfwd-%{version}.tar.gz
  40. Source1: portfwd.cfg
  41. Source2: rc.portfwd
  42. Source3: fsl.portfwd
  43. Patch0: portfwd.patch
  44. # build information
  45. Prefix: %{l_prefix}
  46. BuildRoot: %{l_buildroot}
  47. BuildPreReq: OpenPKG, openpkg >= 20040130, gcc, make, flex
  48. PreReq: OpenPKG, openpkg >= 20040130
  49. %if "%{with_fsl}" == "yes"
  50. BuildPreReq: fsl >= 1.2.0
  51. PreReq: fsl >= 1.2.0
  52. %endif
  53. AutoReq: no
  54. AutoReqProv: no
  55. %description
  56. Portfwd is a port forwarding daemon which forwards incoming TCP
  57. connections and/or UDP datagrams to remote hosts. There is support
  58. for FTP forwarding, transparent proxy, DNS on demand, simple
  59. round-robin load-balacing, external destination selectors and other
  60. minor features.
  61. %track
  62. prog portfwd = {
  63. version = %{version}
  64. url = http://prdownloads.sourceforge.net/portfwd/
  65. regex = portfwd-(__VER__)\.tar\.gz
  66. }
  67. %prep
  68. %setup -q
  69. %patch -p0
  70. # patch source tree
  71. %{l_shtool} subst \
  72. -e 's;\(AUTOMAKE\)=.*;\1=true;' \
  73. -e 's;\(AUTOCONF\)=.*;\1=true;' \
  74. -e 's;\(AUTOHEADER\)=.*;\1=true;' \
  75. -e 's;\(ACLOCAL\)=.*;\1=true;' \
  76. -e 's;\(MAKEINFO\)=.*;\1=true;' \
  77. configure
  78. %build
  79. # configure package
  80. cppflags=""
  81. case "%{l_platform -t}" in
  82. *-sunos5.6 ) cppflags="-Dsocklen_t=int" ;;
  83. esac
  84. CC="%{l_cc}" \
  85. CXX="%{l_cxx}" \
  86. CFLAGS="%{l_cflags -O}" \
  87. CXXFLAGS="%{l_cxxflags -O}" \
  88. CPPFLAGS="%{l_cppflags} $cppflags" \
  89. LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
  90. LIBS="%{l_fsl_libs}" \
  91. ./configure \
  92. --prefix=%{l_prefix} \
  93. --sysconfdir=%{l_prefix}/etc/portfwd
  94. # build package
  95. %{l_make} %{l_mflags -O}
  96. %install
  97. rm -rf $RPM_BUILD_ROOT
  98. # create installation hierarchy
  99. %{l_shtool} mkdir -f -p -m 755 \
  100. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  101. $RPM_BUILD_ROOT%{l_prefix}/etc/portfwd \
  102. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  103. $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
  104. $RPM_BUILD_ROOT%{l_prefix}/man/man5 \
  105. $RPM_BUILD_ROOT%{l_prefix}/var/portfwd
  106. # install program and manual page
  107. %{l_shtool} install -c -s -m 755 \
  108. src/portfwd $RPM_BUILD_ROOT%{l_prefix}/sbin/
  109. %{l_shtool} install -c -m 644 \
  110. doc/portfwd.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
  111. %{l_shtool} install -c -m 644 \
  112. -e 's;conf\.txt;portfwd.txt;g' \
  113. doc/portfwd.cfg.5 $RPM_BUILD_ROOT%{l_prefix}/man/man5/
  114. # install default configuration and configuration grammar summary
  115. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  116. %{SOURCE portfwd.cfg} $RPM_BUILD_ROOT%{l_prefix}/etc/portfwd/
  117. %{l_shtool} install -c -m 644 \
  118. doc/conf.txt $RPM_BUILD_ROOT%{l_prefix}/etc/portfwd/portfwd.txt
  119. # install run-command script
  120. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  121. %{SOURCE rc.portfwd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  122. # install OSSP fsl configuration
  123. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  124. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  125. %{SOURCE fsl.portfwd} $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  126. # determine installation files
  127. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  128. %{l_files_std} \
  129. '%not %dir %{l_prefix}/etc/fsl' \
  130. '%config %{l_prefix}/etc/fsl/fsl.portfwd' \
  131. '%config %{l_prefix}/etc/portfwd/portfwd.cfg'
  132. %files -f files
  133. %clean
  134. rm -rf $RPM_BUILD_ROOT
  135. %pre
  136. # before upgrade, save status and stop service
  137. [ $1 -eq 2 ] || exit 0
  138. eval `%{l_rc} portfwd status 2>/dev/null | tee %{l_tmpfile}`
  139. %{l_rc} portfwd stop 2>/dev/null
  140. exit 0
  141. %post
  142. if [ $1 -eq 2 ]; then
  143. # after upgrade, restore status
  144. eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
  145. [ ".$portfwd_active" = .yes ] && %{l_rc} portfwd start
  146. fi
  147. exit 0
  148. %preun
  149. # before erase, stop service and remove log files
  150. [ $1 -eq 0 ] || exit 0
  151. %{l_rc} portfwd stop 2>/dev/null
  152. rm -f $RPM_INSTALL_PREFIX/var/portfwd/*.log* >/dev/null 2>&1 || true
  153. exit 0