inn.spec 9.1 KB

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