comparison dev-util/subversion/subversion-1.5.6.ebuild @ 108:be32a2c5e1fd

pull changes from Holgi's portage overlay
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 04 Mar 2009 02:58:24 +0100
parents ee276ccfcc7b
children 3ba6723f8197
comparison
equal deleted inserted replaced
74:54d7a26e3b70 108:be32a2c5e1fd
1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/dev-util/subversion/subversion-1.5.4.ebuild,v 1.11 2008/12/07 12:13:48 vapier Exp $
4
5 EAPI="1"
6 WANT_AUTOMAKE="none"
7
8 inherit autotools bash-completion confutils depend.apache elisp-common eutils flag-o-matic java-pkg-opt-2 libtool multilib perl-module python
9
10 DESCRIPTION="Advanced version control system"
11 HOMEPAGE="http://subversion.tigris.org/"
12 SRC_URI="http://subversion.tigris.org/downloads/${P/_/-}.tar.bz2"
13
14 LICENSE="Subversion"
15 SLOT="0"
16 KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc ~sparc-fbsd x86 ~x86-fbsd"
17 IUSE="apache2 berkdb debug doc +dso emacs extras java nls perl python ruby sasl vim-syntax +webdav-neon webdav-serf"
18 RESTRICT="test"
19
20 CDEPEND=">=dev-libs/apr-1.2.8
21 >=dev-libs/apr-util-1.2.8
22 dev-libs/expat
23 sys-libs/zlib
24 berkdb? ( =sys-libs/db-4* )
25 emacs? ( virtual/emacs )
26 ruby? ( >=dev-lang/ruby-1.8.2 )
27 sasl? ( dev-libs/cyrus-sasl )
28 webdav-neon? ( >=net-misc/neon-0.28 )
29 webdav-serf? ( net-libs/serf )"
30
31 RDEPEND="${CDEPEND}
32 java? ( >=virtual/jre-1.5 )
33 nls? ( virtual/libintl )
34 perl? ( dev-perl/URI )"
35
36 DEPEND="${CDEPEND}
37 doc? ( app-doc/doxygen )
38 java? ( >=virtual/jdk-1.5 )
39 nls? ( sys-devel/gettext )"
40
41 want_apache
42
43 S="${WORKDIR}"/${P/_/-}
44
45 # Allow for custom repository locations.
46 # This can't be in pkg_setup because the variable needs to be available to
47 # pkg_config.
48 : ${SVN_REPOS_LOC:=/var/svn}
49
50 pkg_setup() {
51 confutils_use_depend_built_with_all berkdb dev-libs/apr-util berkdb
52 java-pkg-opt-2_pkg_setup
53
54 if ! use webdav-neon && ! use webdav-serf; then
55 ewarn
56 ewarn "WebDAV support is disabled. You need WebDAV to"
57 ewarn "access repositories through the HTTP protocol."
58 ewarn
59 ewarn "WebDAV support needs one of the following USE flags enabled:"
60 ewarn " webdav-neon webdav-serf"
61 ewarn
62 ewarn "You can do this by enabling one of these flags in /etc/portage/package.use:"
63 ewarn " =${CATEGORY}/${PF} webdav-neon webdav-serf"
64 ewarn
65 ebeep
66 fi
67 }
68
69 src_unpack() {
70 unpack ${A}
71 cd "${S}"
72
73 epatch "${FILESDIR}"/1.5.0/disable-unneeded-linking.patch
74
75 sed -i \
76 -e "s/\(BUILD_RULES=.*\) bdb-test\(.*\)/\1\2/g" \
77 -e "s/\(BUILD_RULES=.*\) test\(.*\)/\1\2/g" configure.ac
78
79 sed -e 's:@bindir@/svn-contrib:@libdir@/subversion/bin:' \
80 -e 's:@bindir@/svn-tools:@libdir@/subversion/bin:' \
81 -i Makefile.in
82
83 eautoconf
84 elibtoolize
85 }
86
87 src_compile() {
88 local myconf
89
90 if use python || use perl || use ruby; then
91 myconf="${myconf} --with-swig"
92 else
93 myconf="${myconf} --without-swig"
94 fi
95
96 if use debug; then
97 append-cppflags -DSVN_DEBUG -DAP_DEBUG
98 fi
99
100 append-flags -fno-strict-aliasing
101
102 econf ${myconf} \
103 $(use_with apache2 apxs "${APXS}") \
104 $(use_with berkdb berkeley-db) \
105 $(use_enable dso runtime-module-search) \
106 $(use_enable java javahl) \
107 $(use_with java jdk "${JAVA_HOME}") \
108 $(use_enable nls) \
109 $(use_with sasl) \
110 $(use_with webdav-neon neon /usr) \
111 $(use_with webdav-serf serf /usr) \
112 --with-apr=/usr/bin/apr-1-config \
113 --with-apr-util=/usr/bin/apu-1-config \
114 --disable-experimental-libtool \
115 --without-jikes \
116 --without-junit \
117 --disable-mod-activation
118
119 emake local-all || die "Building of core Subversion failed"
120
121 if use python; then
122 emake swig-py || die "Building of Subversion Python bindings failed"
123 fi
124
125 if use perl; then
126 emake -j1 swig-pl || die "Building of Subversion Perl bindings failed"
127 fi
128
129 if use ruby; then
130 emake swig-rb || die "Building of Subversion Ruby bindings failed"
131 fi
132
133 if use java; then
134 make JAVAC_FLAGS="$(java-pkg_javac-args) -encoding iso8859-1" javahl \
135 || die "Building of Subversion JavaHL library failed"
136 fi
137
138 if use emacs; then
139 elisp-compile contrib/client-side/emacs/{dsvn,psvn,vc-svn}.el \
140 doc/svn-doc.el doc/tools/svnbook.el \
141 || die "Compilation of Emacs modules failed"
142 fi
143
144 if use extras; then
145 emake contrib || die "Building of contrib failed"
146 emake tools || die "Building of tools failed"
147 fi
148
149 if use doc; then
150 doxygen doc/doxygen.conf || die "Building of Subversion HTML documentation failed"
151
152 if use java; then
153 emake doc-javahl || die "Building of Subversion JavaHL library HTML documentation failed"
154 fi
155 fi
156 }
157
158 src_install() {
159 python_version
160 PYTHON_DIR=/usr/$(get_libdir)/python${PYVER}
161
162 emake -j1 DESTDIR="${D}" local-install || die "Installation of core of Subversion failed"
163
164 if use python; then
165 emake -j1 DESTDIR="${D}" DISTUTIL_PARAM="--prefix=${D}" LD_LIBRARY_PATH="-L${D}/usr/$(get_libdir)" install-swig-py \
166 || die "Installation of Subversion Python bindings failed"
167
168 # Move Python bindings.
169 dodir "${PYTHON_DIR}/site-packages"
170 mv "${D}"/usr/$(get_libdir)/svn-python/svn "${D}${PYTHON_DIR}/site-packages"
171 mv "${D}"/usr/$(get_libdir)/svn-python/libsvn "${D}${PYTHON_DIR}/site-packages"
172 rm -Rf "${D}"/usr/$(get_libdir)/svn-python
173 fi
174
175 if use perl; then
176 emake -j1 DESTDIR="${D}" INSTALLDIRS="vendor" install-swig-pl || die "Installation of Subversion Perl bindings failed"
177 fixlocalpod
178 fi
179
180 if use ruby; then
181 emake -j1 DESTDIR="${D}" install-swig-rb || die "Installation of Subversion Ruby bindings failed"
182 fi
183
184 if use java; then
185 emake -j1 DESTDIR="${D}" install-javahl || die "Installation of Subversion JavaHL library failed"
186 java-pkg_regso "${D}"/usr/$(get_libdir)/libsvnjavahl*.so
187 java-pkg_dojar "${D}"/usr/$(get_libdir)/svn-javahl/svn-javahl.jar
188 rm -Rf "${D}"/usr/$(get_libdir)/svn-javahl/*.jar
189 fi
190
191 # Install Apache module configuration.
192 if use apache2; then
193 dodir "${APACHE_MODULES_CONFDIR}"
194 cat <<EOF >"${D}/${APACHE_MODULES_CONFDIR}"/47_mod_dav_svn.conf
195 <IfDefine SVN>
196 LoadModule dav_svn_module modules/mod_dav_svn.so
197 <IfDefine SVN_AUTHZ>
198 LoadModule authz_svn_module modules/mod_authz_svn.so
199 </IfDefine>
200
201 # Example configuration:
202 #<Location /svn/repos>
203 # DAV svn
204 # SVNPath ${SVN_REPOS_LOC}/repos
205 # AuthType Basic
206 # AuthName "Subversion repository"
207 # AuthUserFile ${SVN_REPOS_LOC}/conf/svnusers
208 # Require valid-user
209 #</Location>
210 </IfDefine>
211 EOF
212 fi
213
214 # Install Bash Completion, bug 43179.
215 dobashcompletion tools/client-side/bash_completion subversion
216 rm -f tools/client-side/bash_completion
217
218 # Install hot backup script, bug 54304.
219 newbin tools/backup/hot-backup.py svn-hot-backup
220 rm -fr tools/backup
221
222 # Install svn_load_dirs.pl.
223 if use perl; then
224 newbin contrib/client-side/svn_load_dirs/svn_load_dirs.pl svn-load-dirs
225 fi
226 rm -f contrib/client-side/svn_load_dirs/svn_load_dirs.pl
227
228 # Install svnserve init-script and xinet.d snippet, bug 43245.
229 newinitd "${FILESDIR}"/svnserve.initd svnserve
230 if use apache2; then
231 newconfd "${FILESDIR}"/svnserve.confd svnserve
232 else
233 newconfd "${FILESDIR}"/svnserve.confd2 svnserve
234 fi
235 insinto /etc/xinetd.d
236 newins "${FILESDIR}"/svnserve.xinetd svnserve
237
238 # Install documentation.
239 dodoc CHANGES COMMITTERS README
240 dohtml www/hacking.html
241 dodoc tools/xslt/svnindex.{css,xsl}
242 rm -fr tools/xslt
243
244 # Install Vim syntax files.
245 if use vim-syntax; then
246 insinto /usr/share/vim/vimfiles/syntax
247 doins contrib/client-side/vim/svn.vim
248 fi
249 rm -f contrib/client-side/vim/svn.vim
250
251 # Install Emacs Lisps.
252 if use emacs; then
253 elisp-install ${PN} contrib/client-side/emacs/{dsvn,psvn}.{el,elc} \
254 doc/svn-doc.{el,elc} doc/tools/svnbook.{el,elc} \
255 || die "Installation of Emacs modules failed"
256 elisp-install ${PN}/compat contrib/client-side/emacs/vc-svn.{el,elc} \
257 || die "Installation of Emacs modules failed"
258 touch "${D}${SITELISP}/${PN}/compat/.nosearch"
259 elisp-site-file-install "${FILESDIR}"/1.5.0/70svn-gentoo.el \
260 || die "Installation of Emacs site-init file failed"
261 fi
262 rm -fr contrib/client-side/emacs
263
264 # Install extra files.
265 if use extras; then
266 doenvd "${FILESDIR}"/1.5.0/80subversion-extras
267
268 emake DESTDIR="${D}" install-contrib || die "Installation of contrib failed"
269 emake DESTDIR="${D}" install-tools || die "Installation of tools failed"
270
271 find contrib tools '(' -name "*.bat" -o -name "*.in" -o -name ".libs" ')' -print0 | xargs -0 rm -fr
272 rm -fr contrib/client-side/{svn-push,svnmucc}
273 rm -fr tools/server-side/{svn-populate-node-origins-index,svnauthz-validate}*
274 rm -fr tools/{buildbot,dev,diff,po}
275
276 insinto /usr/share/${PN}
277 doins -r contrib tools
278 fi
279
280 if use doc; then
281 dohtml doc/doxygen/html/*
282
283 insinto /usr/share/doc/${PF}
284 doins -r notes
285 ecompressdir /usr/share/doc/${PF}/notes
286
287 if use java; then
288 java-pkg_dojavadoc doc/javadoc
289 fi
290 fi
291 }
292
293 pkg_preinst() {
294 # Compare versions of Berkeley DB, bug 122877.
295 if use berkdb && [[ -f "${ROOT}usr/bin/svn" ]] ; then
296 OLD_BDB_VERSION="$(scanelf -nq "${ROOT}usr/$(get_libdir)/libsvn_subr-1.so.0" | grep -Eo "libdb-[[:digit:]]+\.[[:digit:]]+" | sed -e "s/libdb-\(.*\)/\1/")"
297 NEW_BDB_VERSION="$(scanelf -nq "${D}usr/$(get_libdir)/libsvn_subr-1.so.0" | grep -Eo "libdb-[[:digit:]]+\.[[:digit:]]+" | sed -e "s/libdb-\(.*\)/\1/")"
298 if [[ "${OLD_BDB_VERSION}" != "${NEW_BDB_VERSION}" ]] ; then
299 CHANGED_BDB_VERSION=1
300 fi
301 fi
302 }
303
304 pkg_postinst() {
305 use emacs && elisp-site-regen
306 use perl && perl-module_pkg_postinst
307
308 elog "Subversion Server Notes"
309 elog "-----------------------"
310 elog
311 elog "If you intend to run a server, a repository needs to be created using"
312 elog "svnadmin (see man svnadmin) or the following command to create it in"
313 elog "${SVN_REPOS_LOC}:"
314 elog
315 elog " emerge --config =${CATEGORY}/${PF}"
316 elog
317 elog "Subversion has multiple server types, take your pick:"
318 elog
319 elog " - svnserve daemon: "
320 elog " 1. Edit /etc/conf.d/svnserve"
321 elog " 2. Fix the repository permissions (see \"Fixing the repository permissions\")"
322 elog " 3. Start daemon: /etc/init.d/svnserve start"
323 elog " 4. Make persistent: rc-update add svnserve default"
324 elog
325 elog " - svnserve via xinetd:"
326 elog " 1. Edit /etc/xinetd.d/svnserve (remove disable line)"
327 elog " 2. Fix the repository permissions (see \"Fixing the repository permissions\")"
328 elog " 3. Restart xinetd.d: /etc/init.d/xinetd restart"
329 elog
330 elog " - svn over ssh:"
331 elog " 1. Fix the repository permissions (see \"Fixing the repository permissions\")"
332 elog " Additionally run:"
333 elog " groupadd svnusers"
334 elog " chown -R root:svnusers ${SVN_REPOS_LOC}/repos"
335 elog " 2. Create an svnserve wrapper in /usr/local/bin to set the umask you"
336 elog " want, for example:"
337 elog " #!/bin/bash"
338 elog " . /etc/conf.d/svnserve"
339 elog " umask 007"
340 elog " exec /usr/bin/svnserve \${SVNSERVE_OPTS} \"\$@\""
341 elog
342
343 if use apache2; then
344 elog " - http-based server:"
345 elog " 1. Edit /etc/conf.d/apache2 to include both \"-D DAV\" and \"-D SVN\""
346 elog " 2. Create an htpasswd file:"
347 elog " htpasswd2 -m -c ${SVN_REPOS_LOC}/conf/svnusers USERNAME"
348 elog " 3. Fix the repository permissions (see \"Fixing the repository permissions\")"
349 elog " 4. Restart Apache: /etc/init.d/apache2 restart"
350 elog
351 fi
352
353 elog " Fixing the repository permissions:"
354 elog " chmod -Rf go-rwx ${SVN_REPOS_LOC}/conf"
355 elog " chmod -Rf g-w,o-rwx ${SVN_REPOS_LOC}/repos"
356 elog " chmod -Rf g+rw ${SVN_REPOS_LOC}/repos/db"
357 elog " chmod -Rf g+rw ${SVN_REPOS_LOC}/repos/locks"
358 elog
359
360 elog "If you intend to use svn-hot-backup, you can specify the number of"
361 elog "backups to keep per repository by specifying an environment variable."
362 elog "If you want to keep e.g. 2 backups, do the following:"
363 elog "echo '# hot-backup: Keep that many repository backups around' > /etc/env.d/80subversion"
364 elog "echo 'SVN_HOTBACKUP_BACKUPS_NUMBER=2' >> /etc/env.d/80subversion"
365 elog
366
367 if [[ -n "${CHANGED_BDB_VERSION}" ]] ; then
368 ewarn "You upgraded from an older version of Berkeley DB and may experience"
369 ewarn "problems with your repository. Run the following commands as root to fix it:"
370 ewarn " db4_recover -h ${SVN_REPOS_LOC}/repos"
371 ewarn " chown -Rf apache:apache ${SVN_REPOS_LOC}/repos"
372 fi
373 }
374
375 pkg_postrm() {
376 use emacs && elisp-site-regen
377 use perl && perl-module_pkg_postrm
378 }
379
380 pkg_config() {
381 if [[ ! -x "${ROOT}usr/bin/svnadmin" ]] ; then
382 die "You seem to only have built the Subversion client"
383 fi
384
385 einfo ">>> Initializing the database in ${ROOT}${SVN_REPOS_LOC} ..."
386 if [[ -e "${ROOT}${SVN_REPOS_LOC}/repos" ]] ; then
387 echo "A Subversion repository already exists and I will not overwrite it."
388 echo "Delete \"${ROOT}${SVN_REPOS_LOC}/repos\" first if you're sure you want to have a clean version."
389 else
390 mkdir -p "${ROOT}${SVN_REPOS_LOC}/conf"
391
392 einfo ">>> Populating repository directory ..."
393 # Create initial repository.
394 "${ROOT}usr/bin/svnadmin" create "${ROOT}${SVN_REPOS_LOC}/repos"
395
396 einfo ">>> Setting repository permissions ..."
397 SVNSERVE_USER="$(. "${ROOT}etc/conf.d/svnserve" ; echo "${SVNSERVE_USER}")"
398 SVNSERVE_GROUP="$(. "${ROOT}etc/conf.d/svnserve" ; echo "${SVNSERVE_GROUP}")"
399 if use apache2 ; then
400 [[ -z "${SVNSERVE_USER}" ]] && SVNSERVE_USER="apache"
401 [[ -z "${SVNSERVE_GROUP}" ]] && SVNSERVE_GROUP="apache"
402 else
403 [[ -z "${SVNSERVE_USER}" ]] && SVNSERVE_USER="svn"
404 [[ -z "${SVNSERVE_GROUP}" ]] && SVNSERVE_GROUP="svnusers"
405 enewgroup "${SVNSERVE_GROUP}"
406 enewuser "${SVNSERVE_USER}" -1 -1 "${SVN_REPOS_LOC}" "${SVNSERVE_GROUP}"
407 fi
408 chown -Rf "${SVNSERVE_USER}:${SVNSERVE_GROUP}" "${ROOT}${SVN_REPOS_LOC}/repos"
409 chmod -Rf go-rwx "${ROOT}${SVN_REPOS_LOC}/conf"
410 chmod -Rf o-rwx "${ROOT}${SVN_REPOS_LOC}/repos"
411 fi
412 }