Receipt for: gettext

source stuff/gettext-0.21-disable-libtextstyle.patch
# SliTaz package receipt.

PACKAGE="gettext"
VERSION="0.21"
CATEGORY="development"
SHORT_DESC="Utilities for the GNU Translation Project."
MAINTAINER="pankso@slitaz.org"
LICENSE="GPL3"
WEB_SITE="https://www.gnu.org/software/gettext/"

TARBALL="$PACKAGE-$VERSION.tar.xz"
WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL"

DEPENDS="acl-dev attr-dev gettext-base gettext-tools glib-dev liblzma \
libxml2 libxml2-dev m4 ncurses pcre-dev"
BUILD_DEPENDS="automake m4 acl-dev coreutils glib-dev libxml2-dev libunistring-dev"
# libcroco libcroco-dev unmaintained
SPLIT="gettext-base gettext-tools"

HOST_ARCH="i486 arm x86_64"

# Handle cross compilation. Glibc-locale are installed in cross chroot.
case "$ARCH" in
	arm) BUILD_DEPENDS="attr-dev ncurses-dev libxml2-tools libxml2-dev"
	     ARCH_ARGS="--disable-acl" ;;
esac

# What is the latest version available today?
current_version()
{
	wget -O - https://ftp.gnu.org/gnu/$PACKAGE/ 2>/dev/null | \
	sed "/latest/d;/$PACKAGE-/!d;/tar/!d;s|.*$PACKAGE-\\(.*\\).tar.*\".*|\\1|" | sort -Vr | sed q
}

# Rules to configure and make the package.
compile_rules()
{
	# 0.21	for textstyle.h to be found:
	#export	CFLAGS="$CFLAGS -I../../libtextstyle/lib" &&

	#Disable libtextstyle required by libcroco unmaintained
	patch -p1 -i $stuff/gettext-0.21-disable-libtextstyle.patch

	# Fail fast if autoreconf can't run (e.g. automake/aclocal missing): without
	# the && it fell through to ./configure+make on the now-stale generated
	# files, which re-triggered maintainer-mode "aclocal-1.16: not found" deep
	# in make -- a cryptic symptom of the real cause (automake bdep absent).
	autoreconf --force &&

	./configure		\
		$CONFIGURE_ARGS	\
		$ARCH_ARGS &&
	make &&
	make install
}

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

	cp -a $install/usr/bin				$fs/usr
	cp -a $install/usr/lib				$fs/usr
	cp -a $install/usr/include			$fs/usr
	cp -a $install/usr/share/aclocal		$fs/usr/share
	cp -a $install/usr/share/gettext		$fs/usr/share
	cp -a $install/usr/share/gettext-$VERSION	$fs/usr/share

	# Ensure remove .la files
	find $fs -name "*.la" -delete

	# Remove "gettext-base" and "gettext-tools" files.
	for bin in gettext gettext.sh envsubst ngettext msgcat msgfmt msgmerge xgettext
	  do
		rm $fs/usr/bin/$bin
	  done
	rm					$fs/usr/lib/libgettextlib*.so*
	rm					$fs/usr/lib/libgettextsrc*.so*
}