inn.spec 8.4 KB

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