FailBochs build process reversed

The FailBochs client is not linked by the Bochs build system anymore, but
by our cmake scripts (make fail-client):
 -  All Bochs libraries are merged into libfailbochs.a (a new target
    within the Bochs Autotools scripts).
 -  The previous libfail.a is *not* a merge of all Fail* libraries anymore,
    but pulls these in via library dependencies.

Additionally I did a lot of build system cleanup, e.g. additional external
libraries may now be pulled in where they're needed.

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1390 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
hsc
2012-06-29 22:22:41 +00:00
parent 651738fcca
commit 4a4b3ea7e2
28 changed files with 1298 additions and 171 deletions

View File

@ -1,30 +1,59 @@
#!/bin/bash
#
# Merge all static (.a) libraries into $LIBFAIL, and avoid .o naming conflicts.
# Merge a list of static libraries (.a) and standalone objects (.o) into a
# common static library, and avoid .o naming conflicts.
#
set -e
shopt -s nullglob # expand "*.o" to "" instead of "*.o" if no .o file exists
LIBFAIL=libfail.a
[ -z "$1" ] && echo "usage: $0 output.a input1.a input2.a input3.o ..." >&2 && exit 1
OUT=$1
shift
cd "$1"
rm -f $LIBFAIL
ar rc $LIBFAIL
TMPDIR=$(mktemp -d)
COUNT=1
for lib in *.a
# collect files in tmpdir, assign unique names
for f in "$@"
do
[ "$lib" = "$LIBFAIL" ] && continue
if echo "$f"|egrep -vq '\.[ao]'
then
echo "$0: can only merge .a/.o files, ignoring '$f'" >&2
continue
fi
cp $f $TMPDIR/$(printf %03d $COUNT)$(basename $f)
COUNT=$(($COUNT+1))
done
# create empty output lib
rm -f "$OUT"
ar rc "$OUT"
for lib in $TMPDIR/*.a
do
echo "[FAIL*] Unpacking/merging: $(basename $lib) " >&2
EXTRACTDIR=$TMPDIR/"$(basename $lib).dir"
( # subshell to preserve cwd
mkdir "$EXTRACTDIR"
cd "$EXTRACTDIR"
echo "[FAIL*] Unpacking/merging: $lib ";
# unpack .o files to cwd
ar x "$lib"
# make sure the .o file names are unique
for f in *.o
do
mv $f ${lib}_$f
mv "$f" $(basename "$lib")_"$f"
done
)
# move into merged library
ar r $LIBFAIL *.o
rm -f *.o
ar r "$OUT" "$EXTRACTDIR"/*.o
rm -rf "$EXTRACTDIR"
done
ar r "$OUT" $TMPDIR/*.o
rm -rf "$TMPDIR" &
ranlib "$OUT"