Subject: [alpine-devel] [PATCH] new aport: testing/libexecinfo

From: Matt Smith <[email-masked]>
Date: Fri, 7 Jan 2011 12:05:52 -0600

A quick-n-dirty BSD licensed clone of the GNU libc backtrace facility.

http://www.freshports.org/devel/libexecinfo
---
 testing/libexecinfo/20-define-gnu-source.patch |   24 +++++++++++
 testing/libexecinfo/30-linux-makefile.patch    |   44 ++++++++++++++++++++
 testing/libexecinfo/APKBUILD                   |   52 ++++++++++++++++++++++++
 3 files changed, 120 insertions(+), 0 deletions(-)
 create mode 100644 testing/libexecinfo/20-define-gnu-source.patch
 create mode 100644 testing/libexecinfo/30-linux-makefile.patch
 create mode 100644 testing/libexecinfo/APKBUILD

diff --git a/testing/libexecinfo/20-define-gnu-source.patch b/testing/libexecinfo/20-define-gnu-source.patch
new file mode 100644
index 0000000..0ba1fc1
--- /dev/null
+++ b/testing/libexecinfo/20-define-gnu-source.patch
@@ -0,0 +1,24 @@
+--- execinfo.c.orig
++++ execinfo.c
+@@ -26,6 +26,7 @@
+  * $Id: execinfo.c,v 1.3 2004/07/19 05:21:09 sobomax Exp $
+  */
+ 
++#define _GNU_SOURCE
+ #include <sys/types.h>
+ #include <sys/uio.h>
+ #include <dlfcn.h>
+--- stacktraverse.c.orig
++++ stacktraverse.c
+@@ -1,3 +1,4 @@
++#define _GNU_SOURCE
+ #include <stddef.h>
+ 
+ #include "stacktraverse.h"
+--- test.c.orig
++++ test.c
+@@ -1,3 +1,4 @@
++#define _GNU_SOURCE
+ #include <stdio.h>
+ #include <stdlib.h>
+ 
diff --git a/testing/libexecinfo/30-linux-makefile.patch b/testing/libexecinfo/30-linux-makefile.patch
new file mode 100644
index 0000000..3bc8927
--- /dev/null
+++ b/testing/libexecinfo/30-linux-makefile.patch
@@ -0,0 +1,44 @@
+--- Makefile.orig
++++ Makefile
+@@ -23,24 +23,25 @@
+ # SUCH DAMAGE.
+ #
+ # $Id: Makefile,v 1.3 2004/07/19 05:19:55 sobomax Exp $
++#
++# Linux Makefile by Matt Smith <[email-masked]>, 2011/01/04
+ 
+-LIB=	execinfo
++CC=cc
++AR=ar
++EXECINFO_CFLAGS=$(CFLAGS) -O2 -pipe -fno-strict-aliasing -std=gnu99 -fstack-protector -c
++EXECINFO_LDFLAGS=$(LDFLAGS)
+ 
+-SRCS=	stacktraverse.c stacktraverse.h execinfo.c execinfo.h
++all: static dynamic
+ 
+-INCS=	execinfo.h
++static:
++	$(CC) $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) stacktraverse.c
++	$(CC) $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) execinfo.c
++	$(AR) rcs libexecinfo.a stacktraverse.o execinfo.o
+ 
+-SHLIB_MAJOR=	1
+-SHLIB_MINOR=	0
++dynamic:
++	$(CC) -fpic -DPIC $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) stacktraverse.c -o stacktraverse.So
++	$(CC) -fpic -DPIC $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) execinfo.c -o execinfo.So
++	$(CC) -shared -Wl,-soname,libexecinfo.so.1 -o libexecinfo.so.1 stacktraverse.So execinfo.So
+ 
+-NOPROFILE=	yes
+-
+-DPADD=		${LIBM}
+-LDADD=		-lm
+-
+-#WARNS?=	4
+-
+-#stacktraverse.c: gen.py
+-#	./gen.py > stacktraverse.c
+-
+-.include <bsd.lib.mk>
++clean:
++	rm -rf *.o *.So *.a *.so
diff --git a/testing/libexecinfo/APKBUILD b/testing/libexecinfo/APKBUILD
new file mode 100644
index 0000000..4d63709
--- /dev/null
+++ b/testing/libexecinfo/APKBUILD
@@ -0,0 +1,52 @@
+# Contributor: Matt Smith <[email-masked]>
+# Maintainer: Matt Smith <[email-masked]>
+pkgname=libexecinfo
+pkgver=1.1
+pkgrel=0
+pkgdesc="A quick-n-dirty BSD licensed clone of the GNU libc backtrace facility."
+url="http://www.freshports.org/devel/libexecinfo"
+arch="all"
+license="BSD"
+depends=
+makedepends=
+install=
+subpackages=
+source="ftp://ftp.freebsd.org/pub/FreeBSD/ports/local-distfiles/itetcu/$pkgname-$pkgver.tar.bz2
+	saveas-http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/ports/devel/libexecinfo/files/patch-execinfo.c?rev=1.4;content-type=text%2Fplain/10-execinfo.patch
+	20-define-gnu-source.patch
+	30-linux-makefile.patch
+	"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+	cd "$_builddir"
+	patch -p0 -i "$srcdir"/10-execinfo.patch
+	patch -p0 -i "$srcdir"/20-define-gnu-source.patch
+	patch -p0 -i "$srcdir"/30-linux-makefile.patch
+}
+
+build() {
+	cd "$_builddir"
+	make || return 1
+}
+
+package() {
+	cd "$_builddir"
+
+	install -D -m755 "$_builddir"/execinfo.h \
+		"$pkgdir"/usr/include/execinfo.h || return 1
+	install -D -m755 "$_builddir"/stacktraverse.h \
+		"$pkgdir"/usr/include/stacktraverse.h || return 1
+	install -D -m755 "$_builddir"/libexecinfo.a \
+		"$pkgdir"/usr/lib/libexecinfo.a || return 1
+	install -D -m755 "$_builddir"/libexecinfo.so.1 \
+		"$pkgdir"/usr/lib/libexecinfo.so.1 || return 1
+	ln -s /usr/lib/libexecinfo.so.1 \
+		"$pkgdir"/usr/lib/libexecinfo.so || return 1
+}
+
+md5sums="8e9e81c554c1c5d735bc877448e92b91  libexecinfo-1.1.tar.bz2
+986c4a9f64ed8110c38375b0ce59f4bc  10-execinfo.patch
+8536668cd1813aa689f12d36c470c0a5  20-define-gnu-source.patch
+7dfdae632685a5331ca8317395132066  30-linux-makefile.patch"
-- 
1.7.3.3

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Natanael Copa <[email-masked]>
Date: Sun, 9 Jan 2011 14:03:15 +0000

On Fri,  7 Jan 2011 12:05:52 -0600
Matt Smith <[email-masked]> wrote:

>  testing/libexecinfo/30-linux-makefile.patch    |   44
> ++++++++++++++++++++ testing/libexecinfo/APKBUILD
> |   52 ++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 0
> deletions(-) create mode 100644
> testing/libexecinfo/20-define-gnu-source.patch create mode 100644
> testing/libexecinfo/30-linux-makefile.patch create mode 100644
> testing/libexecinfo/APKBUILD
> 

Applied. Thanks!
-nc

---