commit 94f329730c8207e247b84247efd84ed3ea6b7a4d
parent bb21f569cebd1ea0fe5d049c7bafc73daa4db810
Author: parazyd <parazyd@dyne.org>
Date: Mon, 10 Oct 2016 16:51:32 +0200
dev-util/ltrace: Add 0.7.3 with musl-libc support.
Diffstat:
6 files changed, 299 insertions(+), 0 deletions(-)
diff --git a/dev-util/ltrace/Manifest b/dev-util/ltrace/Manifest
@@ -0,0 +1,2 @@
+DIST ltrace_0.7.3-4.debian.tar.gz 11373 SHA256 44dab94f96f1427ecdff1a08148e81b11eafacb542400fc7067c750590c7e5b9 SHA512 67a868c95703ca9cd8407905e3be416e3a66920f41d9deb78fadb71719d7d3f1a3f67ffcb575acff4bf7e4715102f3a6b0f67c6adb74f37ee66c398c132ff04b WHIRLPOOL ecaf6a2314b5add5af488e4654a4b76e543bf3444345bdd0a496ba57d1509451c50e9e1e33dd40976e8176e0d92a6270a4d28b5d63d04fa1aa8a6ee0af9989d8
+DIST ltrace_0.7.3.orig.tar.bz2 482658 SHA256 0e6f8c077471b544c06def7192d983861ad2f8688dd5504beae62f0c5f5b9503 SHA512 a842b16dcb81da869afa0bddc755fdff0d57b35672505bf2c7164fd983b1938d28b126714128930994cc1230ced69d779456d0cfc16f4008c9b6d19f0852285d WHIRLPOOL 081460150cf67c2c12ae81db4596a51d13e930f37ec143df1b0d1cb2ade6d1cec4445b127b822d5e3e776f3cd5f33fb9d23689f10d1da4adef73463bbd4e7fd2
diff --git a/dev-util/ltrace/files/0.4-parallel-make.patch b/dev-util/ltrace/files/0.4-parallel-make.patch
@@ -0,0 +1,11 @@
+--- ltrace-0.3.36.orig/Makefile.in 2004-11-10 01:12:03.000000000 +0200
++++ ltrace-0.3.36/Makefile.in 2006-09-02 11:10:57.000000000 +0300
+@@ -35,6 +35,8 @@
+ ltrace: sysdeps/sysdep.o $(OBJ)
+ $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
+
++$(OBJ): sysdeps/sysdep.o
++
+ sysdeps/sysdep.o: dummy
+ $(MAKE) -C sysdeps/$(OS)
+
diff --git a/dev-util/ltrace/files/fix-musl.patch b/dev-util/ltrace/files/fix-musl.patch
@@ -0,0 +1,153 @@
+--- ./configure.ac.orig
++++ ./configure.ac
+@@ -34,6 +34,7 @@
+ case "${host_os}" in
+ linux-gnu*) HOST_OS="linux-gnu" ;;
+ linux-uclibc*) HOST_OS="linux-gnu" ;;
++ linux-musl*) HOST_OS="linux-gnu" ;;
+ *) AC_MSG_ERROR([unkown host-os ${host_os}]) ;;
+ esac
+ AC_SUBST(HOST_OS)
+@@ -234,6 +235,7 @@
+ sys/param.h \
+ sys/time.h \
+ unistd.h \
++ error.h \
+ ])
+
+ # Checks for typedefs, structures, and compiler characteristics.
+diff --git a/expr.c b/expr.c
+index 32860fd..374c549 100644
+--- a/expr.c
++++ b/expr.c
+@@ -19,9 +19,12 @@
+ */
+
+ #include <string.h>
++#include <stdio.h>
+ #include <assert.h>
+ #include <errno.h>
++#ifdef HAVE_ERROR_H
+ #include <error.h>
++#endif
+ #include <stdlib.h>
+
+ #include "expr.h"
+@@ -330,8 +333,11 @@ expr_self(void)
+ static struct expr_node *node = NULL;
+ if (node == NULL) {
+ node = malloc(sizeof(*node));
+- if (node == NULL)
+- error(1, errno, "malloc expr_self");
++ if (node == NULL) {
++ fprintf(stderr, "%s: malloc expr_self\n",
++ strerror(errno));
++ exit(1);
++ }
+ expr_init_self(node);
+ }
+ return node;
+diff --git a/glob.c b/glob.c
+index 075c867..06fec47 100644
+--- a/glob.c
++++ b/glob.c
+@@ -180,7 +180,7 @@ glob_to_regex(const char *glob, char **retp)
+ goto fail;
+ }
+ *retp = buf;
+- return REG_NOERROR;
++ return 0;
+ }
+
+ int
+@@ -188,7 +188,7 @@ globcomp(regex_t *preg, const char *glob, int cflags)
+ {
+ char *regex = NULL;
+ int status = glob_to_regex(glob, ®ex);
+- if (status != REG_NOERROR)
++ if (status != 0)
+ return status;
+ assert(regex != NULL);
+ status = regcomp(preg, regex, cflags);
+diff --git a/options.c b/options.c
+index 1e19dc7..1dc5e1e 100644
+--- a/options.c
++++ b/options.c
+@@ -204,7 +204,7 @@ compile_libname(const char *expr, const char *a_lib, int lib_re_p,
+
+ regex_t lib_re;
+ int status = (lib_re_p ? regcomp : globcomp)(&lib_re, lib, 0);
+- if (status != REG_NOERROR) {
++ if (status != 0) {
+ char buf[100];
+ regerror(status, &lib_re, buf, sizeof buf);
+ fprintf(stderr, "Rule near '%s' will be ignored: %s.\n",
+diff --git a/read_config_file.c b/read_config_file.c
+index e247436..73528fe 100644
+--- a/read_config_file.c
++++ b/read_config_file.c
+@@ -27,7 +27,9 @@
+ #include <stdlib.h>
+ #include <ctype.h>
+ #include <errno.h>
++#ifdef HAVE_ERROR_H
+ #include <error.h>
++#endif
+ #include <assert.h>
+
+ #include "common.h"
+@@ -1258,8 +1260,12 @@ void
+ init_global_config(void)
+ {
+ struct arg_type_info *info = malloc(2 * sizeof(*info));
+- if (info == NULL)
+- error(1, errno, "malloc in init_global_config");
++ if (info == NULL) {
++ report_error(filename, line_no,
++ "%s: malloc in init_global_config",
++ strerror(errno));
++ exit(1);
++ }
+
+ memset(info, 0, 2 * sizeof(*info));
+ info[0].type = ARGTYPE_POINTER;
+diff --git a/zero.c b/zero.c
+index bc119ee..e685f59 100644
+--- a/zero.c
++++ b/zero.c
+@@ -18,8 +18,11 @@
+ * 02110-1301 USA
+ */
+
++#ifdef HAVE_ERROR_H
+ #include <error.h>
++#endif
+ #include <errno.h>
++#include <string.h>
+
+ #include "zero.h"
+ #include "common.h"
+@@ -96,8 +99,11 @@ expr_node_zero(void)
+ static struct expr_node *node = NULL;
+ if (node == NULL) {
+ node = malloc(sizeof(*node));
+- if (node == NULL)
+- error(1, errno, "malloc expr_node_zero");
++ if (node == NULL) {
++ report_global_error("%s: malloc expr_node_zero",
++ strerror(errno));
++ exit(1);
++ }
+ expr_init_cb1(node, &zero1_callback,
+ expr_self(), 0, (void *)-1);
+ }
+--- ./proc.h.orig
++++ ./proc.h
+@@ -26,6 +26,7 @@
+ #include "config.h"
+
+ #include <sys/time.h>
++#include <unistd.h>
+
+ #if defined(HAVE_LIBUNWIND)
+ # include <libunwind.h>
diff --git a/dev-util/ltrace/files/ltrace-0.7.3-alpha-protos.patch b/dev-util/ltrace/files/ltrace-0.7.3-alpha-protos.patch
@@ -0,0 +1,14 @@
+Fix build failure on alpha:
+ plt.c:32:12: error: dereferencing pointer to incomplete type ‘struct library_symbol’
+ return sym->enter_addr;
+ ^
+diff -U0 -raN ltrace-0.7.3/sysdeps/linux-gnu/alpha/plt.c ltrace-0.7.3/sysdeps/linux-gnu/alpha/plt.c
+--- ltrace-0.7.3_p4/work/ltrace-0.7.3/sysdeps/linux-gnu/alpha/plt.c 2012-11-10 13:43:55.000000000 +0100
++++ foo/work/ltrace-0.7.3/sysdeps/linux-gnu/alpha/plt.c 2016-06-27 23:21:28.000000000 +0200
+@@ -23,0 +24 @@
++#include "library.h"
+diff -U0 -raN ltrace-0.7.3/sysdeps/linux-gnu/alpha/trace.c ltrace-0.7.3/sysdeps/linux-gnu/alpha/trace.c
+--- ltrace-0.7.3_p4/work/ltrace-0.7.3/sysdeps/linux-gnu/alpha/trace.c 2016-06-27 23:30:08.000000000 +0200
++++ foo/work/ltrace-0.7.3/sysdeps/linux-gnu/alpha/trace.c 2016-06-27 23:25:20.000000000 +0200
+@@ -29,0 +30 @@
++#include "backend.h"
diff --git a/dev-util/ltrace/files/ltrace-0.7.3-test-protos.patch b/dev-util/ltrace/files/ltrace-0.7.3-test-protos.patch
@@ -0,0 +1,71 @@
+https://bugs.gentoo.org/421649
+
+For some reason testsuite does not handle warnings well:
+ /tmp/lt-cZI2cFo0z7.c:2:24: warning: inplicit function declaration «puts» [-Wimplicit-function-declaration]
+ void func2(void) { puts("func2"); }
+ ^
+and abandons problematic tests:
+ Testcase compile failed, so all tests in this file will automatically fail.
+diff --git a/testsuite/ltrace.main/filters.exp b/testsuite/ltrace.main/filters.exp
+index 988346f..f7f4140 100644
+--- a/testsuite/ltrace.main/filters.exp
++++ b/testsuite/ltrace.main/filters.exp
+@@ -24,2 +24,3 @@ set libfilt1 [ltraceCompile libfilt1.so [ltraceSource c {
+ set libfilt2 [ltraceCompile libfilt2.so [ltraceSource c {
++ #include <stdio.h>
+ void func2(void) { puts("func2"); }
+diff --git a/testsuite/ltrace.main/parameters.c b/testsuite/ltrace.main/parameters.c
+index ff24a38..9569dbe 100644
+--- a/testsuite/ltrace.main/parameters.c
++++ b/testsuite/ltrace.main/parameters.c
+@@ -19,2 +19,3 @@ void func_strfixed(char*);
+ void func_ppp(int***);
++void func_string(char*);
+ void func_stringp(char**);
+diff --git a/testsuite/ltrace.main/signals.c b/testsuite/ltrace.main/signals.c
+index a02e795..fda4ab9 100644
+--- a/testsuite/ltrace.main/signals.c
++++ b/testsuite/ltrace.main/signals.c
+@@ -7,2 +7,3 @@
+ #include <sys/types.h>
++#include <unistd.h>
+
+diff --git a/testsuite/ltrace.minor/time-record.c b/testsuite/ltrace.minor/time-record.c
+index a66b838..7d5e5e3 100644
+--- a/testsuite/ltrace.minor/time-record.c
++++ b/testsuite/ltrace.minor/time-record.c
+@@ -7,2 +7,3 @@
+ #include <time.h>
++#include <unistd.h>
+
+diff --git a/testsuite/ltrace.minor/trace-clone.c b/testsuite/ltrace.minor/trace-clone.c
+index db1936d..c68b128 100644
+--- a/testsuite/ltrace.minor/trace-clone.c
++++ b/testsuite/ltrace.minor/trace-clone.c
+@@ -10,2 +10,3 @@
+ #include <sched.h>
++#include <unistd.h>
+
+diff --git a/testsuite/ltrace.minor/trace-fork.c b/testsuite/ltrace.minor/trace-fork.c
+index c5f0c71..e1ab17f 100644
+--- a/testsuite/ltrace.minor/trace-fork.c
++++ b/testsuite/ltrace.minor/trace-fork.c
+@@ -8,2 +8,4 @@
+ #include <sys/types.h>
++#include <sys/wait.h>
++#include <unistd.h>
+
+@@ -29,3 +31,4 @@ main ()
+ printf("My child pid is %d\n",pid);
+- wait();
++ int status;
++ wait(&status);
+ }
+diff --git a/testsuite/ltrace.torture/signals.c b/testsuite/ltrace.torture/signals.c
+index b786c81..86e2dba 100644
+--- a/testsuite/ltrace.torture/signals.c
++++ b/testsuite/ltrace.torture/signals.c
+@@ -7,2 +7,3 @@
+ #include <sys/types.h>
++#include <unistd.h>
+
diff --git a/dev-util/ltrace/ltrace-0.7.3_p4-r99.ebuild b/dev-util/ltrace/ltrace-0.7.3_p4-r99.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit autotools eutils
+
+LTRACE_V=${PV/_p*/}
+DB_V=${PV/*_p/}
+
+DESCRIPTION="trace library calls made at runtime"
+HOMEPAGE="http://ltrace.alioth.debian.org/"
+SRC_URI="
+ mirror://debian/pool/main/l/${PN}/${PN}_${LTRACE_V}.orig.tar.bz2
+ mirror://debian/pool/main/l/${PN}/${PN}_${LTRACE_V}-${DB_V}.debian.tar.gz
+"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="debug selinux test unwind"
+
+RDEPEND="dev-libs/elfutils
+ selinux? ( sys-libs/libselinux )
+ unwind? ( sys-libs/libunwind )"
+DEPEND="${RDEPEND}
+ sys-libs/binutils-libs
+ test? ( dev-util/dejagnu )"
+
+S=${WORKDIR}/${PN}-${LTRACE_V}
+
+src_prepare() {
+ epatch "${WORKDIR}"/debian/patches/[0-9]*
+ epatch "${FILESDIR}"/${PN}-0.7.3-test-protos.patch #bug 421649
+ epatch "${FILESDIR}"/${PN}-0.7.3-alpha-protos.patch
+ epatch "${FILESDIR}"/fix-musl.patch
+ sed -i '/^dist_doc_DATA/d' Makefile.am || die
+ eautoreconf
+}
+
+src_configure() {
+ ac_cv_header_selinux_selinux_h=$(usex selinux) \
+ ac_cv_lib_selinux_security_get_boolean_active=$(usex selinux) \
+ econf \
+ --disable-werror \
+ $(use_enable debug) \
+ $(use_with unwind libunwind)
+}