# Template file for 'antiword'
pkgname=antiword
version=0.37
revision=2
create_wrksrc=yes
build_wrksrc="antiword-${version}"
short_desc="Converts the binary files from Word to plain text and to PostScript"
maintainer="Duncaen <duncaen@voidlinux.org>"
license="GPL-3.0-only"
homepage="http://www.winfield.demon.nl/"
distfiles="http://www.winfield.demon.nl/linux/antiword-${version}.tar.gz
 http://sources.debian.net/data/main/a/antiword/0.37-10/debian/patches/docx.patch"
checksum="8e2c000fcbc6d641b0e6ff95e13c846da3ff31097801e86702124a206888f5ac
 0ca787f8e31a2e05e6c0ff73406d9a7f0355fe27238a0cde3ed7cf6d3418c8aa"
patch_args=-Np0

do_build() {
	# debian patch for better docx handling
	mv ../docx.patch .
	patch -Np1 -i docx.patch
	# remove first line "#!/bin/bash" second one is "#!/bin/sh"
	sed -i '1d' kantiword
	make CC="$CC" LD="$CC" CFLAGS="$CFLAGS -DNDEBUG" LDFLAGS="$LDFLAGS"
}

do_install() {
	make DESTDIR="${DESTDIR}" GLOBAL_INSTALL_DIR="/usr/bin" global_install
	vman Docs/antiword.1
}
