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

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

DESTDIR=/usr/local/apps
ROXFILER=ROX-Filer-jun7

SLACKREQ='gtk2'
SLACKDESC="rox-filer-jun7: rox-filer-jun7 $PKGVER (GTK file and desktop manager)  
rox-filer-jun7:  
rox-filer-jun7: Fork of rox-filer by jun7, with advanced features.
rox-filer-jun7: A fast, lightweight, file and desktop manager based on GTK2.  
rox-filer-jun7: 
rox-filer-jun7: https://github.com/jun7/rox-filer
rox-filer-jun7: 
rox-filer-jun7: 
rox-filer-jun7: 
rox-filer-jun7: 
rox-filer-jun7: 
"

### 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 &&
	patch -Np1 -i ../pkg/remove-gethostbyname.patch &&
	patch -Np1 -i ../pkg/export-pinboard-click.patch &&
	patch -Np1 -i ../pkg/rpc-add-drive-icon.patch &&
	patch -Np1 -i ../pkg/export-panel-click.patch &&
	patch -Np1 -i ../pkg/minibuffer-settings.patch &&
	#patch -Np1 -i ../pkg/toolbar-icon-for-context-menu.patch &&	
	true
}

### 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/$ROXFILER &&
	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/$ROXFILER|" /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 &&
	
	# fatdog icon theme
	cp -a /tmp/pkg/ROX/* $DESTDIR/$ROXFILER/ROX &&
	echo 'gtk-icon-theme-name="ROX"' > /root/.gtkrc.mine &&
	
	# translations
	cp -a /tmp/pkg/Messages/* $DESTDIR/$ROXFILER/Messages &&
	
	pkg_build_slackdesc
}
 
 
 
