# Template file for 'ltrace'
pkgname=ltrace
version=0.7.3.20160924
revision=2
_githash=82c66409c7a93ca6ad2e4563ef030dfb7e6df4d4
build_style=gnu-configure
hostmakedepends="automake libtool"
makedepends="elfutils-devel"
short_desc="Tracks runtime library calls in dynamically linked programs"
maintainer="Orphaned <orphan@voidlinux.org>"
homepage="http://ltrace.org"
license="GPL-2"
distfiles="https://github.com/dkogan/ltrace/archive/${_githash}.tar.gz"
checksum=4aecf69e4a33331aed1e50ce4907e73a98cbccc4835febc3473863474304d547

CFLAGS="-Wno-error -D_GNU_SOURCE"

pre_configure() {
	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
		sed -i '/HOST_OS/s/linux-uclibc/linux-musl/g' configure.ac
		sed -i -e '/error.h/d' -e 's/error(1, errno/err(1/' \
			read_config_file.c expr.c zero.c
		sed -i '1i#include <sys/types.h>' proc.h
		sed -i 's/#ifndef __mips__/#if 0/' proc.c
	fi

	mkdir -p config 
	autoreconf -fi

}
