Fixed mklib to properly merge static libraries on darwin.
authorAlex Weiss <algrs@cacography.net>
Sat, 27 Feb 2010 19:47:43 +0000 (14:47 -0500)
committerDan Nicholson <dbn.lists@gmail.com>
Sun, 28 Feb 2010 08:55:03 +0000 (00:55 -0800)
Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
bin/mklib

index 7f22725..08ef99e 100755 (executable)
--- a/bin/mklib
+++ b/bin/mklib
@@ -743,12 +743,20 @@ case $ARCH in
         if [ $STATIC = 1 ] ; then
             LIBNAME="lib${LIBNAME}.a"
             echo "mklib: Making Darwin static library: " ${LIBNAME}
-            LINK="ar"
             OPTS="-ruvs"
             if [ "${ALTOPTS}" ] ; then
                 OPTS=${ALTOPTS}
             fi
-            ${LINK} ${OPTS} ${LIBNAME} ${OBJECTS}
+
+            # expand .a into .o files
+            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 -rf ${LIBNAME}.obj
+
             FINAL_LIBS=${LIBNAME}
         else
             # On Darwin a .bundle is used for a library that you want to dlopen