inn.spec 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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. %define V_build stable
  26. %define V_release 2.3.2
  27. %define V_stable 20020306
  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. %if "%{V_build}" == "release"
  38. Version: %{V_release}
  39. %else
  40. Version: %{V_release}.%{V_stable}
  41. %endif
  42. Release: 20020306
  43. # list of sources
  44. Source0: ftp://ftp.openpkg.org/DST/inn/fakesyslog.tar.gz
  45. Source1: ftp://ftp.isc.org/isc/inn/inn-%{V_release}.tar.gz
  46. Source2: ftp://ftp.isc.org/isc/inn/snapshots/inn-STABLE-%{V_stable}.tar.gz
  47. Source3: rc.inn
  48. # build information
  49. Prefix: %{l_prefix}
  50. BuildRoot: %{l_buildroot}
  51. BuildPreReq: OpenPKG, openpkg >= 20020206, make, perl, db3, openssl, bison, flex
  52. PreReq: OpenPKG, openpkg >= 20020206, perl, MTA
  53. AutoReq: no
  54. AutoReqProv: no
  55. %description
  56. InterNetNews (INN) is a complete Usenet system. It includes innd, an
  57. NNTP server, and nnrpd, a newsreading server. INN separates hosts
  58. that feed you news from those that have users reading news.
  59. %prep
  60. %setup0 -q -c
  61. %if "%{V_build}" == "release"
  62. %setup1 -q -T -D -a 1
  63. %else
  64. %setup2 -q -T -D -a 2
  65. %endif
  66. %build
  67. # make sure INN finds our own files
  68. PATH="%{l_prefix}/bin:$PATH"
  69. export PATH
  70. # build faked syslog(3) library
  71. fakesyslogdir="`pwd`/fakesyslog"
  72. ( cd fakesyslog
  73. CC="%{l_cc}" \
  74. CFLAGS="%{l_cflags -O}" \
  75. ./configure \
  76. --with-logfile=%{l_prefix}/var/inn/log/news.log
  77. %{l_make} %{l_mflags}
  78. )
  79. %if "%{V_build}" == "release"
  80. cd inn-%{V_release}
  81. %else
  82. cd inn-STABLE-%{V_stable}
  83. %endif
  84. # adjust some too strange INN paths
  85. %{l_shtool} subst \
  86. -e "s;^\\(PATHBIN.*=\\).*;\\1 \$(PATHNEWS)/libexec/inn;" \
  87. Makefile.global.in
  88. %{l_shtool} subst \
  89. -e "s;^\\(pathbin:.*\\)@prefix@.*;\\1@prefix@/libexec/inn;" \
  90. samples/inn.conf.in
  91. %{l_shtool} subst \
  92. -e "s;BERKELEY_DB_DIR/include;BERKELEY_DB_DIR/include/db3;" \
  93. -e "s;-ldb;-ldb3;" \
  94. configure
  95. # configure the source tree
  96. CC="%{l_cc}" \
  97. CFLAGS="%{l_cflags -O} -I%{l_prefix}/include/db3 -I%{l_prefix}/include" \
  98. LDFLAGS="-L$fakesyslogdir -L%{l_prefix}/lib" \
  99. LIBS="-lfakesyslog" \
  100. ./configure \
  101. --prefix=%{l_prefix} \
  102. --bindir=%{l_prefix}/libexec/inn \
  103. --with-etc-dir=%{l_prefix}/etc/inn \
  104. --with-db-dir=%{l_prefix}/var/inn/db \
  105. --with-control-dir=%{l_prefix}/libexec/inn/control \
  106. --with-filter-dir=%{l_prefix}/libexec/inn/filter \
  107. --with-lib-dir=%{l_prefix}/lib/inn \
  108. --with-log-dir=%{l_prefix}/var/inn/log \
  109. --with-run-dir=%{l_prefix}/var/inn/run \
  110. --with-spool-dir=%{l_prefix}/var/inn/spool \
  111. --with-tmp-path=%{l_prefix}/var/inn/tmp \
  112. --with-openssl=%{l_prefix} \
  113. --with-berkeleydb=%{l_prefix} \
  114. --with-news-user=%{l_musr} \
  115. --with-news-group=%{l_musr} \
  116. --with-news-master=%{l_musr} \
  117. --with-sendmail=%{l_prefix}/sbin/sendmail \
  118. --enable-uucp-rnews \
  119. --with-perl
  120. # build the INN system
  121. %{l_make} %{l_mflags}
  122. %install
  123. rm -rf $RPM_BUILD_ROOT
  124. %if "%{V_build}" == "release"
  125. cd inn-%{V_release}
  126. %else
  127. cd inn-STABLE-%{V_stable}
  128. %endif
  129. # determine current user and group
  130. thisuser=`(id -un) 2>/dev/null ||\
  131. (whoami) 2>/dev/null ||\
  132. (who am i | cut "-d " -f1) 2>/dev/null ||\
  133. echo $LOGNAME`
  134. thisgroup=`(cat /etc/passwd; ypcat passwd) 2>/dev/null |\
  135. grep "^${thisuser}:" | awk -F: '{ print $4; }' | head -1`
  136. thisgroup=`(cat /etc/group; ypcat group) 2>/dev/null |\
  137. grep ":${thisgroup}:" | awk -F: '{ print $1; }' | head -1`
  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. # strip binaries
  201. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2> /dev/null || true
  202. strip $RPM_BUILD_ROOT%{l_prefix}/libexec/inn/* 2> /dev/null || true
  203. # determine file list
  204. %{l_rpmtool} files -v -o../files -r$RPM_BUILD_ROOT \
  205. %{l_files_std} \
  206. '%config %{l_prefix}/etc/inn/*' \
  207. '%attr(4550,root,%{l_mgrp}) %{l_prefix}/bin/rnews' \
  208. '%attr(4755,root,%{l_mgrp}) %{l_prefix}/libexec/inn/inndstart' \
  209. '%attr(4755,root,%{l_mgrp}) %{l_prefix}/libexec/inn/startinnfeed' \
  210. '%config %{l_prefix}/var/inn/db/*'
  211. %files -f files
  212. %clean
  213. rm -rf $RPM_BUILD_ROOT