# SliTaz package receipt.

PACKAGE="fusecloop"
VERSION="0.20.1"
CATEGORY="system-tools"
SHORT_DESC="Mount cloop image in user space with fuse."
MAINTAINER="pascal.bellard@slitaz.org"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="http://fusecloop.sourceforge.net/"
WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
ADVANCECOMP_VERSION="1.15"
ADVANCECOMP_TARBALL="advancecomp-$ADVANCECOMP_VERSION.tar.gz"
ADVANCECOMP_URL="$SF_MIRROR/advancemame/$ADVANCECOMP_TARBALL"
DEPENDS="fuse zlib gcc-lib-base"
BUILD_DEPENDS="fuse-dev zlib-dev"
SUGGESTED="fuseiso"

# Rules to configure and make the package.
compile_rules()
{
	cd $src
	[ -s $SOURCES_REPOSITORY/$ADVANCECOMP_TARBALL ] ||
		wget -P $SOURCES_REPOSITORY $ADVANCECOMP_URL
	tar xzf $SOURCES_REPOSITORY/$ADVANCECOMP_TARBALL
	sed -i 's/dprintf/d_printf/g' *.h *.c
	patch -p0 < $stuff/fusecloop.u
	ADVANCECOMP=advancecomp-$ADVANCECOMP_VERSION
	cp *.h *.c $ADVANCECOMP
	cp create_compressed_fs.c $ADVANCECOMP/redef.cc
	sed -i 's/def FIND_BEST_COMPRESSION/ 1/' $ADVANCECOMP/redef.cc
	./configure --prefix=/usr --infodir=/usr/share/info \
	--mandir=/usr/share/man $CONFIGURE_ARGS &&
	make &&
	cd $ADVANCECOMP &&
	./configure --prefix=/usr --infodir=/usr/share/info \
	--mandir=/usr/share/man $CONFIGURE_ARGS &&
	make advdef
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/bin
	cp $src/fusecloop $fs/usr/bin
	cp $src/extract_compressed_fs $fs/usr/bin
	cp $src/advancecomp-*/advdef $fs/usr/bin/create_compressed_fs
}