# Template file for 'txr'
pkgname=txr
version=282
revision=2
archs="x86_64* i686* aarch64* arm* ppc64* mips*"
build_style=configure
configure_args="--prefix=/usr"
make_check_target=tests
makedepends="libffi-devel"
short_desc="Programming language for convenient data munging"
maintainer="Orphaned <orphan@voidlinux.org>"
license="BSD-2-Clause"
homepage="http://www.nongnu.org/txr/"
changelog="http://www.kylheku.com/cgit/txr/tree/RELNOTES"
distfiles="http://www.kylheku.com/cgit/txr/snapshot/${pkgname}-${version}.tar.bz2"
checksum=5f10467610d8213be9af8a1fc9dafbd4902b7b473a82d8b2945cfa5ea6d2fee5
nopie=yes
CFLAGS="-D_FILE_OFFSET_BITS=64"

if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then
	makedepends+=" libxcrypt-devel"
fi

if [ "$CROSS_BUILD" ]; then
	hostmakedepends+=" txr"
fi

pre_configure() {
	if [ "$CROSS_BUILD" ]; then
		vsed -i Makefile -e 's#^TXR :=.*#TXR = /usr/bin/txr#'
	fi
}

pre_check() {
	if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
		# IPv6 not supported in github CI
		vsed -i -e 's/,\*maybe-ipv6//' tests/014/dgram-stream.tl

		# Removing tests that fail when run as root
		rm tests/019/load-search.tl
	fi
}

post_install() {
	vlicense LICENSE
	vmkdir usr/share/vim/vimfiles/syntax
	vcopy *.vim usr/share/vim/vimfiles/syntax/
}
