# $Id: Portfile 55977 2009-08-22 17:54:18Z dluke@macports.org $

PortSystem 1.0

name			subversion
version			1.6.5
categories		devel
platforms		darwin
maintainers		geeklair.net:dluke
description		A version control system designed to be a better cvs.

long_description	Subversion is a version control system designed to be \
			as similar to cvs(1) as possible, while fixing many \
			outstanding problems with cvs(1).

homepage		http://subversion.tigris.org/
master_sites		${homepage}downloads/
use_bzip2		yes
checksums	md5	1a53a0e72bee0bf814f4da83a9b6a636 \
		sha1	c575c5facf972e501049ad47a9be05c5cf228388 \
		rmd160	eb2dad92de044352dbe16e0f9c81cadcd5dcd17e

depends_lib		port:expat port:neon \
			port:apr port:apr-util \
			port:db46 port:sqlite3 \
			port:gettext port:libiconv \
			port:serf port:cyrus-sasl2

test.run		yes
test.target		check
test.env		CLEANUP=true

patchfiles		patch-Makefile.in.diff

configure.args		--with-berkeley-db=:${prefix}/include/db46:${prefix}/lib/db46:db-4.6 \
			--with-neon=${prefix} --with-apr=${prefix}/bin/apr-1-config \
			--with-apr-util=${prefix}/bin/apu-1-config --without-apxs \
			--mandir=\\\${prefix}/share/man \
			--disable-neon-version-check --with-serf=${prefix} \
			--with-sasl=${prefix}

# port:cyrus-sasl2 is not universal
universal_variant	no

use_parallel_build	yes
build.target		all

pre-test {
			set x {}
			fs-traverse dir ${worksrcpath}/subversion {
				if {[file tail ${dir}] == ".libs" && [file isdirectory ${dir}]} {
					lappend x ${dir}
					continue
				}
			}

			test.env-append DYLD_LIBRARY_PATH=[join ${x} ":"]
			}

pre-configure {		reinplace "s|hardcode_direct=yes|hardcode_direct=no|g" \
				${worksrcpath}/configure
			}

post-configure {	reinplace "s|need_relink=yes|need_relink=no|g" \
				${worksrcpath}/libtool
			}

variant mod_dav_svn 	description {Install the subversion apache module (mod_dav_svn)} {
			depends_build path:apache2/bin/apxs:apache2
			configure.args-append \
				--with-apxs=${prefix}/apache2/bin/apxs \
				--disable-mod-activation
			configure.args-delete --without-apxs

			destroot.violate_mtree yes
			}

variant no_neon 	description {Build without neon (http/https support)} {
			depends_lib-delete	port:neon
			configure.args-append	--without-neon
			configure.args-delete	--with-neon=${prefix}
			}

variant no_bdb		description {Build without support for BerkeleyDB repositories} {
			depends_lib-delete	port:db46
			configure.args-delete	--with-berkeley-db=:${prefix}/include/db46:${prefix}/lib/db46:db-4.6
			configure.args-append	--without-berkeley-db
			}

variant mac_os_x_server_mod_dav_svn 	description {Unsupported - attempt to build the subversion apache module with apple supplied apache2} {
					configure.args-append \
						--with-apxs=/opt/apache2/bin/apxs \
						--disable-mod-activation
					configure.args-delete --without-apxs

					destroot.violate_mtree yes

					post-install {
							ui_warn "This variant (+mac_os_x_server_mod_dav_svn) builds against the Apple-supplied apache2 in /opt/apache2 and thus may have problems that the normal variant (+mod_dav_svn) which builds against the macports supplied apache2 will not have."
					    		 }
                       	 		}

variant tools 		description {Install some optional extra subversion tools} {
			build.target-append svnmucc
			post-destroot {
				xinstall -d -m 755 ${destroot}${prefix}/share/${name}
				ln -s ../share/${name}/tools/client-side/svnmucc/svnmucc ${destroot}${prefix}/bin/
				eval delete [glob ${worksrcpath}/tools/client-side/svnmucc/svnmucc{.o,.libs}]
				copy ${worksrcpath}/tools ${destroot}${prefix}/share/${name}/tools
				copy ${worksrcpath}/contrib ${destroot}${prefix}/share/${name}/contrib
				}
			}

# see http://subversion.tigris.org/issues/show_bug.cgi?id=2464
variant unicode_path	description {Installs a hack to workaround MacOSX unicode path issues} {
			patchfiles-append  patch-path.c.diff
			post-install {
				ui_warn "This variant (+unicode_path) implements a hack to deal with composed/decomposed unicode handling on Mac OS X which is different from linux and windows. It is an implementation of solution 1 from http://svn.collab.net/repos/svn/trunk/notes/unicode-composition-for-filenames which _WILL_ break some setups. Please be sure you understand what you are asking for when you install this variant."
				}
			}

variant bash_completion		{
				depends_run-append port:bash-completion
				post-destroot {
					xinstall -d ${destroot}${prefix}/etc/bash_completion.d
					copy ${worksrcpath}/tools/client-side/bash_completion ${destroot}${prefix}/etc/bash_completion.d/subversion
					}
				}

variant disable_keychain	description {Disables support for the MacOS X Keychain} {
					configure.args-append --disable-keychain
				}

# 10.3 says -> CarbonCore/MacTypes.h: No such file or directory
platform darwin 7 {		configure.args-append \
					--disable-keychain
				}

livecheck.check regex
livecheck.regex {Subversion is (\d+(?:\.\d+)*)}
