SUMMARY="Text based WWW browser, supports tables and frames"
DESCRIPTION="w3m is a text-based web browser as well as a pager like 'more' or \
'less'. With w3m you can browse web pages through a terminal emulator window \
(xterm, rxvt or something like that). Moreover, w3m can be used as a text \
formatting tool which typesets HTML into plain text."
HOMEPAGE="http://w3m.sourceforge.net/"
COPYRIGHT="1994-2011 Akinori ITO
	2002-2011 Hironori SAKAMOTO
	2002-2011 Fumitoshi UKAI"
LICENSE="W3M"
REVISION="1"
SOURCE_URI="https://github.com/tats/w3m/archive/v${portVersion/\~/\+}.tar.gz"
CHECKSUM_SHA256="7b276d2c6ee96588f990959a01e0d8979b1b8c86fdb04d0d17ef46c30c2cd884"
SOURCE_DIR="w3m-${portVersion/\~/\-}"
PATCHES="w3m-$portVersion.patchset"

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

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

PROVIDES="
	w3m$secondaryArchSuffix = $portVersion
	cmd:w3m$commandSuffix = $portVersion
	cmd:w3mman$commandSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgc$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libncurses$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	cmd:nano
	"

BUILD_REQUIRES="
	devel:libgc$secondaryArchSuffix
	devel:libncurses$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:libtoolize$secondaryArchSuffix
	cmd:autoconf
	cmd:make
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:nano
	"

BUILD()
{
	libtoolize -fci
	autoconf
	LIBS="-lnetwork -lbsd" runConfigure --omit-dirs binDir ./configure --bindir="$commandBinDir" \
	--with-editor=${portPackageLinksDir}/cmd~nano/bin/nano \
	--with-browser=open
	make
}

INSTALL()
{
	make install
}
