### this file is sourced not run
PKGVER=12.01.2p # final version for gtk2
PKGBUILD=1
PKGARCH=x86_64

# source: james
TARBALL=fotoxx-12.01.2p.tar.xz
MD5SUM=666e7c922750986bafd1de2a6f395769
SRC_URL=http://distro.ibiblio.org/fatdog/source/800/$TARBALL
BUNDLE=

SLACKREQ='gtk2' # 
SLACKDESC="fotoxx: fotoxx $PKGVER (Photo viewer and editor)  
fotoxx:  
fotoxx: Fotoxx is a lightweight yet versatile photo viewer and re-touch tool.  
fotoxx: 
fotoxx: 
fotoxx: 
fotoxx: 
fotoxx: 
fotoxx: 
fotoxx: 
fotoxx: 
"
SLACKSUG='exiftool' # we don't have ufraw-batch

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&

	# stop annoying warning
	cd tmp/fotoxx* &&
	patch -Np1 -i ../pkg/fotoxx-no-exif-warning.patch &&
	patch -Np1 -i ../pkg/fotoxx-add-webp.patch &&
	patch -Np1 -i ../pkg/fotoxx-fix-crash-saving-other.patch &&

	# use ~/Desktop/fotoxx-trash by default
	sed -i 's/trashworks = 1/trashworks = 0/' f.file.cc &&

	# patch package name. We are not Ubuntu.
	sed -i -e 's|libimage-exiftool-perl|exiftool|g' \
		doc/userguide-en.html doc/userguide-it.html \
		fotoxx.h locales/fotoxx*.po
}

### default pkg_package
### build
pkg_build() {
	cd /tmp/fotoxx*
	sed -i -e 's|-ltiff |& -lpthread|; /dependencies.sh/d' Makefile
	make $MAKEFLAGS && make install &&
	pkg_build_slackdesc &&
	
	# rox SendTo link
	mkdir -p /etc/xdg/rox.sourceforge.net/SendTo/.image_jpeg &&
	rm -f /etc/xdg/rox.sourceforge.net/SendTo/fotoxx /etc/xdg/rox.sourceforge.net/SendTo/.image_jpeg/Fotoxx &&
	ln -sfv /usr/share/applications/kornelix-fotoxx.desktop /etc/xdg/rox.sourceforge.net/SendTo/fotoxx &&
	ln -sfv /usr/share/applications/kornelix-fotoxx.desktop /etc/xdg/rox.sourceforge.net/SendTo/.image_jpeg/Fotoxx &&
	
	# remove fotoxx's default.list
	rm -f /usr/share/applications/defaults.list
}
