# Template file for 'ltrace'
pkgname=ltrace
version=0.7.3
revision=5
build_style=gnu-configure
hostmakedepends="automake libtool"
makedepends="elfutils-devel"
conf_files="/etc/ltrace.conf"
short_desc="Tracks runtime library calls in dynamically linked programs"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="http://ltrace.org"
license="GPL-2"
distfiles="http://ltrace.org/ltrace_${version}.orig.tar.bz2"
checksum=0e6f8c077471b544c06def7192d983861ad2f8688dd5504beae62f0c5f5b9503

CFLAGS="-Wno-error -D_GNU_SOURCE"

pre_configure() {
	case "$XBPS_TARGET_MACHINE" in
	*-musl)
		sed -i '/HOST_OS/s/linux-uclibc/linux-musl/g' configure.ac
		sed -i 's/REG_NOERROR/0/g' options.c glob.c
		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
	esac

	autoreconf -fi
}
