subversion.spec 11 KB

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