# SliTaz package receipt.

PACKED_SIZE="92.0K"
UNPACKED_SIZE="340.0K"
PACKAGE="dialog"
VERSION="1.3_20220117"
CATEGORY="base-system"
SHORT_DESC="Script-interpreter which provides a set of curses widgets."
MAINTAINER="pankso@slitaz.org"
LICENSE="LGPL2.1"
WEB_SITE="https://invisible-island.net/dialog/"

TARBALL="$PACKAGE-$VERSION.tgz"
WGET_URL="https://invisible-mirror.net/archives/$PACKAGE/$PACKAGE-${VERSION/_/-}.tgz"

DEPENDS="ncursesw"
BUILD_DEPENDS="ncursesw-dev"

HOST_ARCH="i486 arm"

# What is the latest version available today?
current_version()
{
	wget -O - ${WGET_URL%/*} 2>/dev/null | \
	sed '/dialog-/!d;/gz"/!d;s|.*dialog-||;s|.t.*||;s|-|_|' | sort -Vr | sed q
}

# Rules to configure and make the package.
compile_rules()
{
	./configure			\
		--prefix=/usr		\
		--sysconfdir=/etc	\
		--mandir=/usr/share/man	\
		--with-ncursesw		\
		--enable-nls		\
		--enable-widec		\
		$CONFIGURE_ARGS &&
	make &&
	make install DESTDIR=$DESTDIR
}

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

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

	# Config file.
	cp $stuff/dialogrc	$fs/etc

	# Localisations:
	# Must these files remain in the base package
	# or can they be split off in dialog-lang?
	for lang in da de fr id it pt_BR ro ru
	  do
		mkdir -p $fs/usr/share/locale/$lang/LC_MESSAGES
		cp -a $install/usr/share/locale/$lang/LC_MESSAGES/dialog.mo \
			$fs/usr/share/locale/$lang/LC_MESSAGES/dialog.mo
	  done
}
