diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-09-18 12:17:02 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-09-18 16:08:24 -0400 |
commit | e9dbb5e395097f4ae38d17cf27408c2688b90d2b (patch) | |
tree | ee052c101eb87d11ba3c692db1b90dffc4642dc5 /scripts/build/combine_libs | |
parent | e8a4482335a1ed6b8238fc7114e3fdd3d7fa9028 (diff) | |
download | tor-e9dbb5e395097f4ae38d17cf27408c2688b90d2b.tar.gz tor-e9dbb5e395097f4ae38d17cf27408c2688b90d2b.zip |
Build one big .a library full of Tor's implementation.
This is experimental and probably will break some platforms
Diffstat (limited to 'scripts/build/combine_libs')
-rwxr-xr-x | scripts/build/combine_libs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/build/combine_libs b/scripts/build/combine_libs new file mode 100755 index 0000000000..fb311552fe --- /dev/null +++ b/scripts/build/combine_libs @@ -0,0 +1,35 @@ +#!/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 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" |