tor/scripts/build/combine_libs
skaluzka 719169dbe3
Update combine_libs script
Remove commented code from production.
Align indentations to 4 spaces.
2021-08-14 21:45:44 +02:00

31 lines
569 B
Bash
Executable File

#!/bin/sh
set -e
TMPDIR="$(mktemp -d -t tor_lib_combining.XXXXXX)"
ORIGDIR="$(pwd)"
trap 'cd "$ORIGDIR" && rm -rf "$TMPDIR"' 0
abspath() {
echo "$(cd "$(dirname "$1")" >/dev/null && pwd)/$(basename "$1")"
}
TARGET=$(abspath "$1")
shift
for input in "$@"; do
cd "$ORIGDIR"
abs=$(abspath "$input")
dir="$TMPDIR"/$(basename "$input" .a)
mkdir "$dir"
cd "$dir" >/dev/null
"${AR:-ar}" x "$abs"
done
cd "$TMPDIR" >/dev/null
"${AR:-ar}" "${ARFLAGS:-cru}" library.tmp.a ./*/**
"${RANLIB:-ranlib}" library.tmp.a
mv -f library.tmp.a "$TARGET"