subversion.spec 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  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.2
  26. %define V_opkg 1.3.2
  27. %define V_cvs2svn 1.3.1
  28. %define V_svn2cvs 20060127
  29. %define V_book_html 20060127
  30. %define V_book_pdf 20060127
  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: 20060627
  43. # package options
  44. %option with_cvs2svn no
  45. %option with_svn2cvs no
  46. %option with_perl no
  47. %option with_python no
  48. %option with_ruby no
  49. # list of sources
  50. Source0: http://subversion.tigris.org/tarballs/subversion-%{V_dist}.tar.gz
  51. Source1: ftp://ftp.openpkg.org/sources/CPY/subversion/cvs2svn-%{V_cvs2svn}.tar.gz
  52. Source2: ftp://ftp.openpkg.org/sources/CPY/subversion/svn2cvs.pl-%{V_svn2cvs}
  53. Source3: ftp://ftp.openpkg.org/sources/CPY/subversion/svn-book-%{V_book_html}.html
  54. Source4: ftp://ftp.openpkg.org/sources/CPY/subversion/svn-book-%{V_book_pdf}.pdf
  55. Source5: subversion.config
  56. Source6: subversion.servers
  57. Source7: rc.subversion
  58. Patch0: subversion.patch
  59. # build information
  60. Prefix: %{l_prefix}
  61. BuildRoot: %{l_buildroot}
  62. BuildPreReq: OpenPKG, openpkg >= 20040130, make, libtool, sed
  63. PreReq: OpenPKG, openpkg >= 20040130
  64. BuildPreReq: diffutils, libxml, db, openssl, zlib
  65. PreReq: diffutils, libxml, db, openssl, zlib
  66. %if "%{with_cvs2svn}" == "yes"
  67. PreReq: rcs, python
  68. %endif
  69. %if "%{with_svn2cvs}" == "yes"
  70. BuildPreReq: perl
  71. PreReq: perl, perl-xml, cvs, rcs
  72. %endif
  73. %if "%{with_perl}" == "yes" || "%{with_python}" == "yes"
  74. BuildPreReq: swig
  75. %endif
  76. %if "%{with_perl}" == "yes"
  77. BuildPreReq: perl
  78. PreReq: perl
  79. %endif
  80. %if "%{with_python}" == "yes"
  81. BuildPreReq: python, swig
  82. PreReq: python
  83. %endif
  84. %if "%{with_ruby}" == "yes"
  85. BuildPreReq: ruby
  86. PreReq: ruby
  87. %endif
  88. AutoReq: no
  89. AutoReqProv: no
  90. %description
  91. Subversion is a modern Version Control System (VCS) providing most
  92. current CVS features, versioned directories/renames/meta-data,
  93. atomic commits, cheap branching and tagging, native client/server
  94. architecture, and the choice of database or plain-file repository
  95. implementations.
  96. %track
  97. prog subversion = {
  98. version = %{V_dist}
  99. url = http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=260
  100. regex = subversion-(\d+\.\d+\.\d+)\.tar\.gz
  101. }
  102. prog subversion:cvs2svn = {
  103. version = %{V_cvs2svn}
  104. url = ftp://ftp.openpkg.org/sources/CPY/subversion/
  105. regex = cvs2svn-(__VER__)\.tar\.gz
  106. }
  107. prog subversion:svn2cvs = {
  108. version = %{V_svn2cvs}
  109. url = ftp://ftp.openpkg.org/sources/CPY/subversion/
  110. regex = svn2cvs.pl-(__VER__)
  111. }
  112. %prep
  113. %setup -q
  114. %setup -q -T -D -a 1
  115. cp %{SOURCE svn2cvs.pl-%{V_svn2cvs}} svn2cvs.pl
  116. %patch -p0
  117. # substitute path from applied patch
  118. %{l_shtool} subst %{l_value -s -a} \
  119. subversion/bindings/swig/perl/native/Makefile.PL.in
  120. # patch: correctly pass --disable-shared to sub-directories
  121. %{l_shtool} subst \
  122. -e 's;\($ac_abs_srcdir/configure\) $ac_configure_args;\1 --disable-shared;' \
  123. configure
  124. # patch: adjust path to configuration directory
  125. %{l_shtool} subst \
  126. -e 's;/etc/subversion;%{l_prefix}/etc/subversion;g' \
  127. subversion/libsvn_subr/config_impl.h \
  128. subversion/libsvn_subr/config_file.c
  129. # patch: fix installation of APR
  130. %{l_shtool} subst \
  131. -e '/^<Layout apr>/,/<\/Layout>/{ s!\(^[ ]*prefix:\).*$!\1 %{l_prefix}!; s!\(^[ ]*sysconfdir:\).*$!\1 %{l_prefix}/etc/subversion!; }' \
  132. apr/config.layout \
  133. apr-util/config.layout
  134. %build
  135. # configure package
  136. CC="%{l_cc}" \
  137. CFLAGS="%{l_cflags -O}" \
  138. CPPFLAGS="%{l_cppflags libxml2 .}" \
  139. LDFLAGS="%{l_ldflags}" \
  140. ./configure \
  141. --prefix=%{l_prefix} \
  142. --with-berkeley-db=%{l_prefix} \
  143. --with-ssl \
  144. --with-zlib \
  145. --enable-static \
  146. %if "%{with_perl}" == "yes" || "%{with_python}" == "yes"
  147. --with-swig=%{l_prefix}/bin/swig \
  148. %endif
  149. %if "%{with_perl}" == "yes"
  150. --with-perl=%{l_prefix}/bin/perl \
  151. %endif
  152. %if "%{with_python}" == "yes"
  153. --with-python=%{l_prefix}/bin/python \
  154. %endif
  155. %if "%{with_ruby}" == "yes"
  156. --with-ruby=%{l_prefix}/bin/ruby \
  157. %endif
  158. --disable-nls \
  159. --disable-shared \
  160. --without-apxs
  161. # build package
  162. %{l_make} %{l_mflags}
  163. # build Perl bindings
  164. %if "%{with_perl}" == "yes"
  165. ( cd apr; ln -s .libs/libapr-0.a . ) || exit $?
  166. ( cd apr-util; ln -s .libs/libaprutil-0.a . ) || exit $?
  167. %{l_make} %{l_mflags} swig-pl
  168. %endif
  169. # build Python bindings
  170. %if "%{with_python}" == "yes"
  171. %{l_make} %{l_mflags} swig-py
  172. %endif
  173. # build Ruby bindings
  174. %if "%{with_ruby}" == "yes"
  175. %{l_make} %{l_mflags} swig-rb
  176. %endif
  177. %install
  178. # install package
  179. rm -rf $RPM_BUILD_ROOT
  180. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  181. # install Perl bindings
  182. %if "%{with_perl}" == "yes"
  183. %{l_make} %{l_mflags} install-swig-pl DESTDIR=$RPM_BUILD_ROOT
  184. %{l_prefix}/bin/perl-openpkg -F- fixate >/dev/null
  185. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libsvn_swig_perl*
  186. %endif
  187. # install Python bindings
  188. %if "%{with_python}" == "yes"
  189. %{l_make} %{l_mflags} install-swig-py DESTDIR=$RPM_BUILD_ROOT
  190. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libsvn_swig_py*
  191. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/svn-python/libsvn/_*.a
  192. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/svn-python/libsvn/_*.la
  193. mv $RPM_BUILD_ROOT%{l_prefix}/lib/svn-python \
  194. $RPM_BUILD_ROOT%{l_prefix}/lib/python
  195. %endif
  196. # install Ruby bindings
  197. %if "%{with_ruby}" == "yes"
  198. %{l_make} %{l_mflags} install-swig-rb DESTDIR=$RPM_BUILD_ROOT
  199. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libsvn_swig_ruby*
  200. %endif
  201. # adjust APR installation for SVN local namespace
  202. ( cd $RPM_BUILD_ROOT%{l_prefix}/include/apr-0
  203. for i in *; do
  204. mv $i ../subversion-1/svn_$i
  205. done
  206. ) || exit $?
  207. %{l_shtool} subst \
  208. -e 's;^\(#include <\)\(apr.*\)$;\1svn_\2;' \
  209. $RPM_BUILD_ROOT/%{l_prefix}/include/subversion-1/svn*.h
  210. ( cd $RPM_BUILD_ROOT%{l_prefix}/lib
  211. for i in libapr*; do
  212. mv $i `echo "$i" | sed -e 's;^libapr\(.*\)$;libsvn_apr\1;'`
  213. done
  214. ) || exit $?
  215. # strip down installation
  216. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/apr-config
  217. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/apr.exp
  218. rm -rf $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/neon
  219. rmdir $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion >/dev/null 2>&1 || true
  220. rm -rf $RPM_BUILD_ROOT%{l_prefix}/include/apr-0
  221. rm -f $RPM_BUILD_ROOT%{l_prefix}/include/subversion-1/svn-revision.txt
  222. rm -f $RPM_BUILD_ROOT%{l_prefix}/include/subversion-1/mod_dav_svn.h
  223. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
  224. rm -rf $RPM_BUILD_ROOT%{l_prefix}/build
  225. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/neon*
  226. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  227. # install svn-config(1) tool
  228. %{l_shtool} install -c -m 755 \
  229. svn-config $RPM_BUILD_ROOT%{l_prefix}/bin/
  230. # install svn_load_dirs(1) tool
  231. %{l_shtool} install -c -m 755 \
  232. -e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;' \
  233. contrib/client-side/svn_load_dirs.pl \
  234. $RPM_BUILD_ROOT%{l_prefix}/bin/svn_load_dirs
  235. # install Subversion default global configuration files
  236. %{l_shtool} mkdir -f -p -m 755 \
  237. $RPM_BUILD_ROOT%{l_prefix}/etc/subversion
  238. %{l_shtool} install -c -m 644 \
  239. %{SOURCE subversion.config} \
  240. $RPM_BUILD_ROOT%{l_prefix}/etc/subversion/config
  241. %{l_shtool} install -c -m 644 \
  242. %{SOURCE subversion.servers} \
  243. $RPM_BUILD_ROOT%{l_prefix}/etc/subversion/servers
  244. # install Subversion Bash command completion
  245. %{l_shtool} install -c -m 644 \
  246. tools/client-side/bash_completion \
  247. $RPM_BUILD_ROOT%{l_prefix}/etc/subversion/bashrc
  248. # install Subversion book
  249. %{l_shtool} mkdir -f -p -m 755 \
  250. $RPM_BUILD_ROOT%{l_prefix}/share/subversion
  251. %{l_shtool} install -c -m 644 \
  252. %{SOURCE svn-book-%{V_book_pdf}.pdf} \
  253. $RPM_BUILD_ROOT%{l_prefix}/share/subversion/svn-book.pdf
  254. %{l_shtool} install -c -m 644 \
  255. %{SOURCE svn-book-%{V_book_html}.html} \
  256. $RPM_BUILD_ROOT%{l_prefix}/share/subversion/svn-book.html
  257. %if "%{with_cvs2svn}" == "yes"
  258. # install cvs2svn(1) tool
  259. ( cd cvs2svn-%{V_cvs2svn}
  260. %{l_shtool} mkdir -f -p -m 755 \
  261. $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/cvs2svn/cvs2svn_rcsparse
  262. ( echo "#!/bin/sh"
  263. echo "PYTHONPATH=\"%{l_prefix}/libexec/subversion/cvs2svn\""
  264. echo "export PYTHONPATH"
  265. echo "%{l_prefix}/bin/python %{l_prefix}/libexec/subversion/cvs2svn/cvs2svn \${1+\"\$@\"}"
  266. ) >cvs2svn.sh
  267. %{l_shtool} install -c -m 755 \
  268. cvs2svn.sh $RPM_BUILD_ROOT%{l_prefix}/bin/cvs2svn
  269. %{l_shtool} install -c -m 644 \
  270. cvs2svn.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
  271. %{l_shtool} install -c -m 644 \
  272. cvs2svn $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/cvs2svn/
  273. %{l_shtool} install -c -m 644 \
  274. cvs2svn_rcsparse/*.py \
  275. $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/cvs2svn/cvs2svn_rcsparse/
  276. ) || exit $?
  277. %endif
  278. %if "%{with_svn2cvs}" == "yes"
  279. # install svn2cvs(1) tool
  280. %{l_shtool} install -c -m 755 \
  281. -e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;' \
  282. svn2cvs.pl $RPM_BUILD_ROOT%{l_prefix}/bin/svn2cvs
  283. %{l_prefix}/bin/pod2man svn2cvs.pl >svn2cvs.1
  284. %{l_shtool} install -c -m 644 \
  285. svn2cvs.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/svn2cvs.1
  286. %endif
  287. # install run-command script
  288. %{l_shtool} mkdir -f -p -m 755 \
  289. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  290. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  291. %{SOURCE rc.subversion} \
  292. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  293. # create directory for default repository and svnserve pidfile
  294. %{l_shtool} mkdir -f -p -m 755 \
  295. $RPM_BUILD_ROOT%{l_prefix}/var/subversion
  296. # determine installation files
  297. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  298. %{l_files_std} \
  299. '%config %{l_prefix}/etc/subversion/*' \
  300. '%doc %{l_prefix}/share/subversion/svn-book.*'
  301. %files -f files
  302. %clean
  303. rm -rf $RPM_BUILD_ROOT
  304. %post
  305. # create default repository
  306. if [ ! -d $RPM_INSTALL_PREFIX/var/subversion/default ]; then
  307. $RPM_INSTALL_PREFIX/bin/svnadmin create \
  308. $RPM_INSTALL_PREFIX/var/subversion/default
  309. fi
  310. # after upgrade, restart service
  311. [ $1 -eq 2 ] || exit 0
  312. eval `%{l_rc} subversion status 2>/dev/null`
  313. [ ".$subversion_active" = .yes ] && %{l_rc} subversion restart
  314. exit 0
  315. %preun
  316. # before erase, stop service
  317. [ $1 -eq 0 ] || exit 0
  318. %{l_rc} subversion stop 2>/dev/null
  319. exit 0