subversion.spec 13 KB

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