This is useful for building convenience libraries before combining them into
shared libraries, like dricore

Signed-off-by: Christopher James Halse Rogers 
<christopher.halse.rog...@canonical.com>
---
 bin/mklib |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/bin/mklib b/bin/mklib
index 2c7ed38..b4b5dd5 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -124,6 +124,11 @@ usage() {
     echo "  -noprefix     don't prefix library name with 'lib' nor add any 
suffix"
     echo '  -exports FILE only export the symbols listed in FILE'
     echo '  -id NAME      Sets the id of the dylib (Darwin)'
+    echo '  -whole-archive OBJS1 OBJS2 ... -no-whole-archive'
+    echo '                Include every object file in archives OBJS1 OBJS2 
...'
+    echo '                rather than searching them for required symbols.'
+    echo '                Useful for including convinience libraries in shared'
+    echo '                objects.'
     echo '  -h, --help    display this information and exit'
 }
 
@@ -194,6 +199,18 @@ do
        -Wl*)
             DEPS="$DEPS $1"
             ;;
+       '-whole-archive')
+           shift
+           while [ "x$1" != "x-no-whole-archive" ] ; do
+               if [ "x$1" = "x" ] ; then
+                   echo "mklib: End of arguments reached when scanning for 
-no-whole-archive"
+                   echo "       Arguments to -whole-archive must be terminated 
by -no-whole-archive"
+                   exit 1
+               fi
+               WHOLE_ARCHIVE="$WHOLE_ARCHIVE $1"
+               shift
+           done
+           ;;
        -pthread)
            # this is a special case (see bugzilla 10876)
            DEPS="$DEPS $1"
@@ -271,6 +288,11 @@ if [ $STATIC = 1 ]; then
     OBJECTS=$NEWOBJECTS
 fi
 
+if [ "x$WHOLE_ARCHIVE" != "x" ] ; then
+    ARCHIVE_TEMP=$(mktemp -d)
+    NEW_OBJECTS=`expand_archives ${ARCHIVE_TEMP} ${WHOLE_ARCHIVE}`
+    OBJECTS="${OBJECTS} ${NEW_OBJECTS}"
+fi
 
 #
 # Error checking
@@ -1010,3 +1032,13 @@ if [ ${INSTALLDIR} != "." ] ; then
         mv ${FINAL_BINS} ${INSTALLDIR}/
     fi
 fi
+
+#
+# Clean up temporary directory
+#
+if [ ${ARCHIVE_TEMP} ] ; then
+    if [ -d ${ARCHIVE_TEMP} ] ; then
+       echo "Removing directory ${ARCHIVE_TEMP}"
+       rm -r ${ARCHIVE_TEMP}
+    fi
+fi
-- 
1.7.5.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to