### this file is sourced not run
PKGVER=3.2.3 # this requires meson, the latest autoconf version is 3.1.1
PKGBUILD=1
PKGARCH=x86_64

# source: post-BLFS 8.2 2018-07-25
TARBALL=fuse-$PKGVER.tar.xz
MD5SUM=e06e70bbba2e72a80f828abd867ec063
SRC_URL=https://github.com/libfuse/libfuse/releases/download/fuse-$PKGVER/$TARBALL
BUNDLE=

SLACKREQ=
SLACKDESC="libfuse3: libfuse3 $PKGVER (Filesystem in Userspace core library)  
libfuse3:  
libfuse3: FUSE (Filesystem in Userspace) is a simple interface for userspace 
libfuse3: programs to export a virtual filesystem to the Linux kernel. Fuse 
libfuse3: also aims to provide a secure method for non privileged users to 
libfuse3: create and mount their own filesystem implementations.  
libfuse3: 
libfuse3: 
libfuse3: 
libfuse3: 
libfuse3:
"

### default pkg_download
### default pkg_prepare
### default pkg_package
### build
pkg_build() {
	#return 1
	#MESONFLAGS="$MESONFLAGS --sbindir=/sbin" # meson will vomit on this
	MESONCONFFLAGS="$MESONCONFFLAGS -D disable-mtab=true -D udevrulesdir=/etc/udev/rules.d"
	pkg_build_meson &&
	pkg_build_slackdesc &&
	#return 1

	# Note: all the acrobatics below is because passing --sbindir /sbin
	# will make meson vomit. So we have to cleanup the mess ourselves after build.
	# Such a brilliant build system </sarcasm>
	# autoconf build is much better in this respect
	
	# BLFS fixes. Move libs to its proper place
	mv -vf   /usr/$LIBDIR/libfuse3.so.3*     /$LIBDIR                   &&
	ln -sfvn ../../$LIBDIR/libfuse3.so.$PKGVER /usr/$LIBDIR/libfuse3.so &&

	mv -vf /usr/bin/fusermount3  /bin         &&
	mv -vf /usr/sbin/mount.fuse3 /sbin        &&
	chmod u+s /bin/fusermount3                &&

	install -v -m755 -d /usr/share/doc/fuse-$PKGVER      &&
	install -v -m644    ../doc/{README.NFS,kernel.txt} \
						/usr/share/doc/fuse-$PKGVER      &&
	cp -Rv ../doc/html  /usr/share/doc/fuse-$PKGVER      &&

	mv /usr/share/man/man8/{mount.fuse.8.gz,mount.fuse3.8.gz} &&
	gunzip /usr/share/man/{man1/fusermount3.1,man8/mount.fuse3.8}.gz &&
	rm -rf /etc/init.d && # don't want the init script &&

	return 0
	
<< "VERSION311RECIPE"
	CONFFLAGS="$CONFFLAGS --disable-static --exec-prefix=/ \
		INIT_D_PATH=/tmp/init.d UDEV_RULES_PATH=/etc/udev/rules.d \
		--disable-mtab"
return 1
	pkg_build_autoconf &&
	
	# relocate from /usr/$LIBDIR to /$LIBDIR
	mv -v   /usr/$LIBDIR/libfuse3.so.* /$LIBDIR &&
	ln -sfv ../../$LIBDIR/libfuse3.so.$PKGVER /usr/$LIBDIR/libfuse3.so &&
	rm -rf  /tmp/init.d &&

	install -v -m755 -d /usr/share/doc/fuse-$PKGVER &&
	install -v -m644    doc/{README.NFS,kernel.txt} \
                    /usr/share/doc/fuse-$PKGVER &&
    cp -R doc/html /usr/share/doc/fuse-$PKGVER &&

    # additional relocations
    mv /usr/share/man/man8/mount.fuse.8 /usr/share/man/man8/mount.fuse3.8 &&
	#mv /usr/lib64/udev/rules.d/* /lib64/udev/rules.d && rm -r /usr/lib64/udev &&
    
	pkg_build_slackdesc &&
	
	# default config - override in fatdog-scripts
	cat > /etc/fuse.conf << "EOF"
# Set the maximum number of FUSE mounts allowed to non-root users.
# The default is 1000.
#
#mount_max = 1000

# Allow non-root users to specify the 'allow_other' or 'allow_root'
# mount options.
#
#user_allow_other
EOF
VERSION311RECIPE
}


