# Template file for 'polyml'
pkgname=polyml
version=5.9
revision=1
build_style=gnu-configure
configure_args="--enable-shared"
makedepends="gmp-devel"
short_desc="Poly/ML Standard ML (SML) implementation"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="LGPL-2.1-or-later"
homepage="http://www.polyml.org/"
distfiles="https://github.com/${pkgname}/${pkgname}/archive/v${version}.tar.gz"
checksum=5aa452a49f2ac0278668772af4ea0b9bf30c93457e60ff7f264c5aec2023c83e
conflicts="mesa-demos>=0" # /usr/bin/poly
nocross=yes

case "$XBPS_TARGET_MACHINE" in
	i686*)
		# musl doesn't allow writing to .rodata and .text during
		# relocation, but polyexport.o contains DT_TEXTREL
		# since libpolyml/elfexport.cpp only creates absolute
		# relocations.  Drop PIE and do relocations at link time.
		[ "$XBPS_TARGET_LIBC" = "musl" ] && nopie=yes
		;;
	*) makedepends+=" libffi-devel";;
esac

if [ "$XBPS_TARGET_ENDIAN" = "be" ]; then
	broken="crashes"
fi
