# SliTaz package receipt.

PACKED_SIZE="412.0K"
UNPACKED_SIZE="1.8M"
PACKAGE="midori"
VERSION="0.5.2"
CATEGORY="network"
TAGS="web-browser"
SHORT_DESC="Lightweight web browser based on GTK+/WebKit"
MAINTAINER="pankso@slitaz.org"
LICENSE="LGPL2.1"
WEB_SITE="https://github.com/midori-browser/core"

TARBALL="$PACKAGE-$VERSION.tar.bz2"
WGET_URL="https://archive.xfce.org/src/archive/$PACKAGE/${VERSION%.*}/$TARBALL"

GENERIC_MENUS="no"
SUGGESTED="midori-lang"
DEPENDS="libnotify libunique libsoup libwebkit libxslt xorg-libXss"
BUILD_DEPENDS="glib-dev gtk+-dev libnotify-dev libsoup-dev libunique-dev
	libwebkit-dev libxslt-dev xorg-libXss-dev"

# Handle cross compilation
case "$ARCH" in
	i?86) 
		BUILD_DEPENDS="$BUILD_DEPENDS cmake desktop-file-utils-extra 
		librsvg-apps python vala"
esac

# What is the latest version available today?
current_version()
{
	wget -O - https://github.com/midori-browser/core/releases 2>/dev/null | \
	sed '/tag\//!d;s|.*tag/v*||;s|".*||;q'
}

# Rules to configure and make the package.
compile_rules()
{
	sed -i 's|[^\.]ListStore| Gtk.ListStore|' extensions/history-list.vala
	sed -i 's|store.remove (iter)|store.remove (ref iter)|' extensions/transfers.vala
	#mkdir -p build && cd build
	#cmake \
		#-DCMAKE_INSTALL_PREFIX=/usr \
		#-DCMAKE_INSTALL_LIBDIR=lib \
		#-DUSE_ZEITGEIST=0 .. &&
	./configure \
		--jobs=4 \
		--prefix=/usr \
		--disable-zeitgeist &&
	make &&
	make install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/share/doc/midori
	mkdir -p $fs/usr/share/pixmaps

	cp -a $install/etc	$fs
	cp $stuff/config	$fs/etc/xdg/midori
	# add SliTaz token to DDG, add Twitter search
	cd $fs
	patch -p1 < $stuff/search.patch
	status

	# Midori use sqlite to store bookmarks
	#cp $stuff/bookmarks.xbel $fs/etc/xdg/midori

	cp -a $install/usr/bin	$fs/usr
	cp -a $install/usr/lib	$fs/usr

	# desktop files
	cp -a $install/usr/share/applications $fs/usr/share

	cp -a $install/usr/share/doc/midori/faq* $fs/usr/share/doc/midori
	cp -a $install/usr/share/midori		$fs/usr/share

	# Icons
	cp -a $install/usr/share/icons		$fs/usr/share
	rm -rf					$fs/usr/share/icons/hicolor/scalable
}
