subversion15.spec 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. ##
  2. ## subversion15.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.5.0-beta1
  25. %define V_opkg 1.5.0b1
  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: subversion15
  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: EVAL
  38. Group: SCM
  39. License: Apache/BSD
  40. Version: %{V_opkg}
  41. Release: 20080403
  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: subversion15.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. Provides: subversion = %{version}-%{release}
  97. Conflicts: subversion
  98. %description
  99. Subversion is a modern Version Control System (VCS) providing most
  100. current CVS features, versioned directories/renames/meta-data,
  101. atomic commits, cheap branching and tagging, native client/server
  102. architecture, and the choice of database or plain-file repository
  103. implementations.
  104. %track
  105. prog subversion15 = {
  106. version = %{V_dist}
  107. url = http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=260
  108. regex = subversion-(1\.5\.\d+)\.tar\.bz2
  109. }
  110. prog subversion15:cvs2svn = {
  111. version = %{V_cvs2svn}
  112. url = ftp://ftp.openpkg.org/sources/CPY/subversion/
  113. regex = cvs2svn-(__VER__)\.tar\.gz
  114. }
  115. prog subversion15:svn2cvs = {
  116. version = %{V_svn2cvs}
  117. url = ftp://ftp.openpkg.org/sources/CPY/subversion/
  118. regex = svn2cvs.pl-(__VER__)
  119. }
  120. %prep
  121. %setup -q -n subversion-%{V_dist}
  122. %setup -q -n subversion-%{V_dist} -T -D -b 1
  123. %setup -q -n subversion-%{V_dist} -T -D -a 2
  124. cp %{SOURCE svn2cvs.pl-%{V_svn2cvs}} svn2cvs.pl
  125. %patch -p0
  126. # substitute path from applied patch
  127. %{l_shtool} subst %{l_value -s -a} \
  128. subversion/bindings/swig/perl/native/Makefile.PL.in
  129. # patch: correctly pass --disable-shared to sub-directories
  130. %{l_shtool} subst \
  131. -e 's;\($ac_abs_srcdir/configure $ac_configure_args\);\1 --disable-shared;' \
  132. configure
  133. # patch: adjust path to configuration directory
  134. %{l_shtool} subst \
  135. -e 's;/etc/subversion;%{l_prefix}/etc/subversion;g' \
  136. subversion/libsvn_subr/config_impl.h \
  137. subversion/libsvn_subr/config_file.c
  138. # patch: fix installation of APR
  139. %{l_shtool} subst \
  140. -e '/^<Layout apr>/,/<\/Layout>/{ s!\(^[ ]*prefix:\).*$!\1 %{l_prefix}!; s!\(^[ ]*sysconfdir:\).*$!\1 %{l_prefix}/etc/subversion!; }' \
  141. apr/config.layout \
  142. apr-util/config.layout
  143. %build
  144. # configure package
  145. CC="%{l_cc}" \
  146. CFLAGS="%{l_cflags -O}" \
  147. CPPFLAGS="%{l_cppflags libxml2 .}" \
  148. LDFLAGS="%{l_ldflags} `pkg-config db --libs-only-L`" \
  149. LIBS="`pkg-config db --libs-only-l`" \
  150. CONFIG_SHELL="%{l_bash}" \
  151. ./configure \
  152. --prefix=%{l_prefix} \
  153. --mandir=%{l_prefix}/man \
  154. --with-berkeley-db=%{l_prefix} \
  155. --with-dbm=db45 \
  156. --with-ssl=openssl \
  157. --with-zlib=%{l_prefix} \
  158. --without-libxml2 \
  159. --without-gssapi \
  160. %if "%{with_apache}" == "yes"
  161. --with-apxs \
  162. --disable-mod-activation \
  163. %else
  164. --without-apxs \
  165. %endif
  166. %if "%{with_perl}" == "yes" || "%{with_python}" == "yes"
  167. --with-swig=%{l_prefix}/bin/swig \
  168. %endif
  169. %if "%{with_perl}" == "yes"
  170. --with-perl=%{l_prefix}/bin/perl \
  171. %endif
  172. %if "%{with_python}" == "yes"
  173. --with-python=%{l_prefix}/bin/python \
  174. %endif
  175. %if "%{with_ruby}" == "yes"
  176. --with-ruby=%{l_prefix}/bin/ruby \
  177. %endif
  178. --disable-nls \
  179. --disable-shared \
  180. --enable-static
  181. # build package
  182. %{l_make} %{l_mflags}
  183. # build Perl bindings
  184. %if "%{with_perl}" == "yes"
  185. ( cd apr; ln -s .libs/libapr-1.a . ) || exit $?
  186. ( cd apr-util; ln -s .libs/libaprutil-1.a . ) || exit $?
  187. %{l_make} %{l_mflags} swig-pl
  188. %endif
  189. # build Python bindings
  190. %if "%{with_python}" == "yes"
  191. %{l_make} %{l_mflags} swig-py
  192. %endif
  193. # build Ruby bindings
  194. %if "%{with_ruby}" == "yes"
  195. %{l_make} %{l_mflags} swig-rb
  196. %endif
  197. %install
  198. # install package
  199. rm -rf $RPM_BUILD_ROOT
  200. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  201. # install Perl bindings
  202. %if "%{with_perl}" == "yes"
  203. %{l_make} %{l_mflags} install-swig-pl DESTDIR=$RPM_BUILD_ROOT
  204. %{l_prefix}/bin/perl-openpkg -F- fixate >/dev/null
  205. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libsvn_swig_perl*
  206. %endif
  207. # install Python bindings
  208. %if "%{with_python}" == "yes"
  209. %{l_make} %{l_mflags} install-swig-py DESTDIR=$RPM_BUILD_ROOT
  210. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libsvn_swig_py*
  211. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/svn-python/libsvn/_*.a
  212. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/svn-python/libsvn/_*.la
  213. mv $RPM_BUILD_ROOT%{l_prefix}/lib/svn-python \
  214. $RPM_BUILD_ROOT%{l_prefix}/lib/python
  215. %endif
  216. # install Ruby bindings
  217. %if "%{with_ruby}" == "yes"
  218. %{l_make} %{l_mflags} install-swig-rb DESTDIR=$RPM_BUILD_ROOT
  219. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libsvn_swig_ruby*
  220. %endif
  221. # adjust APR installation for SVN local namespace
  222. ( cd $RPM_BUILD_ROOT%{l_prefix}/include/apr-1
  223. for i in *; do
  224. mv $i ../subversion-1/svn_$i
  225. done
  226. ) || exit $?
  227. %{l_shtool} subst \
  228. -e 's;^\(#include <\)\(apr.*\)$;\1svn_\2;' \
  229. $RPM_BUILD_ROOT/%{l_prefix}/include/subversion-1/svn*.h
  230. ( cd $RPM_BUILD_ROOT%{l_prefix}/lib
  231. for i in libapr*; do
  232. [ ".$i" = ".libapr*" ] && continue
  233. mv $i `echo "$i" | sed -e 's;^libapr\(.*\)$;libsvn_apr\1;'`
  234. done
  235. ) || exit $?
  236. ( cd $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/neon/lib
  237. for i in libneon*; do
  238. [ ".$i" = ".libneon*" ] && continue
  239. mv $i $RPM_BUILD_ROOT%{l_prefix}/lib/`echo "$i" | sed -e 's;^libneon\(.*\)$;libsvn_neon\1;'`
  240. done
  241. ) || exit $?
  242. %{l_shtool} subst \
  243. -e 's;libapr;libsvn_apr;g' \
  244. $RPM_BUILD_ROOT%{l_prefix}/lib/libsvn_apr*.la
  245. %{l_shtool} subst \
  246. -e 's;^\(libdir='\).*\('\);\1%{l_prefix}/lib\2;g' \
  247. -e 's;libneon;libsvn_neon;g' \
  248. $RPM_BUILD_ROOT%{l_prefix}/lib/libsvn_neon.la
  249. # strip down installation
  250. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/apr-config
  251. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/apu-config
  252. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/apr.exp
  253. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/aprutil.exp
  254. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libexpat.*
  255. rm -rf $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/neon
  256. rmdir $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion >/dev/null 2>&1 || true
  257. rm -rf $RPM_BUILD_ROOT%{l_prefix}/include/apr-1
  258. rm -f $RPM_BUILD_ROOT%{l_prefix}/include/subversion-1/svn-revision.txt
  259. rm -f $RPM_BUILD_ROOT%{l_prefix}/include/subversion-1/mod_dav_svn.h
  260. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
  261. rm -rf $RPM_BUILD_ROOT%{l_prefix}/build
  262. rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/neon*
  263. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  264. # install svn_load_dirs(1) tool
  265. %{l_shtool} install -c -m 755 \
  266. -e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;' \
  267. contrib/client-side/svn_load_dirs/svn_load_dirs.pl \
  268. $RPM_BUILD_ROOT%{l_prefix}/bin/svn_load_dirs
  269. # install Subversion default global configuration files
  270. %{l_shtool} mkdir -f -p -m 755 \
  271. $RPM_BUILD_ROOT%{l_prefix}/etc/subversion
  272. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  273. %{SOURCE subversion.config} \
  274. $RPM_BUILD_ROOT%{l_prefix}/etc/subversion/config
  275. %{l_shtool} install -c -m 644 \
  276. %{SOURCE subversion.servers} \
  277. $RPM_BUILD_ROOT%{l_prefix}/etc/subversion/servers
  278. # install Subversion Bash command completion
  279. %{l_shtool} install -c -m 644 \
  280. tools/client-side/bash_completion \
  281. $RPM_BUILD_ROOT%{l_prefix}/etc/subversion/bashrc
  282. # install Subversion book
  283. %{l_shtool} mkdir -f -p -m 755 \
  284. $RPM_BUILD_ROOT%{l_prefix}/share/subversion
  285. %{l_shtool} install -c -m 644 \
  286. %{SOURCE svn-book-%{V_book_pdf}.pdf} \
  287. $RPM_BUILD_ROOT%{l_prefix}/share/subversion/svn-book.pdf
  288. %{l_shtool} install -c -m 644 \
  289. %{SOURCE svn-book-%{V_book_html}.html} \
  290. $RPM_BUILD_ROOT%{l_prefix}/share/subversion/svn-book.html
  291. %if "%{with_cvs2svn}" == "yes"
  292. # install cvs2svn(1) tool
  293. ( cd cvs2svn-%{V_cvs2svn}
  294. %{l_shtool} mkdir -f -p -m 755 \
  295. $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/cvs2svn/cvs2svn_rcsparse \
  296. $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/cvs2svn/cvs2svn_lib
  297. ( echo "#!/bin/sh"
  298. echo "PYTHONPATH=\"%{l_prefix}/libexec/subversion/cvs2svn\""
  299. echo "export PYTHONPATH"
  300. echo "%{l_prefix}/bin/python %{l_prefix}/libexec/subversion/cvs2svn/cvs2svn \${1+\"\$@\"}"
  301. ) >cvs2svn.sh
  302. %{l_shtool} install -c -m 755 \
  303. cvs2svn.sh $RPM_BUILD_ROOT%{l_prefix}/bin/cvs2svn
  304. %{l_shtool} install -c -m 644 \
  305. cvs2svn.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
  306. %{l_shtool} install -c -m 644 \
  307. cvs2svn $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/cvs2svn/
  308. %{l_shtool} install -c -m 644 \
  309. cvs2svn_rcsparse/*.py \
  310. $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/cvs2svn/cvs2svn_rcsparse/
  311. %{l_shtool} install -c -m 644 \
  312. cvs2svn_lib/*.py \
  313. $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/cvs2svn/cvs2svn_lib/
  314. ) || exit $?
  315. %endif
  316. %if "%{with_svn2cvs}" == "yes"
  317. # install svn2cvs(1) tool
  318. %{l_shtool} install -c -m 755 \
  319. -e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;' \
  320. svn2cvs.pl $RPM_BUILD_ROOT%{l_prefix}/bin/svn2cvs
  321. %{l_prefix}/bin/pod2man svn2cvs.pl >svn2cvs.1
  322. %{l_shtool} install -c -m 644 \
  323. svn2cvs.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/svn2cvs.1
  324. %endif
  325. %if "%{with_apache}" == "yes"
  326. # install Apache configuration file
  327. %{l_shtool} mkdir -f -p -m 755 \
  328. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d
  329. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  330. %{SOURCE subversion.config.apache} \
  331. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d/subversion.conf
  332. %endif
  333. # install run-command script
  334. %{l_shtool} mkdir -f -p -m 755 \
  335. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  336. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  337. %{SOURCE rc.subversion} \
  338. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  339. # create directory for default repository and svnserve pidfile
  340. %{l_shtool} mkdir -f -p -m 755 \
  341. $RPM_BUILD_ROOT%{l_prefix}/var/subversion
  342. # determine installation files
  343. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  344. %{l_files_std} \
  345. '%config %{l_prefix}/etc/subversion/*' \
  346. '%doc %{l_prefix}/share/subversion/svn-book.*'
  347. %files -f files
  348. %clean
  349. rm -rf $RPM_BUILD_ROOT
  350. %post
  351. # create default repository
  352. if [ ! -d $RPM_INSTALL_PREFIX/var/subversion/default ]; then
  353. $RPM_INSTALL_PREFIX/bin/svnadmin create \
  354. $RPM_INSTALL_PREFIX/var/subversion/default
  355. fi
  356. # after upgrade, restart service
  357. [ $1 -eq 2 ] || exit 0
  358. eval `%{l_rc} subversion status 2>/dev/null`
  359. [ ".$subversion_active" = .yes ] && %{l_rc} subversion restart
  360. %if "%{with_apache}" == "yes"
  361. eval `%{l_rc} apache status 2>/dev/null`
  362. [ ".$apache_active" = .yes ] && %{l_rc} apache restart
  363. %endif
  364. exit 0
  365. %preun
  366. # before erase, stop service
  367. [ $1 -eq 0 ] || exit 0
  368. %{l_rc} subversion stop 2>/dev/null
  369. exit 0