SUMMARY="Fuse-filesystem utilizing the sftp service"
DESCRIPTION="A filesystem client based on the SSH File Transfer Protocol \

Mount with mount -t userlandfs -p sshfs .... You can pass arguments to the \
client FS by adding them to the argument of the -p option  after the client \
FS name (as one string, like: -p foofs arg1 arg2). To get debug output run \
the userlandfs server manually in a terminal before mounting \
(userlandfs_server sshfs). You'll also have to do that, if the client FS \
requires input like the password for sshfs.\

Usage:
mkdir /mnt
echo password | /system/servers/userlandfs_server sshfs
mount -t userlandfs -o 'sshfs user@server:./ -o password_stdin' /mnt"
HOMEPAGE="https://github.com/libfuse/sshfs/"
COPYRIGHT="2004-2012 Miklos Seredi"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://github.com/libfuse/sshfs/archive/sshfs-$portVersion.tar.gz"
CHECKSUM_SHA256="8ab824024104508d90b9e10292b2c27a34a248aca6712593e5695cfbae20f633"
SOURCE_DIR="sshfs-sshfs-$portVersion"
PATCHES="sshfs-$portVersion.patch"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 !x86"

PROVIDES="
	sshfs_fuse$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	userland_fs
	cmd:ssh
	lib:libglib_2.0$secondaryArchSuffix >= 0.38
	"

BUILD_REQUIRES="
	userland_fs
	devel:libglib_2.0$secondaryArchSuffix >= 0.38
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	userland_fs
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:ssh
	"

BUILD()
{
	touch config.h.in

	aclocal
	autoconf
	automake --add-missing --force-missing

	export SSHFS_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -I/system/develop/headers/userlandfs/fuse -I/system/develop/headers/glib-2.0 -I/system/develop/lib/glib-2.0/include -D_FILE_OFFSET_BITS=64"

	export SSHFS_LIBS="-lbsd -lposix_error_mapper -lnetwork -luserlandfs_fuse -lglib-2.0 -lgthread-2.0"
	runConfigure configure
	make $jobArgs
}

INSTALL()
{
	mkdir -p $prefix/add-ons/userlandfs
	cp sshfs $prefix/add-ons/userlandfs
}
