Mesa (mesa_7_2_branch): mesa: fix static library construction

Brian Paul brianp at kemper.freedesktop.org
Mon Oct 6 16:59:52 UTC 2008


Module: Mesa
Branch: mesa_7_2_branch
Commit: e981a57346081d305fe8c8bcbbc49d929bd62c44
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e981a57346081d305fe8c8bcbbc49d929bd62c44

Author: Brian Paul <brian.paul at tungstengraphics.com>
Date:   Mon Oct  6 10:58:16 2008 -0600

mesa: fix static library construction

If the .a is made of other .a files, extract the objects from the later.

---

 bin/mklib |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/bin/mklib b/bin/mklib
index a25d5bf..d7b740f 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




More information about the mesa-commit mailing list