SUMMARY="Open source version control system"
DESCRIPTION="Subversion (svn) exists to be universally recognized and adopted \
as an open-source, centralized version control system characterized by its \
reliability as a safe haven for valuable data; the simplicity of its model \
and usage; and its ability to support the needs of a wide variety of users \
and projects, from individuals to large-scale enterprise operations."
HOMEPAGE="https://subversion.apache.org/"
COPYRIGHT="2010-2020 The Apache Software Foundation"
LICENSE="Apache-Subversion"
REVISION="1"
SOURCE_URI="http://archive.apache.org/dist/subversion/subversion-$portVersion.tar.bz2"
CHECKSUM_SHA256="2c5da93c255d2e5569fa91d92457fdb65396b0666fad4fd59b22e154d986e1a9"
PATCHES="subversion-$portVersion.patchset"

ARCHITECTURES="all"

USER_SETTINGS_FILES="
	settings/subversion directory
	"

PROVIDES="
	subversion = $portVersion compat >= 1.8
	cmd:svn = $portVersion compat >= 1.8
	cmd:svnadmin = $portVersion compat >= 1.8
	cmd:svnbench = $portVersion compat >= 1.9
	cmd:svndumpfilter = $portVersion compat >= 1.8
	cmd:svnfsfs = $portVersion compat >= 1.9
	cmd:svnlook = $portVersion compat >= 1.8
	cmd:svnmucc = $portVersion compat >= 1.8
	cmd:svnrdump = $portVersion compat >= 1.8
	cmd:svnserve = $portVersion compat >= 1.8
	cmd:svnsync = $portVersion compat >= 1.8
	cmd:svnversion = $portVersion compat >= 1.8
	lib:libsvn_client_1 = 0.0.0 compat >= 0
	lib:libsvn_delta_1 = 0.0.0 compat >= 0
	lib:libsvn_diff_1 = 0.0.0 compat >= 0
	lib:libsvn_fs_1 = 0.0.0 compat >= 0
	lib:libsvn_fs_fs_1 = 0.0.0 compat >= 0
	lib:libsvn_fs_util_1 = 0.0.0 compat >= 0
	lib:libsvn_fs_x_1 = 0.0.0 compat >= 0
	lib:libsvn_ra_1 = 0.0.0 compat >= 0
	lib:libsvn_ra_local_1 = 0.0.0 compat >= 0
	lib:libsvn_ra_serf_1 = 0.0.0 compat >= 0
	lib:libsvn_ra_svn_1 = 0.0.0 compat >= 0
	lib:libsvn_repos_1 = 0.0.0 compat >= 0
	lib:libsvn_subr_1 = 0.0.0 compat >= 0
	lib:libsvn_swig_perl_1 = 0.0.0 compat >= 0
	lib:libsvn_wc_1 = 0.0.0 compat >= 0
	"
REQUIRES="
	haiku
	lib:libapr_1
	lib:libaprutil_1
	lib:libcrypto
	lib:libexpat
	lib:libiconv
	lib:liblz4
	lib:libserf_1
	lib:libsqlite3
	lib:libssl
	lib:libxml2
	lib:libz
	"

PROVIDES_devel="
	subversion_devel = $portVersion compat >= 1.8
	devel:libsvn_client_1 = 0.0.0 compat >= 0
	devel:libsvn_delta_1 = 0.0.0 compat >= 0
	devel:libsvn_diff_1 = 0.0.0 compat >= 0
	devel:libsvn_fs_1 = 0.0.0 compat >= 0
	devel:libsvn_fs_fs_1 = 0.0.0 compat >= 0
	devel:libsvn_fs_util_1 = 0.0.0 compat >= 0
	devel:libsvn_fs_x_1 = 0.0.0 compat >= 0
	devel:libsvn_ra_1 = 0.0.0 compat >= 0
	devel:libsvn_ra_local_1 = 0.0.0 compat >= 0
	devel:libsvn_ra_serf_1 = 0.0.0 compat >= 0
	devel:libsvn_ra_svn_1 = 0.0.0 compat >= 0
	devel:libsvn_repos_1 = 0.0.0 compat >= 0
	devel:libsvn_subr_1 = 0.0.0 compat >= 0
	devel:libsvn_swig_perl_1 = 0.0.0 compat >= 0
	devel:libsvn_wc_1 = 0.0.0 compat >= 0
	"
REQUIRES_devel="
	subversion == $portVersion base
	"

BUILD_REQUIRES="
	haiku_devel
	expat_devel >= 2.1
	libiconv_devel >= 1.13
	sqlite_devel >= 3.4
	devel:libapr_1 >= 0.3
	devel:libaprutil_1 >= 0.3
	devel:libcrypto
	devel:liblz4
	devel:libserf_1
	devel:libssl
	devel:libxml2 >= 2.7
	devel:libz
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:gcc
	cmd:ld
	cmd:libtoolize
	cmd:make
	cmd:perl
	cmd:pkg_config
	cmd:python
	cmd:sed
	cmd:swig
	"

BUILD()
{
	CFLAGS=-std=c9x CPPFLAGS=-P LIBS="-lcrypto -lssl" runConfigure ./configure \
		--with-apr=$portPackageLinksDir/devel~libapr_1 \
		--with-apr-util=$portPackageLinksDir/devel~libaprutil_1 \
		--with-serf \
		--with-zlib \
		--with-editor=nano \
		--with-utf8proc=internal \
		--disable-nls
	make $jobArgs
}

INSTALL()
{
	make install
	rm $libDir/libsvn*.la
	#if type -p python > /dev/null;then
	#	make install-swig-py swig_pydir=${libDir}/python2.7/site-packages/libsvn swig_pydir_extra=${libDir}/python2.7/site-packages/svn
	#fi
	if type -p perl > /dev/null;then
		make install-swig-pl
	fi
	#if type -p ruby > /dev/null;then
	#	make install-swig-rb
	#fi
	mv $prefix/data/pkgconfig $libDir/

	prepareInstalledDevelLibs \
		libsvn_client-1 \
		libsvn_delta-1 \
		libsvn_diff-1 \
		libsvn_fs-1 \
		libsvn_fs_fs-1 \
		libsvn_fs_util-1 \
		libsvn_fs_x-1 \
		libsvn_ra-1 \
		libsvn_ra_local-1 \
		libsvn_ra_svn-1 \
		libsvn_repos-1 \
		libsvn_subr-1 \
		libsvn_swig_perl-1 \
		libsvn_wc-1 \
		libsvn_ra_serf-1
	fixPkgconfig
	rm $developLibDir/*.la

	# devel package
	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
