# SliTaz package receipt.

PACKAGE="pcre2"
VERSION="10.40"
CATEGORY="system-tools"
SHORT_DESC="Perl 5 Compatible Regular Expression 2, library."
MAINTAINER="al.bobylev@gmail.com"
LICENSE="BSD"
WEB_SITE="https://www.pcre.org/"

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

BUILD_DEPENDS="automake libtool"

HOST_ARCH="i486 arm"

# What is the latest version available today?
current_version()
{
	wget -O - https://sourceforge.net/projects/pcre/files/pcre2/ 2>/dev/null | \
	sed '/scope="row/!d;s|.*href="|"https://sourceforge.net|;q' | xargs wget -O - 2>/dev/null | \
	sed '/scope="row/!d;s|.*/pcre2/||;s|/.*||;q'
}

# Rules to configure and make the package.
compile_rules()
{
	./autogen.sh &&
	./configure			\
		--prefix=/usr		\
		--enable-pcre2-16	\
		--enable-pcre2-32	\
		--enable-jit		\
		$CONFIGURE_ARGS &&
	make &&
	make install

	find $install/usr/share/man -type f -exec gzip -9 \{\} \;
	for i in $(find $install/usr/share/man -type l)
	  do
		dest=$(readlink $i)
		rm $i
		ln -s $dest.gz $i.gz
	  done
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	cook_copy_files	*.so*
}