# Template file for 'ltrace'
pkgname=ltrace
version=0.7.3
revision=4
build_style=gnu-configure
hostmakedepends="automake libtool git"
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.alioth.debian.org/"
license="GPL-2"

CFLAGS="-Wno-error -D_GNU_SOURCE"

do_fetch() {
	git clone -b${version} git://anonscm.debian.org/collab-maint/ltrace.git ${wrksrc}
	cd ${wrksrc}
	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
}
pre_configure() {
	autoreconf -fi
}
