aboutsummaryrefslogtreecommitdiffstats
path: root/main/libexecinfo
diff options
context:
space:
mode:
authorFrancesco Colista <fcolista@alpinelinux.org>2016-08-10 08:13:48 +0000
committerFrancesco Colista <fcolista@alpinelinux.org>2016-08-10 08:13:48 +0000
commit0d21e364b579e386a61aff4199e3661612935704 (patch)
tree80d0f3d7a6546f12164197cf46d4bc3673de577e /main/libexecinfo
parent7937a81fa806fad060e2052e6b470f43312958e0 (diff)
downloadaports-0d21e364b579e386a61aff4199e3661612935704.tar.bz2
aports-0d21e364b579e386a61aff4199e3661612935704.tar.xz
main/libexecinfo: moved from testing
Diffstat (limited to 'main/libexecinfo')
-rw-r--r--main/libexecinfo/10-execinfo.patch64
-rw-r--r--main/libexecinfo/20-define-gnu-source.patch24
-rw-r--r--main/libexecinfo/30-linux-makefile.patch44
-rw-r--r--main/libexecinfo/APKBUILD62
4 files changed, 194 insertions, 0 deletions
diff --git a/main/libexecinfo/10-execinfo.patch b/main/libexecinfo/10-execinfo.patch
new file mode 100644
index 0000000000..03b5af0ca2
--- /dev/null
+++ b/main/libexecinfo/10-execinfo.patch
@@ -0,0 +1,64 @@
+--- execinfo.c.orig
++++ execinfo.c
+@@ -69,7 +69,8 @@
+ char **
+ backtrace_symbols(void *const *buffer, int size)
+ {
+- int i, clen, alen, offset;
++ size_t clen, alen;
++ int i, offset;
+ char **rval;
+ char *cp;
+ Dl_info info;
+@@ -78,7 +79,6 @@
+ rval = malloc(clen);
+ if (rval == NULL)
+ return NULL;
+- (char **)cp = &(rval[size]);
+ for (i = 0; i < size; i++) {
+ if (dladdr(buffer[i], &info) != 0) {
+ if (info.dli_sname == NULL)
+@@ -92,14 +92,14 @@
+ 2 + /* " <" */
+ strlen(info.dli_sname) + /* "function" */
+ 1 + /* "+" */
+- D10(offset) + /* "offset */
++ 10 + /* "offset */
+ 5 + /* "> at " */
+ strlen(info.dli_fname) + /* "filename" */
+ 1; /* "\0" */
+ rval = realloc_safe(rval, clen + alen);
+ if (rval == NULL)
+ return NULL;
+- snprintf(cp, alen, "%p <%s+%d> at %s",
++ snprintf((char *) rval + clen, alen, "%p <%s+%d> at %s",
+ buffer[i], info.dli_sname, offset, info.dli_fname);
+ } else {
+ alen = 2 + /* "0x" */
+@@ -108,12 +108,15 @@
+ rval = realloc_safe(rval, clen + alen);
+ if (rval == NULL)
+ return NULL;
+- snprintf(cp, alen, "%p", buffer[i]);
++ snprintf((char *) rval + clen, alen, "%p", buffer[i]);
+ }
+- rval[i] = cp;
+- cp += alen;
++ rval[i] = (char *) clen;
++ clen += alen;
+ }
+
++ for (i = 0; i < size; i++)
++ rval[i] += (long) rval;
++
+ return rval;
+ }
+
+@@ -155,6 +158,6 @@
+ return;
+ snprintf(buf, len, "%p\n", buffer[i]);
+ }
+- write(fd, buf, len - 1);
++ write(fd, buf, strlen(buf));
+ }
+ }
diff --git a/main/libexecinfo/20-define-gnu-source.patch b/main/libexecinfo/20-define-gnu-source.patch
new file mode 100644
index 0000000000..0ba1fc1f7e
--- /dev/null
+++ b/main/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/main/libexecinfo/30-linux-makefile.patch b/main/libexecinfo/30-linux-makefile.patch
new file mode 100644
index 0000000000..3bc8927954
--- /dev/null
+++ b/main/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 <mcs@darkregion.net>, 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/main/libexecinfo/APKBUILD b/main/libexecinfo/APKBUILD
new file mode 100644
index 0000000000..9fd218ae84
--- /dev/null
+++ b/main/libexecinfo/APKBUILD
@@ -0,0 +1,62 @@
+# Contributor: Philipp Andronov <filipp.andronov@gmail.com>
+# Maintainer: Matt Smith <mcs@darkregion.net>
+
+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="${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
+ "
+
+_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"
+ export CFLAGS="${CFLAGS} -fno-omit-frame-pointer"
+ 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
+594e9f7b86780f2f0c623443dec7ca04 10-execinfo.patch
+8536668cd1813aa689f12d36c470c0a5 20-define-gnu-source.patch
+7dfdae632685a5331ca8317395132066 30-linux-makefile.patch"
+sha256sums="c9a21913e7fdac8ef6b33250b167aa1fc0a7b8a175145e26913a4c19d8a59b1f libexecinfo-1.1.tar.bz2
+eff078913cf0baeff6e0442ec5c77d1b25d97d13a6d66d25f5576fd25486d752 10-execinfo.patch
+020c73643ac91df9e90532499404fdc10e3ca0d0e6979a8c1610ac340cabe8d6 20-define-gnu-source.patch
+4e310e178c27ecad1ccb7ced06719428ab44bd30163eb7042c5eb2f285f892cb 30-linux-makefile.patch"
+sha512sums="51fea7910ef6873061a25c22434ce4da724e9d8e37616a069ad0a58c0463755be4c6c7da88cd747484c2f3373909d7be4678b32a4bd91b6d9e0f74526094e92c libexecinfo-1.1.tar.bz2
+a38f75d305518d3432807735456b32b223e89e0d08860e2dfafb5ad3b507de92d4fa60e4bb11978e3dbf20d68be05da42237ced7db625304b49a5288b90be232 10-execinfo.patch
+f335effbbb5425a4b1031fd8a4358f777825a5979f099d01357fab5715065e9f7439f118d155f124b1a15b1e91cd3a4e9a20793806d121f605775f148aea0102 20-define-gnu-source.patch
+3596aef8c6d0593afd063c2295ede3473d33afa52eafa5258bb48fcd472a36f987196c7de647b2b408a5a02138de9f36253d93f7a9f061e2bb6082fc429acb76 30-linux-makefile.patch"