Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/find-libdeps.in
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2022-05-18 02:31:26 +0200
committerLevente Polyak <anthraxx@archlinux.org>2022-06-22 01:05:02 +0200
commitd94badcd0be4f1f0bdc85a9e17f622373fcc42b2 (patch)
tree09755c43df16dd47d8f99c15213c49315219cb71 /find-libdeps.in
parente1a51770b26f3b36f24dc5668253eda23a8c8bcf (diff)
make: split out source files into src folder
Diffstat (limited to 'find-libdeps.in')
-rw-r--r--find-libdeps.in89
1 files changed, 0 insertions, 89 deletions
diff --git a/find-libdeps.in b/find-libdeps.in
deleted file mode 100644
index e1423b8..0000000
--- a/find-libdeps.in
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/bin/bash
-#
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-m4_include(lib/common.sh)
-
-set -e
-shopt -s extglob
-
-IGNORE_INTERNAL=0
-
-if [[ $1 = "--ignore-internal" ]]; then
- IGNORE_INTERNAL=1
- shift
-fi
-
-script_mode=${BASH_SOURCE[0]##*/find-lib}
-
-case $script_mode in
- deps|provides) true;;
- *) die "Unknown mode %s" "$script_mode" ;;
-esac
-
-if [[ -z $1 ]]; then
- echo "${0##*/} [options] <package file|extracted package dir>"
- echo "Options:"
- echo " --ignore-internal ignore internal libraries"
- exit 1
-fi
-
-if [[ -d $1 ]]; then
- pushd "$1" >/dev/null
-else
- setup_workdir
-
- case ${script_mode} in
- deps) bsdtar -C "$WORKDIR" -xf "$1";;
- provides) bsdtar -C "$WORKDIR" -xf "$1" --include="*.so*";;
- esac
-
- pushd "$WORKDIR" >/dev/null
-fi
-
-process_sofile() {
- # extract the library name: libfoo.so
- soname="${sofile%.so?(+(.+([0-9])))}".so
- # extract the major version: 1
- soversion="${sofile##*\.so\.}"
- if [[ "$soversion" = "$sofile" ]] && ((IGNORE_INTERNAL)); then
- return
- fi
- if ! in_array "${soname}=${soversion}-${soarch}" "${soobjects[@]}"; then
- # libfoo.so=1-64
- echo "${soname}=${soversion}-${soarch}"
- soobjects+=("${soname}=${soversion}-${soarch}")
- fi
-}
-
-case $script_mode in
- deps) find_args=(-perm -u+x);;
- provides) find_args=(-name '*.so*');;
-esac
-
-find . -type f "${find_args[@]}" | while read -r filename; do
- if [[ $script_mode = "provides" ]]; then
- # ignore if we don't have a shared object
- if ! LC_ALL=C readelf -h "$filename" 2>/dev/null | grep -q '.*Type:.*DYN (Shared object file).*'; then
- continue
- fi
- fi
-
- # get architecture of the file; if soarch is empty it's not an ELF binary
- soarch=$(LC_ALL=C readelf -h "$filename" 2>/dev/null | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p')
- [[ -n $soarch ]] || continue
-
- if [[ $script_mode = "provides" ]]; then
- # get the string binaries link to: libfoo.so.1.2 -> libfoo.so.1
- sofile=$(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p')
- [[ -z $sofile ]] && sofile="${filename##*/}"
- process_sofile
- elif [[ $script_mode = "deps" ]]; then
- # process all libraries needed by the binary
- for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p'); do
- process_sofile
- done
- fi
-done
-
-popd >/dev/null