SUMMARY="A graphics and text mode web browser"
DESCRIPTION="Links is a multi-platform web browser you can run in Terminal."
HOMEPAGE="http://links.twibright.com/"
COPYRIGHT="1999-2019 Mikulas Patocka
	2000-2011 Petr Kulhavy, Karel Kulhavy, Martin Pergel"
LICENSE="GNU GPL v2"
REVISION="5"
SOURCE_URI="http://links.twibright.com/download/links-$portVersion.tar.gz"
CHECKSUM_SHA256="37299f804f22c945bf63e22a7bc4418bbb8144b410c0ced70b82ebe6f9e3c82b"
PATCHES="links-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2 ?x86"
SECONDARY_ARCHITECTURES="x86"

commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

USER_SETTINGS_FILES="
	settings/links directory
	"

PROVIDES="
	links$secondaryArchSuffix = $portVersion
	cmd:links$commandSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libbrotlicommon$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libevent_2.1$secondaryArchSuffix
	lib:libfontconfig$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libgomp$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:liblzma$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libbrotlicommon$secondaryArchSuffix
	devel:libbz2$secondaryArchSuffix
	devel:libcrypto$secondaryArchSuffix
	devel:libevent_2.1$secondaryArchSuffix
	devel:libfontconfig$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
#	devel:libGL$secondaryArchSuffix
	devel:libglu$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:liblzma$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libz$secondaryArchSuffix >= 1.2.8
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage links$secondaryArchSuffix \
	"$commandBinDir"/links

BUILD()
{
	autoreconf -vfi
	runConfigure --omit-dirs binDir ./configure \
		--bindir="$commandBinDir" \
		--without-x \
		--enable-graphics
	make $jobArgs
}

INSTALL()
{
	make install
	addAppDeskbarSymlink $commandBinDir/links Links
}
