inn.spec 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. ##
  2. ## inn.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.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 versions
  26. %define V_inn 2.3.4
  27. %define V_cleanfeed 20010805
  28. # package information
  29. Name: inn
  30. Summary: InterNetNews Usenet Server
  31. URL: http://www.isc.org/products/INN/
  32. Vendor: Internet Software Consortium
  33. Packager: The OpenPKG Project
  34. Distribution: OpenPKG [BASE]
  35. Group: News
  36. License: ISC
  37. Version: %{V_inn}
  38. Release: 20030101
  39. # list of sources
  40. Source0: ftp://ftp.isc.org/isc/inn/inn-%{V_inn}.tar.gz
  41. Source1: http://www.bofh.it/~md/cleanfeed/cleanfeed-%{V_cleanfeed}.tgz
  42. Source2: rc.inn
  43. Source3: fsl.inn
  44. Patch0: inn.patch
  45. # build information
  46. Prefix: %{l_prefix}
  47. BuildRoot: %{l_buildroot}
  48. BuildPreReq: OpenPKG, openpkg >= 20020206, fsl, make, perl, db, openssl, bison, flex
  49. PreReq: OpenPKG, openpkg >= 20020206, fsl, perl, perl-crypto, MTA
  50. AutoReq: no
  51. AutoReqProv: no
  52. %description
  53. InterNetNews (INN) is a complete Usenet system. It includes innd, an
  54. NNTP server, and nnrpd, a newsreading server. INN separates hosts
  55. that feed you news from those that have users reading news.
  56. %prep
  57. %setup0 -q -c
  58. %setup1 -q -T -D -a 1
  59. %patch0 -p0
  60. %build
  61. # build inn
  62. cd inn-%{V_inn}
  63. # adjust some too strange INN paths
  64. %{l_shtool} subst \
  65. -e "s;^\\(PATHBIN.*=\\).*;\\1 \$(PATHNEWS)/libexec/inn;" \
  66. Makefile.global.in
  67. %{l_shtool} subst \
  68. -e "s;^\\(pathbin:.*\\)@prefix@.*;\\1@prefix@/libexec/inn;" \
  69. samples/inn.conf.in
  70. %{l_shtool} subst \
  71. -e 's;\(ExtUtils::Embed.*ldopts.*tail -1\);\1 | sed -e "s/ -lc/ /";' \
  72. configure
  73. # configure the source tree
  74. CC="%{l_cc}" \
  75. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include" \
  76. LDFLAGS="`%{l_prefix}/bin/fsl-config --ldflags --all`" \
  77. LIBS="`%{l_prefix}/bin/fsl-config --libs --all`" \
  78. ./configure \
  79. --prefix=%{l_prefix} \
  80. --bindir=%{l_prefix}/libexec/inn \
  81. --with-etc-dir=%{l_prefix}/etc/inn \
  82. --with-db-dir=%{l_prefix}/var/inn/db \
  83. --with-control-dir=%{l_prefix}/libexec/inn/control \
  84. --with-filter-dir=%{l_prefix}/libexec/inn/filter \
  85. --with-lib-dir=%{l_prefix}/lib/inn \
  86. --with-log-dir=%{l_prefix}/var/inn/log \
  87. --with-run-dir=%{l_prefix}/var/inn/run \
  88. --with-spool-dir=%{l_prefix}/var/inn/spool \
  89. --with-tmp-path=%{l_prefix}/var/inn/tmp \
  90. --with-openssl=%{l_prefix} \
  91. --with-berkeleydb=%{l_prefix} \
  92. --with-news-user=%{l_musr} \
  93. --with-news-group=%{l_musr} \
  94. --with-news-master=%{l_musr} \
  95. --with-sendmail=%{l_prefix}/sbin/sendmail \
  96. --enable-uucp-rnews \
  97. --with-perl
  98. # build the INN system
  99. %{l_make} %{l_mflags}
  100. %install
  101. rm -rf $RPM_BUILD_ROOT
  102. # install INN
  103. ( cd inn-%{V_inn}
  104. # determine current user and group
  105. thisuser=`%{l_shtool} echo -e '%u'`
  106. thisgroup=`%{l_shtool} echo -e '%g'`
  107. if [ ".$thisgroup" = . ]; then
  108. thisgroup="$thisuser"
  109. fi
  110. # adjust INN installation procedure
  111. %{l_shtool} subst \
  112. -e "s;^\\(prefix.*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  113. -e "s;^\\(PATH.*=[ ]*\\)\\(%{l_prefix}\\);\\1 $RPM_BUILD_ROOT\\2;" \
  114. -e "s;^\\(NEWSUSER.*=\\).*;\\1 $thisuser;" \
  115. -e "s;^\\(NEWSGROUP.*=\\).*;\\1 $thisgroup;" \
  116. -e "s;^\\(OWNER.*=\\).*;\\1;" \
  117. -e "s;^\\(ROWNER.*=\\).*;\\1;" \
  118. Makefile.global
  119. # perform installation procedure
  120. %{l_make} %{l_mflags} install
  121. # make some programs manually accessible
  122. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/bin/
  123. for bin in controlbatch controlchan news2mail startinnfeed overchan \
  124. archive innmail innconfval ctlinnd inews rnews nntpsend; do
  125. ln $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/$bin \
  126. $RPM_BUILD_ROOT%{l_prefix}/bin/$bin
  127. done
  128. # strip installation
  129. rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/filter/*.py
  130. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/inn/*.tcl
  131. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/inn/lib*.a
  132. rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/ovdb_upgrade
  133. ln $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/ovdb_recover \
  134. $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/ovdb_upgrade
  135. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  136. # adjust configuration
  137. ( echo ''
  138. echo '# dummy entry to make INN happy as long as'
  139. echo '# this server has no real newsfeeds configured.'
  140. echo 'dummy-feed:!*::'
  141. echo ''
  142. ) >>$RPM_BUILD_ROOT%{l_prefix}/etc/inn/newsfeeds
  143. ( echo ''
  144. echo '# use the traditional spool area for storage'
  145. echo 'method tradspool {'
  146. echo ' newsgroups: *'
  147. echo ' class: 1'
  148. echo '}'
  149. ) >>$RPM_BUILD_ROOT%{l_prefix}/etc/inn/storage.conf
  150. # create initial history database
  151. ( cd $RPM_BUILD_ROOT%{l_prefix}/var/inn/db
  152. touch history
  153. INNCONF=$RPM_BUILD_ROOT%{l_prefix}/etc/inn/inn.conf \
  154. $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/makedbz -i -f ./history
  155. chmod 644 history*
  156. )
  157. # adjust permissions
  158. chmod 664 $RPM_BUILD_ROOT%{l_prefix}/var/inn/db/active
  159. # create empty logfiles
  160. touch $RPM_BUILD_ROOT%{l_prefix}/var/inn/log/news.log
  161. # install run-command script
  162. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  163. %{l_shtool} install -c -m 755 \
  164. -e 's;@l_prefix@;%{l_prefix};g' \
  165. -e 's;@l_musr@;%{l_musr};g' \
  166. -e 's;@l_mgrp@;%{l_mgrp};g' \
  167. %{SOURCE rc.inn} \
  168. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  169. # OSSP fsl support
  170. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  171. %{l_shtool} install -c -m 644 \
  172. -e 's;@l_prefix@;%{l_prefix};g' \
  173. %{SOURCE fsl.inn} \
  174. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  175. )
  176. # install cleanfeed
  177. ( cd cleanfeed-%{V_cleanfeed}
  178. %{l_shtool} subst \
  179. -e 's;^\($config_dir.*=\).*;\1 "%{l_prefix}/etc/inn"\;;' \
  180. cleanfeed
  181. ( echo "#!%{l_prefix}/bin/perl"
  182. cat cleanfeed
  183. ) >filter_innd.pl
  184. # FIXME: provide a suitable default config
  185. cp cleanfeed.local.sample cleanfeed.local
  186. %{l_shtool} install -c -m 755 \
  187. filter_innd.pl \
  188. $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/filter/
  189. %{l_shtool} install -c -m 644 \
  190. cleanfeed.local \
  191. $RPM_BUILD_ROOT%{l_prefix}/etc/inn/
  192. )
  193. # strip binaries
  194. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2> /dev/null || true
  195. strip $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/* 2> /dev/null || true
  196. # determine file list
  197. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  198. %{l_files_std} \
  199. '%config %{l_prefix}/etc/inn/*' \
  200. '%config %{l_prefix}/etc/fsl/fsl.inn' \
  201. '%not %dir %{l_prefix}/etc/fsl' \
  202. '%attr(4550,root,%{l_mgrp}) %{l_prefix}/bin/rnews' \
  203. '%attr(4755,root,%{l_mgrp}) %{l_prefix}/libexec/inn/inndstart' \
  204. '%attr(4755,root,%{l_mgrp}) %{l_prefix}/libexec/inn/startinnfeed' \
  205. '%config %{l_prefix}/var/inn/db/*'
  206. %files -f files
  207. %clean
  208. rm -rf $RPM_BUILD_ROOT