diff --git a/packages/libexecinfo/LICENSE b/packages/libexecinfo/LICENSE new file mode 100644 index 000000000..7c1e2d678 --- /dev/null +++ b/packages/libexecinfo/LICENSE @@ -0,0 +1,23 @@ + * Copyright (c) 2003 Maxim Sobolev + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. diff --git a/packages/libexecinfo/build.sh b/packages/libexecinfo/build.sh new file mode 100644 index 000000000..a93e4d668 --- /dev/null +++ b/packages/libexecinfo/build.sh @@ -0,0 +1,34 @@ +TERMUX_PKG_HOMEPAGE=https://www.freshports.org/devel/libexecinfo +TERMUX_PKG_DESCRIPTION="A quick-n-dirty BSD licensed clone of backtrace facility found in the GNU libc" +TERMUX_PKG_LICENSE="BSD 2-Clause" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=1.1 +TERMUX_PKG_SRCURL=http://distcache.FreeBSD.org/ports-distfiles/libexecinfo-${TERMUX_PKG_VERSION}.tar.bz2 +TERMUX_PKG_SHA256=c9a21913e7fdac8ef6b33250b167aa1fc0a7b8a175145e26913a4c19d8a59b1f + +# Apparently not working for these arches: +TERMUX_PKG_BLACKLISTED_ARCHES="i686, x86_64" + +termux_step_post_get_source() { + cp $TERMUX_PKG_BUILDER_DIR/LICENSE ./ +} + +termux_step_pre_configure() { + CFLAGS+=" -fvisibility=hidden -fno-strict-aliasing" + LDFLAGS+=" -lm" +} + +termux_step_make() { + local objs="execinfo.o stacktraverse.o" + local f + for f in $objs; do + $CC $CFLAGS $CPPFLAGS "$TERMUX_PKG_SRCDIR/${f%.o}.c" -c + done + $CC $CFLAGS $objs -shared $LDFLAGS -o libexecinfo.so + $AR cru libexecinfo.a $objs +} + +termux_step_make_install() { + install -Dm600 -t $TERMUX_PREFIX/lib libexecinfo.{a,so} + install -Dm600 -t $TERMUX_PREFIX/include $TERMUX_PKG_SRCDIR/execinfo.h +} diff --git a/packages/libexecinfo/execinfo.c.patch b/packages/libexecinfo/execinfo.c.patch new file mode 100644 index 000000000..e0944bbdb --- /dev/null +++ b/packages/libexecinfo/execinfo.c.patch @@ -0,0 +1,26 @@ +--- a/execinfo.c ++++ b/execinfo.c +@@ -52,6 +52,8 @@ + return nptr; + } + ++#pragma GCC visibility push(default) ++ + int + backtrace(void **buffer, int size) + { +@@ -78,7 +80,7 @@ + rval = malloc(clen); + if (rval == NULL) + return NULL; +- (char **)cp = &(rval[size]); ++ cp = &(rval[size]); + for (i = 0; i < size; i++) { + if (dladdr(buffer[i], &info) != 0) { + if (info.dli_sname == NULL) +@@ -158,3 +160,5 @@ + write(fd, buf, len - 1); + } + } ++ ++#pragma GCC visibility pop