SUMMARY="A sophisticated file transfer program with command line interface."
HOMEPAGE="http://lftp.yar.ru"
COPYRIGHT="1996-2012 by Alexander V. Lukyanov"
LICENSE="GNU GPL v3"
SRC_URI="http://lftp.yar.ru/ftp/lftp-$portVersion.tar.gz"
CHECKSUM_SHA256="441f472f9d3f13b0861fbf3e45f5d08d8cf999d2229b4ee446815d52ad673bf2"
REVISION="1"
ARCHITECTURES="!x86_gcc2 x86 x86_64 arm"

PATCHES="lftp-$portVersion.patchset"

GLOBAL_WRITABLE_FILES="
	settings/lftp.conf keep-old
"

PROVIDES="
	lftp = $portVersion
	lib:liblftp_jobs$secondaryArchSuffix = 0.0.0 compat >= 0
	lib:liblftp_tasks$secondaryArchSuffix = 0.0.0 compat >= 0
	"
	
if [ -z "$secondaryArchSuffix" ]; then
	PROVIDES="$PROVIDES
		cmd:lftp = $portVersion compat >= 4
		cmd:lftpget = $portVersion compat >= 4
		"
fi

REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	ca_root_certificates
	lib:libreadline$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel >= $haikuVersion
	devel:libreadline$secondaryArchSuffix
	devel:libcrypto$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:autoconf
	cmd:automake
	cmd:aclocal
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize
	cmd:make
	cmd:find
	cmd:pkg_config
	cmd:sed
	"

PATCH()
{
	sed -i configure.ac -e 's|^AM_CONFIG_HEADER|AC_CONFIG_HEADERS|g'
}

BUILD()
{
	libtoolize --force --copy --install
	aclocal -I m4
	autoconf
	automake
	runConfigure ./configure --with-openssl --enable-static \
		--with-modules
	make $jobArgs
}

INSTALL()
{
	make install
	
	# prepare develop/lib
	prepareInstalledDevelLibs liblftp-jobs liblftp-tasks
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
		
	# Remove stuff we don't need in the secondary architecture base package.
	if [ -n "$secondaryArchSuffix" ]; then
		rm -rf $binDir
		rm -rf $documentationDir
	fi
}

TEST()
{
	make check
}

DESCRIPTION="
lftp is sophisticated file transfer program with command line interface. It \
supports FTP, HTTP, FISH, SFTP and FILE (local FS) protocols. GNU Readline \
library is used for input. BitTorrent protocol is supported as built-in \
torrent command.
Low level stuff supported: ftp proxy, http proxy, ftp over http, opie/skey, \
fxp transfers, automatic retrying on non-fatal errors and timeouts, ipv6, \
socks, http/1.1, sftp v3-v6.
"

# ----- devel package -------------------------------------------------------

PROVIDES_devel="
	lftp${secondaryArchSuffix}_devel = $portVersion
	devel:liblftp_jobs$secondaryArchSuffix = 0.0.0 compat >= 0
	devel:liblftp_tasks$secondaryArchSuffix = 0.0.0 compat >= 0
	"
REQUIRES_devel="
	lftp$secondaryArchSuffix == $portVersion base
	"
