# SliTaz package receipt.

PACKED_SIZE="112.0K"
UNPACKED_SIZE="372.0K"
PACKAGE="libfm"
VERSION="1.2.5"
CATEGORY="system-tools"
SHORT_DESC="File management support (core library)"
MAINTAINER="pankso@slitaz.org"
LICENSE="GPL2"
TARBALL="$PACKAGE-$VERSION.tar.xz"
WEB_SITE="http://pcmanfm.sourceforge.net"
WGET_URL="$SF_MIRROR/pcmanfm/files/$TARBALL"
EXTRA_SOURCE_FILES="$PACKAGE-reversepatch_SF949_7daeaf3.u" # Really fix segfault
WGET_URL2="https://github.com/lxde/libfm/commit/7daeaf3.patch"
#WGETURL3="https://github.com/lxde/libfm/commit/2c00984.patch" #narrow icon cell
HOST_ARCH="i486 arm"
GENERIC_MENUS="no"

SUGGESTED="gvfs"
DEPENDS="glib glibc-base libffi libgio menu-cache pcre zlib"
BUILD_DEPENDS="gtk+-dev dbus-glib-dev dbus-dev startup-notification-dev \
libxcb-dev xcb-util-dev menu-cache-dev expat-dev libgio-dev \
shared-mime-info-dev" # git-version deps: gtk-doc libtool automake

case "$ARCH" in
	i?86) BUILD_DEPENDS="$BUILD_DEPENDS intltool vala"
esac

# Rules to configure and make the package.
compile_rules()
{
	[ -s $SOURCES_REPOSITORY/$EXTRA_SOURCE_FILES ] || \
		wget -O $SOURCES_REPOSITORY/$EXTRA_SOURCE_FILES $WGET_URL2
	patch -p1 -R -i $SOURCES_REPOSITORY/$EXTRA_SOURCE_FILES
	# fix freeze when using custom action with "inode/directory":
	sed 's|TRUE, 0.5, 0.0|FALSE, 0.0f, 0.0f|' -i src/gtk/fm-standard-view.c
	./configure \
		--sysconfdir=/etc \
		$CONFIGURE_ARGS &&
	make && make install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/lib/libfm/modules $fs/usr/share/libfm
	cp -a $install/etc $fs
	cp -a $install/usr/lib/libfm.so* $fs/usr/lib
	cp -a $install/usr/lib/libfm-extra.so* $fs/usr/lib
	cp -a $install/usr/lib/libfm/modules/vfs* $fs/usr/lib/libfm/modules
	cp -a $install/usr/share/libfm/*.list $fs/usr/share/libfm
	sed "s|application/deb;$|&application/x-xz-compressed-tar;|" -i \
		$fs/usr/share/libfm/archivers.list
	# define terminal
	sed -i 2i\ 'terminal=terminal' $fs/etc/xdg/libfm/libfm.conf
	# set small & pane icon size to 16
	sed -i 's|\(\(small\|pane\)_icon_size=\).*|\116|' $fs/etc/xdg/libfm/libfm.conf
}
