subversion.spec 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. ##
  2. ## subversion.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2006 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2006 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package version
  25. %define V_dist 1.3.0
  26. %define V_opkg 1.3.0
  27. %define V_cvs2svn 1.3.0
  28. %define V_svn2cvs 20051121
  29. %define V_book_html 20051222
  30. %define V_book_pdf 20050525
  31. # package information
  32. Name: subversion
  33. Summary: Source Revision Control System
  34. URL: http://subversion.tigris.org/
  35. Vendor: Tigris
  36. Packager: OpenPKG
  37. Distribution: OpenPKG
  38. Class: BASE
  39. Group: SCM
  40. License: Apache/BSD
  41. Version: %{V_opkg}
  42. Release: 20060102
  43. # package options
  44. %option with_cvs2svn no
  45. %option with_svn2cvs no
  46. %option with_perl no
  47. %option with_python no
  48. # list of sources
  49. Source0: http://subversion.tigris.org/tarballs/subversion-%{V_dist}.tar.gz
  50. Source1: ftp://ftp.openpkg.org/sources/CPY/subversion/cvs2svn-%{V_cvs2svn}.tar.gz
  51. Source2: ftp://ftp.openpkg.org/sources/CPY/subversion/svn2cvs.pl-%{V_svn2cvs}
  52. Source3: ftp://ftp.openpkg.org/sources/CPY/subversion/svn-book-%{V_book_html}.html
  53. Source4: ftp://ftp.openpkg.org/sources/CPY/subversion/svn-book-%{V_book_pdf}.pdf
  54. Source5: subversion.config
  55. Source6: subversion.servers
  56. Source7: rc.subversion
  57. Patch0: subversion.patch
  58. # build information
  59. Prefix: %{l_prefix}
  60. BuildRoot: %{l_buildroot}
  61. BuildPreReq: OpenPKG, openpkg >= 20040130, make, libtool, sed
  62. PreReq: OpenPKG, openpkg >= 20040130
  63. BuildPreReq: diffutils, libxml, db, openssl, zlib
  64. PreReq: diffutils, libxml, db, openssl, zlib
  65. %if "%{with_cvs2svn}" == "yes"
  66. PreReq: rcs, python
  67. %endif
  68. %if "%{with_svn2cvs}" == "yes"
  69. BuildPreReq: perl
  70. PreReq: perl, perl-xml, cvs, rcs
  71. %endif
  72. %if "%{with_perl}" == "yes" || "%{with_python}" == "yes"
  73. BuildPreReq: swig
  74. %endif
  75. %if "%{with_perl}" == "yes"
  76. BuildPreReq: perl
  77. PreReq: perl
  78. %endif
  79. %if "%{with_python}" == "yes"
  80. BuildPreReq: python, swig
  81. PreReq: python
  82. %endif
  83. AutoReq: no
  84. AutoReqProv: no
  85. %description
  86. Subversion is a modern Version Control System (VCS) providing most
  87. current CVS features, versioned directories/renames/meta-data,
  88. atomic commits, cheap branching and tagging, native client/server
  89. architecture, and the choice of database or plain-file repository
  90. implementations.
  91. %track
  92. prog subversion = {
  93. version = %{V_dist}
  94. url = http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=260
  95. regex = subversion-(\d+\.\d+\.\d+)\.tar\.gz
  96. }
  97. prog subversion:cvs2svn = {
  98. version = %{V_cvs2svn}
  99. url = ftp://ftp.openpkg.org/sources/CPY/subversion/
  100. regex = cvs2svn-(__VER__)\.tar\.gz
  101. }
  102. prog subversion:svn2cvs = {
  103. version = %{V_svn2cvs}
  104. url = ftp://ftp.openpkg.org/sources/CPY/subversion/
  105. regex = svn2cvs.pl-(__VER__)
  106. }
  107. %prep
  108. %setup -q
  109. %setup -q -T -D -a 1
  110. cp %{SOURCE svn2cvs.pl-%{V_svn2cvs}} svn2cvs.pl
  111. %patch -p0
  112. # substitute path from applied patch
  113. %{l_shtool} subst %{l_value -s -a} \
  114. subversion/bindings/swig/perl/native/Makefile.PL.in
  115. # patch: correctly pass --disable-shared to sub-directories
  116. %{l_shtool} subst \
  117. -e 's;\($ac_abs_srcdir/configure\) $ac_configure_args;\1 --disable-shared;' \
  118. configure
  119. # patch: adjust path to configuration directory
  120. %{l_shtool} subst \
  121. -e 's;/etc/subversion;%{l_prefix}/etc/subversion;g' \
  122. subversion/libsvn_subr/config_impl.h \
  123. subversion/libsvn_subr/config_file.c
  124. # patch: fix installation of APR
  125. %{l_shtool} subst \
  126. -e '/^<Layout apr>/,/<\/Layout>/{ s!\(^[ ]*prefix:\).*$!\1 %{l_prefix}!; s!\(^[ ]*sysconfdir:\).*$!\1 %{l_prefix}/etc/subversion!; }' \
  127. apr/config.layout \
  128. apr-util/config.layout
  129. %build
  130. # configure package
  131. CC="%{l_cc}" \
  132. CFLAGS="%{l_cflags -O}" \
  133. CPPFLAGS="%{l_cppflags libxml2 .}" \
  134. LDFLAGS="%{l_ldflags}" \
  135. ./configure \
  136. --prefix=%{l_prefix} \
  137. --with-berkeley-db=%{l_prefix} \
  138. --with-ssl \
  139. --with-zlib \
  140. --enable-static \
  141. %if "%{with_perl}" == "yes" || "%{with_python}" == "yes"
  142. --with-swig=%{l_prefix}/bin/swig \
  143. %endif
  144. %if "%{with_perl}" == "yes"
  145. --with-perl=%{l_prefix}/bin/perl \
  146. %endif
  147. %if "%{with_python}" == "yes"
  148. --with-python=%{l_prefix}/bin/python \
  149. %endif
  150. --disable-nls \
  151. --disable-shared \
  152. --without-apxs
  153. # build package
  154. %{l_make} %{l_mflags}
  155. # build Perl bindings
  156. %if "%{with_perl}" == "yes"
  157. ( cd apr; ln -s .libs/libapr-0.a . ) || exit $?
  158. ( cd apr-util; ln -s .libs/libaprutil-0.a . ) || exit $?
  159. %{l_make} %{l_mflags} swig-pl
  160. %endif
  161. # build Python bindings
  162. %if "%{with_python}" == "yes"
  163. %{l_make} %{l_mflags} swig-py
  164. %endif
  165. %install
  166. # install package
  167. rm -rf $RPM_BUILD_ROOT
  168. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  169. # install Perl bindings
  170. %if "%{with_perl}" == "yes"
  171. %{l_make} %{l_mflags} install-swig-pl DESTDIR=$RPM_BUILD_ROOT
  172. %{l_prefix}/bin/perl-openpkg -F- fixate >/dev/null
  173. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libsvn_swig_perl*
  174. %endif
  175. # install Python bindings
  176. %if "%{with_python}" == "yes"
  177. %{l_make} %{l_mflags} install-swig-py DESTDIR=$RPM_BUILD_ROOT
  178. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libsvn_swig_py*
  179. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/svn-python/libsvn/_*.a
  180. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/svn-python/libsvn/_*.la
  181. mv $RPM_BUILD_ROOT%{l_prefix}/lib/svn-python \
  182. $RPM_BUILD_ROOT%{l_prefix}/lib/python
  183. %endif
  184. # adjust APR installation for SVN local namespace
  185. ( cd $RPM_BUILD_ROOT%{l_prefix}/include/apr-0
  186. for i in *; do
  187. mv $i ../subversion-1/svn_$i
  188. done
  189. ) || exit $?
  190. %{l_shtool} subst \
  191. -e 's;^\(#include <\)\(apr.*\)$;\1svn_\2;' \
  192. $RPM_BUILD_ROOT/%{l_prefix}/include/subversion-1/svn*.h
  193. ( cd $RPM_BUILD_ROOT%{l_prefix}/lib
  194. for i in libapr*; do
  195. mv $i `echo "$i" | sed -e 's;^libapr\(.*\)$;libsvn_apr\1;'`
  196. done
  197. ) || exit $?
  198. # strip down installation
  199. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/apr-config
  200. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/apr.exp
  201. rm -rf $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/neon
  202. rmdir $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion >/dev/null 2>&1 || true
  203. rm -rf $RPM_BUILD_ROOT%{l_prefix}/include/apr-0
  204. rm -f $RPM_BUILD_ROOT%{l_prefix}/include/subversion-1/svn-revision.txt
  205. rm -f $RPM_BUILD_ROOT%{l_prefix}/include/subversion-1/mod_dav_svn.h
  206. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
  207. rm -rf $RPM_BUILD_ROOT%{l_prefix}/build
  208. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/neon*
  209. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  210. # install svn-config(1) tool
  211. %{l_shtool} install -c -m 755 \
  212. svn-config $RPM_BUILD_ROOT%{l_prefix}/bin/
  213. # install svn_load_dirs(1) tool
  214. %{l_shtool} install -c -m 755 \
  215. -e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;' \
  216. contrib/client-side/svn_load_dirs.pl \
  217. $RPM_BUILD_ROOT%{l_prefix}/bin/svn_load_dirs
  218. # install Subversion default global configuration files
  219. %{l_shtool} mkdir -f -p -m 755 \
  220. $RPM_BUILD_ROOT%{l_prefix}/etc/subversion
  221. %{l_shtool} install -c -m 644 \
  222. %{SOURCE subversion.config} \
  223. $RPM_BUILD_ROOT%{l_prefix}/etc/subversion/config
  224. %{l_shtool} install -c -m 644 \
  225. %{SOURCE subversion.servers} \
  226. $RPM_BUILD_ROOT%{l_prefix}/etc/subversion/servers
  227. # install Subversion Bash command completion
  228. %{l_shtool} install -c -m 644 \
  229. tools/client-side/bash_completion \
  230. $RPM_BUILD_ROOT%{l_prefix}/etc/subversion/bashrc
  231. # install Subversion book
  232. %{l_shtool} mkdir -f -p -m 755 \
  233. $RPM_BUILD_ROOT%{l_prefix}/share/subversion
  234. %{l_shtool} install -c -m 644 \
  235. %{SOURCE svn-book-%{V_book_pdf}.pdf} \
  236. $RPM_BUILD_ROOT%{l_prefix}/share/subversion/svn-book.pdf
  237. %{l_shtool} install -c -m 644 \
  238. %{SOURCE svn-book-%{V_book_html}.html} \
  239. $RPM_BUILD_ROOT%{l_prefix}/share/subversion/svn-book.html
  240. %if "%{with_cvs2svn}" == "yes"
  241. # install cvs2svn(1) tool
  242. ( cd cvs2svn-%{V_cvs2svn}
  243. %{l_shtool} mkdir -f -p -m 755 \
  244. $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/cvs2svn/cvs2svn_rcsparse
  245. ( echo "#!/bin/sh"
  246. echo "PYTHONPATH=\"%{l_prefix}/libexec/subversion/cvs2svn\""
  247. echo "export PYTHONPATH"
  248. echo "%{l_prefix}/bin/python %{l_prefix}/libexec/subversion/cvs2svn/cvs2svn \${1+\"\$@\"}"
  249. ) >cvs2svn.sh
  250. %{l_shtool} install -c -m 755 \
  251. cvs2svn.sh $RPM_BUILD_ROOT%{l_prefix}/bin/cvs2svn
  252. %{l_shtool} install -c -m 644 \
  253. cvs2svn.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
  254. %{l_shtool} install -c -m 644 \
  255. cvs2svn $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/cvs2svn/
  256. %{l_shtool} install -c -m 644 \
  257. cvs2svn_rcsparse/*.py \
  258. $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/cvs2svn/cvs2svn_rcsparse/
  259. ) || exit $?
  260. %endif
  261. %if "%{with_svn2cvs}" == "yes"
  262. # install svn2cvs(1) tool
  263. %{l_shtool} install -c -m 755 \
  264. -e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;' \
  265. svn2cvs.pl $RPM_BUILD_ROOT%{l_prefix}/bin/svn2cvs
  266. %{l_prefix}/bin/pod2man svn2cvs.pl >svn2cvs.1
  267. %{l_shtool} install -c -m 644 \
  268. svn2cvs.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/svn2cvs.1
  269. %endif
  270. # install run-command script
  271. %{l_shtool} mkdir -f -p -m 755 \
  272. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  273. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  274. %{SOURCE rc.subversion} \
  275. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  276. # create directory for default repository and svnserve pidfile
  277. %{l_shtool} mkdir -f -p -m 755 \
  278. $RPM_BUILD_ROOT%{l_prefix}/var/subversion
  279. # determine installation files
  280. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  281. %{l_files_std} \
  282. '%config %{l_prefix}/etc/subversion/*' \
  283. '%doc %{l_prefix}/share/subversion/svn-book.*'
  284. %files -f files
  285. %clean
  286. rm -rf $RPM_BUILD_ROOT
  287. %post
  288. # create default repository
  289. if [ ! -d $RPM_INSTALL_PREFIX/var/subversion/default ]; then
  290. $RPM_INSTALL_PREFIX/bin/svnadmin create \
  291. $RPM_INSTALL_PREFIX/var/subversion/default
  292. fi
  293. # after upgrade, restart service
  294. [ $1 -eq 2 ] || exit 0
  295. eval `%{l_rc} subversion status 2>/dev/null`
  296. [ ".$subversion_active" = .yes ] && %{l_rc} subversion restart
  297. exit 0
  298. %preun
  299. # before erase, stop service
  300. [ $1 -eq 0 ] || exit 0
  301. %{l_rc} subversion stop 2>/dev/null
  302. exit 0