inn.spec 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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_base 2.3.2
  27. %define V_snap 20020323
  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 [REL]
  35. Group: News
  36. License: ISC
  37. Version: %{V_base}.%{V_snap}
  38. Release: 20020324
  39. # list of sources
  40. Source0: ftp://ftp.isc.org/isc/inn/snapshots/inn-STABLE-%{V_snap}.tar.gz
  41. Source1: ftp://ftp.openpkg.org/DST/inn/fakesyslog.tar.gz
  42. Source2: rc.inn
  43. # build information
  44. Prefix: %{l_prefix}
  45. BuildRoot: %{l_buildroot}
  46. BuildPreReq: OpenPKG, openpkg >= 20020206, make, perl, db3, openssl, bison, flex
  47. PreReq: OpenPKG, openpkg >= 20020206, perl, MTA
  48. AutoReq: no
  49. AutoReqProv: no
  50. %description
  51. InterNetNews (INN) is a complete Usenet system. It includes innd, an
  52. NNTP server, and nnrpd, a newsreading server. INN separates hosts
  53. that feed you news from those that have users reading news. This
  54. version of INN is a snapshot version taken at %{V_snap} from the
  55. STABLE branch of INN. It consists of version %{V_base} with all
  56. latest bugfixes applied.
  57. %prep
  58. %setup0 -q -c
  59. %setup1 -q -T -D -a 1
  60. %build
  61. # make sure INN finds our own files
  62. PATH="%{l_prefix}/bin:$PATH"
  63. export PATH
  64. # build faked syslog(3) library
  65. fakesyslogdir="`pwd`/fakesyslog"
  66. ( cd fakesyslog
  67. CC="%{l_cc}" \
  68. CFLAGS="%{l_cflags -O}" \
  69. ./configure \
  70. --with-logfile=%{l_prefix}/var/inn/log/news.log
  71. %{l_make} %{l_mflags}
  72. )
  73. cd inn-STABLE-%{V_snap}
  74. # adjust some too strange INN paths
  75. %{l_shtool} subst \
  76. -e "s;^\\(PATHBIN.*=\\).*;\\1 \$(PATHNEWS)/libexec/inn;" \
  77. Makefile.global.in
  78. %{l_shtool} subst \
  79. -e "s;^\\(pathbin:.*\\)@prefix@.*;\\1@prefix@/libexec/inn;" \
  80. samples/inn.conf.in
  81. %{l_shtool} subst \
  82. -e "s;BERKELEY_DB_DIR/include;BERKELEY_DB_DIR/include/db3;" \
  83. -e "s;-ldb;-ldb3;" \
  84. configure
  85. # configure the source tree
  86. CC="%{l_cc}" \
  87. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include/db3 -I%{l_prefix}/include" \
  88. LDFLAGS="-L$fakesyslogdir -L%{l_prefix}/lib" \
  89. LIBS="-lfakesyslog" \
  90. ./configure \
  91. --prefix=%{l_prefix} \
  92. --bindir=%{l_prefix}/libexec/inn \
  93. --with-etc-dir=%{l_prefix}/etc/inn \
  94. --with-db-dir=%{l_prefix}/var/inn/db \
  95. --with-control-dir=%{l_prefix}/libexec/inn/control \
  96. --with-filter-dir=%{l_prefix}/libexec/inn/filter \
  97. --with-lib-dir=%{l_prefix}/lib/inn \
  98. --with-log-dir=%{l_prefix}/var/inn/log \
  99. --with-run-dir=%{l_prefix}/var/inn/run \
  100. --with-spool-dir=%{l_prefix}/var/inn/spool \
  101. --with-tmp-path=%{l_prefix}/var/inn/tmp \
  102. --with-openssl=%{l_prefix} \
  103. --with-berkeleydb=%{l_prefix} \
  104. --with-news-user=%{l_musr} \
  105. --with-news-group=%{l_musr} \
  106. --with-news-master=%{l_musr} \
  107. --with-sendmail=%{l_prefix}/sbin/sendmail \
  108. --enable-uucp-rnews \
  109. --with-perl
  110. # build the INN system
  111. %{l_make} %{l_mflags}
  112. %install
  113. rm -rf $RPM_BUILD_ROOT
  114. cd inn-STABLE-%{V_snap}
  115. # determine current user and group
  116. thisuser=`(id -un) 2>/dev/null ||\
  117. (whoami) 2>/dev/null ||\
  118. (who am i | cut "-d " -f1) 2>/dev/null ||\
  119. echo $LOGNAME`
  120. thisgroup=`(cat /etc/passwd; ypcat passwd) 2>/dev/null |\
  121. grep "^${thisuser}:" | awk -F: '{ print $4; }' | head -1`
  122. thisgroup=`(cat /etc/group; ypcat group) 2>/dev/null |\
  123. grep ":${thisgroup}:" | awk -F: '{ print $1; }' | head -1`
  124. if [ ".$thisgroup" = . ]; then
  125. thisgroup="$thisuser"
  126. fi
  127. # adjust INN installation procedure
  128. %{l_shtool} subst \
  129. -e "s;^\\(prefix.*=\\).*;\\1 $RPM_BUILD_ROOT%{l_prefix};" \
  130. -e "s;^\\(PATH.*=[ ]*\\)\\(%{l_prefix}\\);\\1 $RPM_BUILD_ROOT\\2;" \
  131. -e "s;^\\(NEWSUSER.*=\\).*;\\1 $thisuser;" \
  132. -e "s;^\\(NEWSGROUP.*=\\).*;\\1 $thisgroup;" \
  133. -e "s;^\\(OWNER.*=\\).*;\\1;" \
  134. -e "s;^\\(ROWNER.*=\\).*;\\1;" \
  135. Makefile.global
  136. # perform installation procedure
  137. %{l_make} %{l_mflags} install
  138. # make some programs manually accessible
  139. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/bin/
  140. for bin in controlbatch controlchan news2mail startinnfeed overchan \
  141. archive innmail innconfval ctlinnd inews rnews nntpsend; do
  142. ln $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/$bin \
  143. $RPM_BUILD_ROOT%{l_prefix}/bin/$bin
  144. done
  145. # strip installation
  146. rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/filter/*.py
  147. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/inn/*.tcl
  148. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/inn/lib*.a
  149. rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/ovdb_upgrade
  150. ln $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/ovdb_recover \
  151. $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/ovdb_upgrade
  152. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  153. # adjust configuration
  154. ( echo ''
  155. echo '# dummy entry to make INN happy as long as'
  156. echo '# this server has no real newsfeeds configured.'
  157. echo 'dummy-feed:!*::'
  158. echo ''
  159. ) >>$RPM_BUILD_ROOT%{l_prefix}/etc/inn/newsfeeds
  160. ( echo ''
  161. echo '# use the traditional spool area for storage'
  162. echo 'method tradspool {'
  163. echo ' newsgroups: *'
  164. echo ' class: 1'
  165. echo '}'
  166. ) >>$RPM_BUILD_ROOT%{l_prefix}/etc/inn/storage.conf
  167. # create initial history database
  168. ( cd $RPM_BUILD_ROOT%{l_prefix}/var/inn/db
  169. touch history
  170. INNCONF=$RPM_BUILD_ROOT%{l_prefix}/etc/inn/inn.conf \
  171. $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/makedbz -i -f ./history
  172. chmod 644 history*
  173. )
  174. # adjust permissions
  175. chmod 664 $RPM_BUILD_ROOT%{l_prefix}/var/inn/db/active
  176. # create empty logfiles
  177. touch $RPM_BUILD_ROOT%{l_prefix}/var/inn/log/news.log
  178. # install run-command script
  179. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  180. %{l_shtool} install -c -m 755 \
  181. -e 's;@l_prefix@;%{l_prefix};g' \
  182. -e 's;@l_musr@;%{l_musr};g' \
  183. -e 's;@l_mgrp@;%{l_mgrp};g' \
  184. %{SOURCE rc.inn} \
  185. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  186. # strip binaries
  187. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2> /dev/null || true
  188. strip $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/* 2> /dev/null || true
  189. # determine file list
  190. %{l_rpmtool} files -v -o../files -r$RPM_BUILD_ROOT \
  191. %{l_files_std} \
  192. '%config %{l_prefix}/etc/inn/*' \
  193. '%attr(4550,root,%{l_mgrp}) %{l_prefix}/bin/rnews' \
  194. '%attr(4755,root,%{l_mgrp}) %{l_prefix}/libexec/inn/inndstart' \
  195. '%attr(4755,root,%{l_mgrp}) %{l_prefix}/libexec/inn/startinnfeed' \
  196. '%config %{l_prefix}/var/inn/db/*'
  197. %files -f files
  198. %clean
  199. rm -rf $RPM_BUILD_ROOT