# Contributor: ScrumpyJack <scrumpyjack@st.ilet.to>
# Maintainer: ScrumpyJack <scrumpyjack@st.ilet.to>
pkgname=w3m
_pkgver=0.5.3+git20161120
pkgver=${_pkgver/+git/.}
pkgrel=2
pkgdesc='Text-based Web browser, as well as pager'
# http://w3m.sourceforge.net/
url='https://github.com/tats/w3m'
license='MIT UCD'
arch='all'
makedepends="imlib2-dev libressl-dev gc-dev ncurses-dev linux-headers"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/tats/$pkgname/archive/v$_pkgver.tar.gz
	https.patch"
builddir="$srcdir/$pkgname-${_pkgver/+/-}"

build() {
	cd "$builddir"
	./configure \
		--prefix=/usr \
		--libexecdir=/usr/lib \
		--enable-image=fb \
		--with-ssl \
		--disable-nntp \
		--disable-dict \
		--disable-help-cgi \
		--with-imagelib=imlib2 \
		--with-termlib=ncurses \
		--disable-w3mmailer \
		--disable-mouse \
		|| return 1
	make -j1
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install || return 1

	install -d "$pkgdir"/usr/share/doc/"$pkgname"
	install -d "$pkgdir"/usr/share/licenses/"$pkgname"
	local i; for i in doc/*; do
		install -m644 "$i" \
			"$pkgdir"/usr/share/doc/"$pkgname" || return 1
	done
	ln -s /usr/share/doc/"$pkgname"/README \
		"$pkgdir"/usr/share/licenses/"$pkgname"
}

md5sums="5c53b7744ec5a89c8bf26325bf0f1541  w3m-0.5.3.20161120.tar.gz
a5e1038b5fb36ac1465700433ae00d0b  https.patch"
sha256sums="62a5b066aaf5e23afec6decd962b966f333352150f8072193cba98320676f060  w3m-0.5.3.20161120.tar.gz
ab8f2b6c7e1cf2d8485fa9928784c8dbd2f0d8cd26a5c32384543eea173de986  https.patch"
sha512sums="81ecf9e5d9067a82efa5464e5f9396327a6333f9e414458a972b2b7bff138bd17c490b5258e34cb1e338c7a6c0dd6105a1bfd1e0d02edfadead79caa39106a5c  w3m-0.5.3.20161120.tar.gz
3844b3a079524ad403da7fe03461210a433ff1cd562862c4df55c3be250ccba0c34eb61bcc8df1973d70e2ef034edaf1804bb2fa682b01723322f108f523932a  https.patch"
