summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-10-06 10:58:16 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-10-06 11:01:31 -0600
commit145d49838fe268c8524a369d59cb9f771657ad59 (patch)
treed4cbd3236613c437c41a94755c2cbbc5691a65bd /bin
parentb0ca50bd38b69593ac683a5e7635fbafa5e06676 (diff)
mesa: fix static library construction
If the .a is made of other .a files, extract the objects from the later.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mklib24
1 files changed, 23 insertions, 1 deletions
diff --git a/bin/mklib b/bin/mklib
index a25d5bfaeb..d7b740f8e3 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -260,9 +260,31 @@ case $ARCH in
OPTS=${ALTOPTS}
fi
rm -f ${LIBNAME}
+
+ # expand any .a objects into constituent .o files.
+ NEWOBJECTS=""
+ DELETIA=""
+ for OBJ in ${OBJECTS} ; do
+ if [ `expr match $OBJ '.*\.a'` -gt 0 ] ; then
+ # extract the .o files from this .a archive
+ FILES=`ar t $OBJ`
+ ar x $OBJ
+ NEWOBJECTS="$NEWOBJECTS $FILES"
+ # keep track of temporary .o files and delete them below
+ DELETIA="$DELETIA $FILES"
+ else
+ # ordinary .o file
+ NEWOBJECTS="$NEWOBJECTS $OBJ"
+ fi
+ done
+
# make lib
- ${LINK} ${OPTS} ${LIBNAME} ${OBJECTS}
+ ${LINK} ${OPTS} ${LIBNAME} ${NEWOBJECTS}
ranlib ${LIBNAME}
+
+ # remove temporary extracted .o files
+ rm -f ${DELETIA}
+
# finish up
FINAL_LIBS=${LIBNAME}
else