subversion.spec 14 KB

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