### this file is sourced not run
PKGVER=0.4.0
PKGBUILD=1
PKGARCH=x86_64

# source: james
TARBALL=simple-mtpfs-$PKGVER.tar.gz
MD5SUM=91306aef051c11cc0cf5f28855e42032
SRC_URL=https://github.com/phatina/simple-mtpfs/archive/refs/tags/v$PKGVER.tar.gz
BUNDLE=

SLACKREQ='libfuse libmtp libusb' # 
SLACKDESC="simple-mtpfs: simple-mtpfs $PKGVER (MTP filesystem driver)  
simple-mtpfs:  
simple-mtpfs: SIMPLE-MTPFS (Simple Media Transfer Protocol FileSystem) is a 
simple-mtpfs: file system driver, capable of operating on files on MTP devices 
simple-mtpfs: attached via USB to local machine. On the local computer where 
simple-mtpfs: the SIMPLE-MTPFS is mounted, the implementation makes use of the 
simple-mtpfs: FUSE (Filesystem in Userspace) kernel module. The practical 
simple-mtpfs: effect of this is that the end user can seamlessly interact with 
simple-mtpfs: MTP device files.  
simple-mtpfs: 
simple-mtpfs: https://github.com/phatina/simple-mtpfs
"

### default pkg_download
### default pkg_prepare
### package - add desktop files and simple GUI
pkg_package() {
	cp $CHROOT_DIR/tmp/pkg/mtp-browser.sh ./usr/bin &&
	mkdir -p ./usr/share/applications &&
	install -m644 tmp/pkg/mtp-browser.desktop ./usr/share/applications/
}

### build
pkg_build() {
	cd /tmp/simple*

	# bump down c++ version
	sed -i -e 's/AX_CXX_COMPILE_STDCXX_17/AX_CXX_COMPILE_STDCXX_11/' configure.ac &&
	# this macro and ./m4 were delete in commit 1c02d34ca3216690eef583f012c1f7368f96508d
	# shortly before bumping up c++ to stdxx17
	mkdir -p m4 && cp -v ../pkg/m4/cxx11.m4 m4/ &&

	./autogen.sh &&
	pkg_build_autoconf &&
	pkg_build_slackdesc &&

	# our custom detector
	gcc $CFLAGS -s -o /usr/bin/simple-mtpfs-detect /tmp/pkg/simple-mtpfs-detect.c -lmtp
}
