subversion.spec 14 KB

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