SUMMARY="A command-line frontend to libgphoto2"
DESCRIPTION="gGPhotoFS is a filesystem client based on libgphoto2 that \
exposes supported cameras as filesystems; while some cameras implement the \
USB Mass Storage class and already appear as filesystems (making \
this program redundant), many use the Picture Transfer Protocol (PTP) \
or some other custom protocol. But as long as the camera is supported \
by libgphoto2, it can be mounted as a filesystem using this program.

As libgphoto2 is a userspace library for interacting with cameras, \
it is natural that if one is to build a filesystem ontop of it, one \
should use FUSE, and that is what I have done."
HOMEPAGE="http://www.gphoto.org/"
COPYRIGHT="The gphoto2 team"
LICENSE="GNU GPL v2"
REVISION="3"
SOURCE_URI="git+https://github.com/gphoto/gphotofs.git#5f85be3"

ARCHITECTURES="?all"
SECONDARY_ARCHITECTURES="!x86"

PROVIDES="
	gphotofs$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgphoto2$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	userland_fs
	devel:libglib_2.0$secondaryArchSuffix >= 0.38
	devel:libgphoto2$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libpopt$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	sed -i 's/FUSE_USE_VERSION=22/FUSE_USE_VERSION=25/' Makefile.am
	libtoolize --copy --force
	autoreconf -i -f
	export FUSE_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -I/system/develop/headers/x86/gphoto2 -I/system/develop/headers/userlandfs/fuse -I/system/develop/headers/x86/glib-2.0 -I/system/develop/lib/x86/glib-2.0/include -D_FILE_OFFSET_BITS=64"
#	export FUSE_LIBS="-lbsd -lposix_error_mapper -luserlandfs_fuse -lglib-2.0 -lgthread-2.0"
	export FUSE_LIBS="-luserlandfs_fuse -lglib-2.0"
	runConfigure configure
	make $jobArgs
}

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