From: Khem Raj <raj.khem@gmail.com>
To: openembedded-devel@lists.openembedded.org
Subject: [meta-oe][PATCH 16/16] libexecinfo: Add recipe
Date: Sun, 19 Mar 2017 22:31:52 -0700 [thread overview]
Message-ID: <20170320053152.29352-16-raj.khem@gmail.com> (raw)
In-Reply-To: <20170320053152.29352-1-raj.khem@gmail.com>
This package is handy especially with musl to port
apps which use glibc backtrace APIs
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
.../0001-makefile-Fix-build-on-linux.patch | 59 ++++++++++++++++
...x-compiler-errors-found-with-newer-gcc-cl.patch | 79 ++++++++++++++++++++++
.../libexecinfo/libexecinfo_1.1.bb | 27 ++++++++
3 files changed, 165 insertions(+)
create mode 100644 meta-oe/recipes-extended/libexecinfo/libexecinfo/0001-makefile-Fix-build-on-linux.patch
create mode 100644 meta-oe/recipes-extended/libexecinfo/libexecinfo/0002-execinfo-Fix-compiler-errors-found-with-newer-gcc-cl.patch
create mode 100644 meta-oe/recipes-extended/libexecinfo/libexecinfo_1.1.bb
diff --git a/meta-oe/recipes-extended/libexecinfo/libexecinfo/0001-makefile-Fix-build-on-linux.patch b/meta-oe/recipes-extended/libexecinfo/libexecinfo/0001-makefile-Fix-build-on-linux.patch
new file mode 100644
index 000000000..f1863f14b
--- /dev/null
+++ b/meta-oe/recipes-extended/libexecinfo/libexecinfo/0001-makefile-Fix-build-on-linux.patch
@@ -0,0 +1,59 @@
+From 910bbc2cb6cc1cfa6deed9d170da02a639902c7c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 19 Mar 2017 16:14:54 -0700
+Subject: [PATCH 1/2] makefile: Fix build on linux
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Makefile | 33 +++++++++++++++++----------------
+ 1 file changed, 17 insertions(+), 16 deletions(-)
+
+Index: libexecinfo-1.1/Makefile
+===================================================================
+--- libexecinfo-1.1.orig/Makefile
++++ libexecinfo-1.1/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
+-
+-SRCS= stacktraverse.c stacktraverse.h execinfo.c execinfo.h
+-
+-INCS= execinfo.h
+-
+-SHLIB_MAJOR= 1
+-SHLIB_MINOR= 0
+-
+-NOPROFILE= yes
+-
+-DPADD= ${LIBM}
+-LDADD= -lm
+-
+-#WARNS?= 4
+-
+-#stacktraverse.c: gen.py
+-# ./gen.py > stacktraverse.c
++CC?=cc
++AR?=ar
++EXECINFO_CFLAGS=$(CFLAGS) -O2 -pipe -fno-strict-aliasing -std=gnu99 -fstack-protector -c
++EXECINFO_LDFLAGS=$(LDFLAGS)
++
++all: static dynamic
++
++static:
++ $(CC) $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) stacktraverse.c
++ $(CC) $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) execinfo.c
++ $(AR) rcs libexecinfo.a stacktraverse.o execinfo.o
++
++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 $(EXECINFO_LDFLAGS) stacktraverse.So execinfo.So
+
+-.include <bsd.lib.mk>
++clean:
++ rm -rf *.o *.So *.a *.so
diff --git a/meta-oe/recipes-extended/libexecinfo/libexecinfo/0002-execinfo-Fix-compiler-errors-found-with-newer-gcc-cl.patch b/meta-oe/recipes-extended/libexecinfo/libexecinfo/0002-execinfo-Fix-compiler-errors-found-with-newer-gcc-cl.patch
new file mode 100644
index 000000000..423b67082
--- /dev/null
+++ b/meta-oe/recipes-extended/libexecinfo/libexecinfo/0002-execinfo-Fix-compiler-errors-found-with-newer-gcc-cl.patch
@@ -0,0 +1,79 @@
+From 0810817773fb81d7383d2fa8464244c8f79845fb Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 19 Mar 2017 16:16:18 -0700
+Subject: [PATCH 2/2] execinfo: Fix compiler errors found with newer gcc/clang
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ execinfo.c | 19 +++++++++++--------
+ 1 file changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/execinfo.c b/execinfo.c
+index 906fb14..9448b60 100644
+--- a/execinfo.c
++++ b/execinfo.c
+@@ -69,7 +69,8 @@ backtrace(void **buffer, int size)
+ 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 @@ backtrace_symbols(void *const *buffer, int size)
+ 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 @@ backtrace_symbols(void *const *buffer, int size)
+ 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 @@ backtrace_symbols(void *const *buffer, int size)
+ 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 @@ backtrace_symbols_fd(void *const *buffer, int size, int fd)
+ return;
+ snprintf(buf, len, "%p\n", buffer[i]);
+ }
+- write(fd, buf, len - 1);
++ write(fd, buf, strlen(buf));
+ }
+ }
+--
+2.12.0
+
diff --git a/meta-oe/recipes-extended/libexecinfo/libexecinfo_1.1.bb b/meta-oe/recipes-extended/libexecinfo/libexecinfo_1.1.bb
new file mode 100644
index 000000000..48d14dd62
--- /dev/null
+++ b/meta-oe/recipes-extended/libexecinfo/libexecinfo_1.1.bb
@@ -0,0 +1,27 @@
+# Copyright (C) 2017 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "A quick-n-dirty BSD licensed clone of the GNU libc backtrace facility."
+HOMEPAGE = "http://www.freshports.org/devel/libexecinfo"
+LIC_FILES_CHKSUM = "file://execinfo.c;endline=25;md5=85bd3fa4ea9acae5182e29db063fe2e5"
+LICENSE = "BSD-2-Clause"
+SECTION = "libs"
+DEPENDS = ""
+
+SRC_URI = "http://distcache.freebsd.org/local-distfiles/itetcu/${BP}.tar.bz2 \
+ file://0001-makefile-Fix-build-on-linux.patch \
+ file://0002-execinfo-Fix-compiler-errors-found-with-newer-gcc-cl.patch \
+ "
+SRC_URI[md5sum] = "8e9e81c554c1c5d735bc877448e92b91"
+SRC_URI[sha256sum] = "c9a21913e7fdac8ef6b33250b167aa1fc0a7b8a175145e26913a4c19d8a59b1f"
+
+CFLAGS += "-fno-omit-frame-pointer"
+
+do_install() {
+ install -D -m 0744 ${S}/execinfo.h ${D}${includedir}/execinfo.h
+ install -D -m 0744 ${S}/stacktraverse.h ${D}${includedir}/stacktraverse.h
+ install -D -m 0744 ${B}/libexecinfo.a ${D}${libdir}/libexecinfo.a
+ install -D -m 0755 ${B}/libexecinfo.so.1 ${D}${libdir}/libexecinfo.so.1
+ ln -s libexecinfo.so.1 ${D}${libdir}/libexecinfo.so
+}
+
--
2.12.0
next prev parent reply other threads:[~2017-03-20 5:32 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-20 5:31 [meta-oe][PATCH V2 01/16] gpm: Update to use git src uri Khem Raj
2017-03-20 5:31 ` [meta-oe][PATCH V2 02/16] rapidjson: Update to 1.1.0 + git Khem Raj
2017-03-20 21:30 ` Andre McCurdy
2017-03-20 21:39 ` Khem Raj
2017-03-20 5:31 ` [meta-oe][PATCH V2 03/16] libtorrent, rtorrent: Update to latest Khem Raj
2017-03-20 5:31 ` [meta-xfce][PATCH V2 04/16] core-image-minimal-xfce: Drop ROOTFS_PKGMANAGE_BOOTSTRAP Khem Raj
2017-03-20 5:31 ` [meta-oe][PATCH 05/16] sgio: Fix missing GNU_HASH errors Khem Raj
2017-03-20 5:31 ` [meta-multimedia][PATCH 06/16] libmatroska: " Khem Raj
2017-03-20 5:31 ` [meta-oe][PATCH 07/16] smstools3: Fix " Khem Raj
2017-03-20 5:31 ` [meta-oe][PATCH 08/16] procmail: Fix GNU_HASH errors, pass LDFLAGS Khem Raj
2017-03-20 5:31 ` [meta-oe][PATCH 09/16] gradm: Fix GNU_HASH QA errors Khem Raj
2017-03-20 5:31 ` [meta-oe][PATCH 10/16] zile: Fix build with musl Khem Raj
2017-03-20 5:31 ` [meta-networking][PATCH 11/16] libmemcached: Upgrade to 1.0.18 Khem Raj
2017-03-20 5:31 ` [meta-oe][PATCH 12/16] picocom: Upgrade to 2.2 Khem Raj
2017-03-30 9:45 ` Martin Jansa
2017-03-30 16:37 ` Khem Raj
2017-03-20 5:31 ` [meta-oe][PATCH 13/16] samsung-soc-utils: Remove -static Khem Raj
2017-03-20 5:31 ` [meta-oe][PATCH 14/16] digitemp: Update past 3.7.1 release Khem Raj
2017-03-20 5:31 ` [meta-oe][PATCH 15/16] memstat: Fix build with musl Khem Raj
2017-03-20 5:31 ` Khem Raj [this message]
2017-03-30 9:46 ` [meta-oe][PATCH 16/16] libexecinfo: Add recipe Martin Jansa
2017-03-30 16:38 ` Khem Raj
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170320053152.29352-16-raj.khem@gmail.com \
--to=raj.khem@gmail.com \
--cc=openembedded-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox