summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author Shahab Vahedi <list+sbo@vahedi.org>2024-04-02 09:42:12 +0700
committer Willy Sudiarto Raharjo <willysr@slackbuilds.org>2024-04-02 10:30:06 +0700
commit7061819fb5d9a5d8bab5a543c5f9d7bbfedb5085 (patch)
tree147bbed62d6bab8fc1627b93aba796ca71a56cbc
parent8835105ff57a1b2994ac884b9d0c359387912590 (diff)
downloadslackbuilds-7061819fb5d9a5d8bab5a543c5f9d7bbfedb5085.tar.gz
slackbuilds-7061819fb5d9a5d8bab5a543c5f9d7bbfedb5085.tar.xz
development/libtree: Added (Library dependency parser).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r--development/libtree/README16
-rw-r--r--development/libtree/libtree-3.1.1-modern-c.patch75
-rw-r--r--development/libtree/libtree.SlackBuild99
-rw-r--r--development/libtree/libtree.info10
-rw-r--r--development/libtree/slack-desc19
5 files changed, 219 insertions, 0 deletions
diff --git a/development/libtree/README b/development/libtree/README
new file mode 100644
index 0000000000..67ddeddcdf
--- /dev/null
+++ b/development/libtree/README
@@ -0,0 +1,16 @@
+libtree prints the shared libraries required by each program or shared
+library on the command line as a tree. By default certain common system
+libraries are hidden to prune the tree.
+
+Unlike "ldd", libtree only parses the binary and does not use dynamic
+loader to load them to memory. Therefore, it is a safer approach to
+analyse suspicious binaries.
+
+A static build is recommended by the upstream. One can build the tool
+statically by passing STATIC=yes:
+
+# STATIC=yes sh libtree.SlackBuild
+
+The patch included in this package is already upstream, but hasn't
+ended up in a release yet. It's mainly targeted for the future
+15.1 release and the "current".
diff --git a/development/libtree/libtree-3.1.1-modern-c.patch b/development/libtree/libtree-3.1.1-modern-c.patch
new file mode 100644
index 0000000000..371f0a8bcb
--- /dev/null
+++ b/development/libtree/libtree-3.1.1-modern-c.patch
@@ -0,0 +1,75 @@
+https://github.com/haampie/libtree/commit/eb56287c1b4eb3b267524ab1e6e31f042b713395
+
+From eb56287c1b4eb3b267524ab1e6e31f042b713395 Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Sun, 15 Jan 2023 22:49:37 +0100
+Subject: [PATCH] Avoid implicit function declarations in tests (#84)
+
+Future compilers are likely to reject implicit function declarations
+by default, causing these tests to fail. Also replace () with (void)
+where appropriate in the changed tests.
+--- a/tests/01_origin/Makefile
++++ b/tests/01_origin/Makefile
+@@ -7,13 +7,13 @@ LD_LIBRARY_PATH=
+ all: check
+
+ liba.so:
+- echo 'int f(){return 1;}' | $(CC) -shared -Wl,-soname,$@ -o $@ -nostdlib -x c -
++ echo 'int f(void){return 1;}' | $(CC) -shared -Wl,-soname,$@ -o $@ -nostdlib -x c -
+
+ exe_rpath: liba.so
+- echo 'int _start(){return f();}' | $(CC) -o $@ -Wl,--no-as-needed -Wl,--disable-new-dtags '-Wl,-rpath,$$ORIGIN' -Wno-implicit-function-declaration -nostdlib liba.so -x c -
++ echo 'int f(void); int _start(void){return f();}' | $(CC) -o $@ -Wl,--no-as-needed -Wl,--disable-new-dtags '-Wl,-rpath,$$ORIGIN' -Wno-implicit-function-declaration -nostdlib liba.so -x c -
+
+ exe_runpath: liba.so
+- echo 'int _start(){return f();}' | $(CC) -o $@ -Wl,--no-as-needed -Wl,--enable-new-dtags '-Wl,-rpath,$$ORIGIN' -Wno-implicit-function-declaration -nostdlib liba.so -x c -
++ echo 'int f(void); int _start(void){return f();}' | $(CC) -o $@ -Wl,--no-as-needed -Wl,--enable-new-dtags '-Wl,-rpath,$$ORIGIN' -Wno-implicit-function-declaration -nostdlib liba.so -x c -
+
+ check: exe_rpath exe_runpath
+ ../../libtree exe_rpath
+--- a/tests/02_rpath_of_parents_parent/Makefile
++++ b/tests/02_rpath_of_parents_parent/Makefile
+@@ -8,13 +8,13 @@ LD_LIBRARY_PATH=
+ all: check
+
+ libb.so:
+- echo 'int g(){return 1;}' | $(CC) -shared -Wl,-soname,$@ -o $@ -nostdlib -x c -
++ echo 'int g(void){return 1;}' | $(CC) -shared -Wl,-soname,$@ -o $@ -nostdlib -x c -
+
+ liba.so: libb.so
+- echo 'int f(){return g();}' | $(CC) -shared -Wl,--no-as-needed -Wl,-soname,$@ -o $@ -Wno-implicit-function-declaration libb.so -nostdlib -x c -
++ echo 'int g(void); int f(void){return g();}' | $(CC) -shared -Wl,--no-as-needed -Wl,-soname,$@ -o $@ -Wno-implicit-function-declaration libb.so -nostdlib -x c -
+
+ exe: liba.so
+- echo 'int _start(){return f();}' | $(CC) -o $@ -Wl,--no-as-needed -Wl,--disable-new-dtags '-Wl,-rpath,$$ORIGIN' '-Wl,-rpath-link,$(CURDIR)' -Wno-implicit-function-declaration -nostdlib -L. -la -x c -
++ echo 'int f(void); int _start(){return f();}' | $(CC) -o $@ -Wl,--no-as-needed -Wl,--disable-new-dtags '-Wl,-rpath,$$ORIGIN' '-Wl,-rpath-link,$(CURDIR)' -Wno-implicit-function-declaration -nostdlib -L. -la -x c -
+
+ check: exe liba.so
+ ! ../../libtree liba.so # should not find libb.so
+--- a/tests/04_rpath_over_env_over_runpath/Makefile
++++ b/tests/04_rpath_over_env_over_runpath/Makefile
+@@ -13,19 +13,19 @@ dir:
+ mkdir $@
+
+ dir/liba.so: dir
+- echo 'int a(){return 42;}' | $(CC) -shared -Wl,-soname,$(@F) -Wl,--no-as-needed -o $@ -nostdlib -x c -
++ echo 'int a(void){return 42;}' | $(CC) -shared -Wl,-soname,$(@F) -Wl,--no-as-needed -o $@ -nostdlib -x c -
+
+ dir/libb.so: dir/liba.so
+- echo 'int b(){return a();}' | $(CC) -shared -Wl,-soname,$(@F) -Wl,--no-as-needed -Wl,--disable-new-dtags '-Wl,-rpath,$$ORIGIN' -Wno-implicit-function-declaration -o $@ -nostdlib dir/liba.so -x c -
++ echo 'int a(void); int b(void){return a();}' | $(CC) -shared -Wl,-soname,$(@F) -Wl,--no-as-needed -Wl,--disable-new-dtags '-Wl,-rpath,$$ORIGIN' -Wno-implicit-function-declaration -o $@ -nostdlib dir/liba.so -x c -
+
+ libb.so:
+ echo 'int b(){return 10;}' | $(CC) -shared -Wl,-soname,$(@F) -Wl,--no-as-needed -o $@ -Wno-implicit-function-declaration -nostdlib -x c -
+
+ exe_rpath: libb.so
+- echo 'int _start(){return b();}' | $(CC) -Wl,--no-as-needed -Wl,--disable-new-dtags "-Wl,-rpath,$(CURDIR)" libb.so -o $@ -Wno-implicit-function-declaration -nostdlib -x c -
++ echo 'int b(void); int _start(void){return b();}' | $(CC) -Wl,--no-as-needed -Wl,--disable-new-dtags "-Wl,-rpath,$(CURDIR)" libb.so -o $@ -Wno-implicit-function-declaration -nostdlib -x c -
+
+ exe_runpath: libb.so
+- echo 'int _start(){return b();}' | $(CC) -Wl,--no-as-needed -Wl,--enable-new-dtags "-Wl,-rpath,$(CURDIR)" libb.so -o $@ -Wno-implicit-function-declaration -nostdlib -x c -
++ echo 'int b(void); int _start(void){return b();}' | $(CC) -Wl,--no-as-needed -Wl,--enable-new-dtags "-Wl,-rpath,$(CURDIR)" libb.so -o $@ -Wno-implicit-function-declaration -nostdlib -x c -
+
+ check: exe_rpath exe_runpath dir/libb.so
+ ../../libtree exe_rpath
+
diff --git a/development/libtree/libtree.SlackBuild b/development/libtree/libtree.SlackBuild
new file mode 100644
index 0000000000..adb8a9a5da
--- /dev/null
+++ b/development/libtree/libtree.SlackBuild
@@ -0,0 +1,99 @@
+#!/bin/bash
+
+# Slackware build script for libtree
+
+# Copyright 2024 Shahab Vahedi, NL
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "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 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.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=libtree
+VERSION=${VERSION:-3.1.1}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+[ "${STATIC:-no}" = "yes" ] && MAKE_ARG="LDFLAGS=-static" || MAKE_ARG=""
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+elif [ "$ARCH" = "aarch64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+else
+ SLKCFLAGS="-O2"
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+# Fix likely errors when the compiler is upgraded
+patch -p1 < $CWD/libtree-3.1.1-modern-c.patch
+
+make CFLAGS="$SLKCFLAGS" $MAKE_ARG
+make install PREFIX=/usr SHAREDIR=/usr DESTDIR=$PKG
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a doc/screenshot.png $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/development/libtree/libtree.info b/development/libtree/libtree.info
new file mode 100644
index 0000000000..809b46da31
--- /dev/null
+++ b/development/libtree/libtree.info
@@ -0,0 +1,10 @@
+PRGNAM="libtree"
+VERSION="3.1.1"
+HOMEPAGE="https://github.com/haampie/libtree"
+DOWNLOAD="https://github.com/haampie/libtree/archive/v3.1.1/libtree-3.1.1.tar.gz"
+MD5SUM="03d64114e732a7e0a7fcb32ab3562ffb"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Shahab Vahedi"
+EMAIL="list+sbo@vahedi.org"
diff --git a/development/libtree/slack-desc b/development/libtree/slack-desc
new file mode 100644
index 0000000000..2872082167
--- /dev/null
+++ b/development/libtree/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+libtree: libtree (ldd as a tree)
+libtree:
+libtree: A tool that:
+libtree: - turns ldd into a tree
+libtree: - explains how shared libraries are found or why they cannot be
+libtree: located
+libtree:
+libtree: homepage: https://github.com/haampie/libtree
+libtree:
+libtree:
+libtree: