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

# source: kirk
TARBALL=rox-filer-master-080616.tar.xz
MD5SUM=2dbfc1ed52f0db76f47a596703fc4303
SRC_URL=http://distro.ibiblio.org/fatdog/source/710/$TARBALL
BUNDLE=

DESTDIR=/usr/local/apps

SLACKREQ='gtk2'
SLACKDESC='rox-filer: rox-filer-fork 2016.08 (GTK file and desktop manager)  
rox-filer:  
rox-filer: Fork of rox-filer. A fast, lightweight, file and desktop 
rox-filer: manager based on GTK2.  
rox-filer: 
rox-filer: https://github.com/jun7/rox-filer
rox-filer: 
rox-filer: 
rox-filer: 
rox-filer: 
rox-filer: 
'

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/rox* &&
	patch -Np1 -i ../pkg/rox-filer-i18n-desktop-comment.patch &&
	patch -Np1 -i ../pkg/rox-filer-2013.6-comment.patch &&
	patch -Np1 -i ../pkg/rox-filer-default-settings.patch
}

### default pkg_package
### build
pkg_build() {
	cd /tmp/rox*/ROX-Filer/src &&
	#autoconf && # automatically called
	sed -i -e "s@euid == 0 ||@@" main.c # remove root message

	export MAKE="make $MAKEFLAGS"
	cd /tmp/rox*/ROX-Filer &&
	
	# build
	./AppRun --compile &&
	# build docs
	cd src/Docs &&
	make MAN=/usr/share/man/man1 &&
	cd ../.. &&
	
	# cleanup 
	rm -rf ROX-Filer.dbg build src &&
	cd .. &&
	mkdir -p $DESTDIR
	mv ROX-Filer $DESTDIR &&
	rm -f /usr/bin/rox &&
	
	# helper script. Note: this is the only way to start ROX-Filer properly.
    # ln -s ROX-Filer won't work (missing icons)
    # ln -s AppRun also won't work (immediately quit)
    # BLFS can get away with ln -s ROX-Filer because it patches the source.
    # we don't want to patch the source
    sed -i -e "s|@DESTDIR|$DESTDIR|" /tmp/pkg/rox &&
    install -m755 /tmp/pkg/rox /usr/bin &&

    #  desktop file
	mkdir -p /usr/share/applications &&
	install -m644 /tmp/pkg/rox.desktop /usr/share/applications &&
	pkg_build_slackdesc
}


