inn.spec 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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: 20020730
  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. %{l_shtool} subst \
  100. -e 's;\(ExtUtils::Embed.*ldopts.*tail -1\);\1 | sed -e "s/ -lc/ /";' \
  101. configure
  102. # configure the source tree
  103. CC="%{l_cc}" \
  104. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include/db3 -I%{l_prefix}/include" \
  105. %if "%{with_fsl}" == "yes"
  106. LDFLAGS="`%{l_prefix}/bin/fsl-config --ldflags --all`" \
  107. LIBS="`%{l_prefix}/bin/fsl-config --libs --all`" \
  108. %else
  109. LDFLAGS="-L$fakesyslogdir -L%{l_prefix}/lib" \
  110. LIBS="-lfakesyslog" \
  111. %endif
  112. ./configure \
  113. --prefix=%{l_prefix} \
  114. --bindir=%{l_prefix}/libexec/inn \
  115. --with-etc-dir=%{l_prefix}/etc/inn \
  116. --with-db-dir=%{l_prefix}/var/inn/db \
  117. --with-control-dir=%{l_prefix}/libexec/inn/control \
  118. --with-filter-dir=%{l_prefix}/libexec/inn/filter \
  119. --with-lib-dir=%{l_prefix}/lib/inn \
  120. --with-log-dir=%{l_prefix}/var/inn/log \
  121. --with-run-dir=%{l_prefix}/var/inn/run \
  122. --with-spool-dir=%{l_prefix}/var/inn/spool \
  123. --with-tmp-path=%{l_prefix}/var/inn/tmp \
  124. --with-openssl=%{l_prefix} \
  125. --with-berkeleydb=%{l_prefix} \
  126. --with-news-user=%{l_musr} \
  127. --with-news-group=%{l_musr} \
  128. --with-news-master=%{l_musr} \
  129. --with-sendmail=%{l_prefix}/sbin/sendmail \
  130. --enable-uucp-rnews \
  131. --with-perl
  132. # build the INN system
  133. %{l_make} %{l_mflags}
  134. %install
  135. rm -rf $RPM_BUILD_ROOT
  136. # install INN
  137. ( cd inn-%{V_inn}
  138. # determine current user and group
  139. thisuser=`%{l_shtool} echo -e '%u'`
  140. thisgroup=`%{l_shtool} echo -e '%g'`
  141. if [ ".$thisgroup" = . ]; then
  142. thisgroup="$thisuser"
  143. fi
  144. # adjust INN installation procedure
  145. %{l_shtool} subst \
  146. -e "s;^\\(prefix.*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  147. -e "s;^\\(PATH.*=[ ]*\\)\\(%{l_prefix}\\);\\1 $RPM_BUILD_ROOT\\2;" \
  148. -e "s;^\\(NEWSUSER.*=\\).*;\\1 $thisuser;" \
  149. -e "s;^\\(NEWSGROUP.*=\\).*;\\1 $thisgroup;" \
  150. -e "s;^\\(OWNER.*=\\).*;\\1;" \
  151. -e "s;^\\(ROWNER.*=\\).*;\\1;" \
  152. Makefile.global
  153. # perform installation procedure
  154. %{l_make} %{l_mflags} install
  155. # make some programs manually accessible
  156. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/bin/
  157. for bin in controlbatch controlchan news2mail startinnfeed overchan \
  158. archive innmail innconfval ctlinnd inews rnews nntpsend; do
  159. ln $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/$bin \
  160. $RPM_BUILD_ROOT%{l_prefix}/bin/$bin
  161. done
  162. # strip installation
  163. rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/filter/*.py
  164. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/inn/*.tcl
  165. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/inn/lib*.a
  166. rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/ovdb_upgrade
  167. ln $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/ovdb_recover \
  168. $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/ovdb_upgrade
  169. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  170. # adjust configuration
  171. ( echo ''
  172. echo '# dummy entry to make INN happy as long as'
  173. echo '# this server has no real newsfeeds configured.'
  174. echo 'dummy-feed:!*::'
  175. echo ''
  176. ) >>$RPM_BUILD_ROOT%{l_prefix}/etc/inn/newsfeeds
  177. ( echo ''
  178. echo '# use the traditional spool area for storage'
  179. echo 'method tradspool {'
  180. echo ' newsgroups: *'
  181. echo ' class: 1'
  182. echo '}'
  183. ) >>$RPM_BUILD_ROOT%{l_prefix}/etc/inn/storage.conf
  184. # create initial history database
  185. ( cd $RPM_BUILD_ROOT%{l_prefix}/var/inn/db
  186. touch history
  187. INNCONF=$RPM_BUILD_ROOT%{l_prefix}/etc/inn/inn.conf \
  188. $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/makedbz -i -f ./history
  189. chmod 644 history*
  190. )
  191. # adjust permissions
  192. chmod 664 $RPM_BUILD_ROOT%{l_prefix}/var/inn/db/active
  193. # create empty logfiles
  194. touch $RPM_BUILD_ROOT%{l_prefix}/var/inn/log/news.log
  195. # install run-command script
  196. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  197. %{l_shtool} install -c -m 755 \
  198. -e 's;@l_prefix@;%{l_prefix};g' \
  199. -e 's;@l_musr@;%{l_musr};g' \
  200. -e 's;@l_mgrp@;%{l_mgrp};g' \
  201. %{SOURCE rc.inn} \
  202. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  203. # optional OSSP fsl support
  204. %if "%{with_fsl}" == "yes"
  205. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  206. %{l_shtool} install -c -m 644 \
  207. -e 's;@l_prefix@;%{l_prefix};g' \
  208. %{SOURCE fsl.inn} \
  209. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  210. %endif
  211. )
  212. # install cleanfeed
  213. ( cd cleanfeed-%{V_cleanfeed}
  214. %{l_shtool} subst \
  215. -e 's;^\($config_dir.*=\).*;\1 "%{l_prefix}/etc/inn"\;;' \
  216. cleanfeed
  217. ( echo "#!%{l_prefix}/bin/perl"
  218. cat cleanfeed
  219. ) >filter_innd.pl
  220. # FIXME: provide a suitable default config
  221. cp cleanfeed.local.sample cleanfeed.local
  222. %{l_shtool} install -c -m 755 \
  223. filter_innd.pl \
  224. $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/filter/
  225. %{l_shtool} install -c -m 644 \
  226. cleanfeed.local \
  227. $RPM_BUILD_ROOT%{l_prefix}/etc/inn/
  228. )
  229. # strip binaries
  230. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2> /dev/null || true
  231. strip $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/* 2> /dev/null || true
  232. # determine file list
  233. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  234. %{l_files_std} \
  235. '%config %{l_prefix}/etc/inn/*' \
  236. %if "%{with_fsl}" == "yes"
  237. '%config %{l_prefix}/etc/fsl/fsl.inn' \
  238. %endif
  239. '%attr(4550,root,%{l_mgrp}) %{l_prefix}/bin/rnews' \
  240. '%attr(4755,root,%{l_mgrp}) %{l_prefix}/libexec/inn/inndstart' \
  241. '%attr(4755,root,%{l_mgrp}) %{l_prefix}/libexec/inn/startinnfeed' \
  242. '%config %{l_prefix}/var/inn/db/*'
  243. %files -f files
  244. %clean
  245. rm -rf $RPM_BUILD_ROOT