# SliTaz package receipt.

PACKED_SIZE="68.0K"
UNPACKED_SIZE="476.0K"
PACKAGE="galculator"
VERSION="2.1.4"
CATEGORY="system-tools"
SHORT_DESC="Graphical scientific calculator."
MAINTAINER="pankso@slitaz.org"
LICENSE="GPL2"
WEB_SITE="http://galculator.mnim.org/"

TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="https://github.com/$PACKAGE/$PACKAGE/archive/v$VERSION/$TARBALL"

DEPENDS="gtk+"
BUILD_DEPENDS="autoconf automake flex gtk+-dev libtool sdft"

GENERIC_PIXMAPS="no"; GENERIC_MENUS="no"

HOST_ARCH="i486 arm"

current_version()
{
	wget -O - ${WGET_URL%/arch*}/tags 2>/dev/null | \
	sed '/archive.*tar/!d;s|.*/v\(.*\).tar.*|\1|;q'
}

# Rules to configure and make the package.
compile_rules()
{
	# Binutils 2.22 break many packages build without LDFLAGS set correctly.
	export LDFLAGS="$LDFLAGS -Wl,--copy-dt-needed-entries"

	mkdir	m4
	./autogen.sh			\
		--enable-gtk3=no	\
		--disable-quadmath	\
		$CONFIGURE_ARGS &&
	make &&
	make install &&
	sdft $install/usr/share/applications/galculator.desktop -i -tf \
		-a "Name[fr]=Calculatrice scientifique" \
		-a "Name[pt]=Calculadora Científica" \
		-a "Name[pt_BR]=Calculadora Científica" \
		-a "Name[ru]=Инженерный калькулятор" \
		-a "Name[zh_CN]=科学计算器" \
		-a "Comment[ru]=Выполняйте простые и инженерные вычисления" \
		-s "Icon=accessories-calculator" \
		-s "Categories=Utility;Calculator;"
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/share/icons/hicolor/48x48

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

	cp -a $install/usr/share/galculator	$fs/usr/share
	find $fs/usr/share/galculator -name '*gtk3*' -delete
	sed -i 's|^[ ]*||g' $fs/usr/share/galculator/ui/*

	cp -a $install/usr/share/icons/hicolor/48x48/apps \
		$fs/usr/share/icons/hicolor/48x48

	cp -a $install/usr/share/applications	$fs/usr/share
}
