# Maintainer: Simone Rota, sip at crux dot nu
# Packager: Erlend Bergsås Mikkelsen, howl at online dot no
# Description: a small filer/desktop application based on gtk
# URL: http://rox.sourceforge.net
# Depends on: libglade, shared-mime-info

name=rox
version=2.8
release=1
source=(http://dl.sourceforge.net/sourceforge/rox/$name-filer-$version.tar.bz2)

build () {
	cd $name-filer-$version/ROX-Filer
	./AppRun --compile \
		--with-platform="" \
		--sysconfdir=/usr/ROX/Choices

	rm -rf src Messages Help Action.png Action-it.png build
	
	cd ..
	mkdir -p $PKG/usr/{man/man1,bin,ROX/Apps,ROX/Choices}
	rm -f ROX-Filer/ROX-Filer.dbg
	cp -r ROX-Filer $PKG/usr/ROX/Apps
	cp *.1 $PKG/usr/man/man1


cat << "EOF" > $PKG/usr/ROX/Apps/ROX-Filer/AppRun
#!/bin/sh

APP_DIR=`dirname $0`
APP_DIR=`cd "$APP_DIR";pwd`

exec "$APP_DIR/ROX-Filer" "$@"
EOF

cat << "EOF" > $PKG/usr/ROX/Choices/rox.conf
#!/bin/sh

CHOICESPATH="$HOME/.rox:/usr/ROX/Choices:$CHOICESPATH"
APP_DIR="/usr/ROX/Apps"
EOF

cat << "EOF" > $PKG/usr/bin/rox
#!/bin/sh
if [[ -f /usr/ROX/Choices/rox.conf ]]; then
	source /usr/ROX/Choices/rox.conf
fi;
if [[ -d "$APP_DIR/ROX-Filer" ]]; then
	APP_DIR="$APP_DIR/ROX-Filer";
fi;
export APP_DIR CHOICESPATH
/usr/ROX/Apps/ROX-Filer/ROX-Filer "$@"
EOF

	chmod a+x $PKG/usr/bin/rox
}
