# Template file for 'txr'
pkgname=txr
version=294
revision=1
archs="x86_64* i686* arm*"
build_style=configure
configure_args="--prefix=/usr"
make_check_target=tests
makedepends="libffi-devel"
short_desc="Programming language for convenient data munging"
maintainer="Leon (adigitoleo) <adigitoleo@posteo.net>"
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=41d90de05c286c644f40d4067070bad968b987042ab20c8ba3d7ad61811fa837
nopie=yes

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/
}
