summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2010-01-07 17:11:37 -0800
committerDan Nicholson <dbn.lists@gmail.com>2010-01-08 06:01:22 -0800
commita1de400e8de06a80ab140bb0fa950e990607572d (patch)
tree9052026d24efa4145629f0bf700757443e1a43fe
parentdddd5a36aced7c300bac64336a0a88e7bad62c18 (diff)
mklib: Extract archives into temporary directories
When static libraries are created from other archives, objects are extracted and then deleted when the static library is done. This can race when there are multiple static libraries being created from the same archives as with libmesa.a and libmesagallium.a. Should fix this issue with parallel jobs: make[5]: *** No rule to make target > `../../../../../../src/mesa/libmesagallium.a', needed by > `radeon_dri.so'. Stop Signed-off-by: Dan Nicholson <dbn.lists@gmail.com> Reported-and-Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
-rwxr-xr-xbin/mklib22
1 files changed, 17 insertions, 5 deletions
diff --git a/bin/mklib b/bin/mklib
index 0acaeb96eae..9799a4ed277 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -28,15 +28,26 @@
# Given a list of files, look for .a archives and unpack them.
# Return the original list of files minus the .a files plus the unpacked files.
expand_archives() {
+ DIR=$1
+ shift
FILES=$@
NEWFILES=""
+ ORIG_DIR=`pwd`
+ mkdir -p "$DIR"
+ cd "$DIR"
for FILE in $FILES ; do
case $FILE in
*.a)
# extract the .o files from this .a archive
+ case $FILE in
+ /*) ;;
+ *) FILE="$ORIG_DIR/$FILE" ;;
+ esac
MEMBERS=`ar t $FILE`
ar x $FILE
- NEWFILES="$NEWFILES $MEMBERS"
+ for MEMBER in $MEMBERS ; do
+ NEWFILES="$NEWFILES $DIR/$MEMBER"
+ done
;;
*)
# other file type, just add to list
@@ -44,6 +55,7 @@ expand_archives() {
;;
esac
done
+ cd "$ORIG_DIR"
echo $NEWFILES
}
@@ -360,13 +372,13 @@ case $ARCH in
fi
# expand .a into .o files
- NEW_OBJECTS=`expand_archives $OBJECTS`
+ NEW_OBJECTS=`expand_archives ${LIBNAME}.obj $OBJECTS`
# make static lib
FINAL_LIBS=`make_ar_static_lib ${OPTS} 1 ${LIBNAME} ${NEW_OBJECTS}`
# remove temporary extracted .o files
- rm -f `contents_of_archives $OBJECTS`
+ rm -rf ${LIBNAME}.obj
else
# make dynamic library
LIBNAME="lib${LIBNAME}" # prefix with "lib"
@@ -553,12 +565,12 @@ case $ARCH in
echo "mklib: Making FreeBSD static library: " ${STLIB}
# expand .a into .o files
- NEW_OBJECTS=`expand_archives $OBJECTS`
+ NEW_OBJECTS=`expand_archives ${STLIB}.obj $OBJECTS`
FINAL_LIBS=`make_ar_static_lib cq 1 ${STLIB} ${NEW_OBJECTS}`
# remove temporary extracted .o files
- rm -f `contents_of_archives $OBJECTS`
+ rm -rf ${STLIB}.obj
else
# make dynamic library
SHLIB="lib${LIBNAME}.so.${MAJOR}"