SUMMARY="Filesystem for accessing FTP hosts"
DESCRIPTION="A file system for accessing ftp hosts based on FUSE and \
libcurl.
As the FTP protocol is not very feature rich, this filesystem does not \
fulfill every constraint of a real filesystem, but it should be usable \
for simple tasks like copying and editing files.

CurlFtpFS differentiates itself from other FTP filesystems because it \
features:

* SSLv3 and TLSv1 support
* connecting through tunneling HTTP proxies
* automatically reconnection if the server times out
* transform absolute symlinks to point back into the ftp file system

Instructions for using CurlFtpFS on Haiku are available in \
/system/documentation/packages/curlftpfs/readme.txt."
HOMEPAGE="http://curlftpfs.sourceforge.net/"
COPYRIGHT="2006-2008 Robson Braga Araujo"
LICENSE="GNU GPL v2"
REVISION="3"
SOURCE_URI="http://downloads.sourceforge.net/curlftpfs/curlftpfs-$portVersion.tar.gz"
CHECKSUM_SHA256="4eb44739c7078ba0edde177bdd266c4cfb7c621075f47f64c85a06b12b3c6958"
PATCHES="curlftpfs-$portVersion.patchset"
ADDITIONAL_FILES="readme.txt"

ARCHITECTURES="all"

PROVIDES="
	curlftpfs = $portVersion
	addon:curlftpfs
	cmd:curlftpfs
	"
REQUIRES="
	haiku
	userland_fs
	lib:libcurl
	lib:libglib_2.0
	lib:libintl
	"

BUILD_REQUIRES="
	haiku_devel
	userland_fs
	devel:libcurl
	devel:libglib_2.0
	devel:libintl
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:gcc
	cmd:gettext
	cmd:ld
	cmd:libtoolize
	cmd:make
	cmd:pkg_config
	"

BUILD()
{
	autoreconf -i
	export FUSE_CFLAGS="-D_FILE_OFFSET_BITS=64 -I/system/develop/headers/userlandfs/fuse -DB_USE_POSITIVE_POSIX_ERRORS"
	export FUSE_LIBS="-L/system/lib -luserlandfs_fuse -lposix_error_mapper"
	export ac_cv_func_malloc_0_nonnull=yes
	export ac_cv_func_realloc_0_nonnull=yes
	runConfigure ./configure
	make
}

INSTALL()
{
	install -d -m 755 \
		$addOnsDir/userlandfs \
		$manDir/man1 \
		$docDir
	install -t $addOnsDir/userlandfs \
		curlftpfs
	install -t $manDir/man1 \
		doc/curlftpfs.1
	install -t $docDir \
		$portDir/additional-files/readme.txt
}
