mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
f47c6c3d1b
Using a custom ar at $AR may be necessary for cross-compilation. Closes #40369 Signed-off-by: David Goulet <dgoulet@torproject.org>
36 lines
695 B
Bash
Executable File
36 lines
695 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")
|
|
|
|
#echo ORIGDIR="$ORIGDIR"
|
|
#echo AR="$AR"
|
|
#echo ARFLAGS="$AFLAGS"
|
|
|
|
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
|
|
#echo "${AR:-ar}" "${ARFLAGS:-cru}" library.tmp.a ./*/**
|
|
"${AR:-ar}" "${ARFLAGS:-cru}" library.tmp.a ./*/**
|
|
"${RANLIB:-ranlib}" library.tmp.a
|
|
mv -f library.tmp.a "$TARGET"
|