# Contributor: Philipp Andronov <filipp.andronov@gmail.com>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=libexecinfo
pkgver=1.1
pkgrel=1
pkgdesc="Library for inspecting backtraces"
url="https://www.freshports.org/devel/libexecinfo"
arch="all"
license="BSD-2-Clause"
depends=""
makedepends=""
subpackages="$pkgname-dev"
source="http://distcache.freebsd.org/local-distfiles/itetcu/$pkgname-$pkgver.tar.bz2
	10-execinfo.patch
	20-define-gnu-source.patch
	30-linux-makefile.patch
	"

build() {
	cd "$builddir"
	make
}

check() {
	cd "$builddir"
	${CC:-cc} -I. -L. -ggdb -fno-omit-frame-pointer $CFLAGS -o test test.c -lexecinfo
	./test
}

package() {
	cd "$builddir"

	install -D -m755 "$builddir"/execinfo.h \
		"$pkgdir"/usr/include/execinfo.h
	install -D -m755 "$builddir"/stacktraverse.h \
		"$pkgdir"/usr/include/stacktraverse.h
	install -D -m755 "$builddir"/libexecinfo.a \
		"$pkgdir"/usr/lib/libexecinfo.a
	install -D -m755 "$builddir"/libexecinfo.so.1 \
		"$pkgdir"/usr/lib/libexecinfo.so.1
	ln -s /usr/lib/libexecinfo.so.1 \
		"$pkgdir"/usr/lib/libexecinfo.so
}

sha512sums="51fea7910ef6873061a25c22434ce4da724e9d8e37616a069ad0a58c0463755be4c6c7da88cd747484c2f3373909d7be4678b32a4bd91b6d9e0f74526094e92c  libexecinfo-1.1.tar.bz2
97dab43979f6bc07deb11b20cc134c7d95619536b108058388856bcc48dc5a7de4ebceebe88e79d92ccbb9307975bb91a630cc569a5ed35a37a0f92f2d7f83d0  10-execinfo.patch
6b1d5ba0a2765fcbcde2d88e85c6ee9fb49ef1878284fd7da15afebed17b8415959233c735574661b0a5e77d4d40c132552477dbbf4432512a32629727ebdbbc  20-define-gnu-source.patch
7d83e3113b93ed9d54a2077d6b9381aa69c6a5d2066dd3cd7c5ec3ce0c93eb7b86fd47481151117f9c8f3790bde6125498a49e32e81d3ff6630b6d8e0ec391d0  30-linux-makefile.patch"