diff options
author | Brian Paul <[email protected]> | 2006-04-13 15:17:50 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2006-04-13 15:17:50 +0000 |
commit | 56e0ee8efee74e01ece3dae1c5a92d31a2fdd8de (patch) | |
tree | 21a818414489b9a550c87d9702228fa383fbfb56 /bin | |
parent | cbed2f80613cb5d7ec019884d69cded7560aea2f (diff) |
remove the -dlopen option. Always make both kinds of libs for AIX, Darwin.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/mklib | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/bin/mklib b/bin/mklib index b8f7a0127f5..32e43987b37 100755 --- a/bin/mklib +++ b/bin/mklib @@ -5,7 +5,7 @@ # Improvements/fixes are welcome. -# Copyright (C) 1999-2005 Brian Paul All Rights Reserved. +# Copyright (C) 1999-2006 Brian Paul All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -36,7 +36,6 @@ DEPS="" LINK="" CPLUSPLUS=0 STATIC=0 -DLOPEN=0 INSTALLDIR="." ARCH="auto" ARCHOPT="" @@ -65,7 +64,6 @@ do echo ' Not observed on all systems at this time.' echo ' -cplusplus link with C++ runtime' echo ' -static make a static library (default is dynamic/shared)' - echo ' -dlopen make a shared library suitable for dynamic loading' echo ' -install DIR put resulting library file(s) in DIR' echo ' -arch ARCH override using `uname` to determine host system' echo ' -archopt OPT specify an extra achitecture-specific option OPT' @@ -106,9 +104,6 @@ do '-static') STATIC=1 ;; - '-dlopen') - DLOPEN=1 - ;; '-install') shift 1; INSTALLDIR=$1 @@ -214,8 +209,10 @@ case $ARCH in elif [ $STATIC = 1 ] ; then LIBNAME="lib${LIBNAME}" # prefix with "lib" echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a - rm -f ${LIBNAME}.a - ar -ru ${LIBNAME}.a ${OBJECTS} + LINK="ar" + OPTS="-ru" + # make lib + ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS} ranlib ${LIBNAME}.a # finish up FINAL_LIBS=${LIBNAME}.a @@ -323,11 +320,8 @@ case $ARCH in if [ "$ARCHOPT" = "SUNV9" ] ; then ARCHOPTS="-xarch=v9" fi - echo "mklib: linker is" ${LINK} ${OPTS} ${ARCHOPTS} - # for debug: - #echo "mklib: linker is" ${LINK} ${OPTS} - + #echo "mklib: linker is" ${LINK} ${OPTS} ${ARCHOPTS} rm -f ${LIBNAME}.${MAJOR} ${LIBNAME} ${LINK} ${OPTS} ${ARCHOPTS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS} ln -s ${LIBNAME}.${MAJOR} ${LIBNAME} @@ -459,16 +453,18 @@ case $ARCH in if [ $STATIC = 1 ] ; then LIBNAME="lib${LIBNAME}.a" echo "mklib: Making AIX static library: " ${LIBNAME} - rm -f ${LIBNAME} ar -ruv ${X64} ${LIBNAME} ${OBJECTS} FINAL_LIBS=${LIBNAME} else + # We make both .a (normal shared lib) and .so (which can be + # loaded with dlopen). EXPFILE="lib${LIBNAME}.exp" if [ $ARCH = "AIX64" ] ; then OFILE=shr_64.o else OFILE=shr.o #Want to be consistent with the IBM libGL.a fi + DLOPENLIBNAME="lib${LIBNAME}.so" # different libs required for dlopen LIBNAME="lib${LIBNAME}.a" # shared objects are still stored in the .a libraries if [ $ARCH = "AIX64" ] ; then OPTS="-bE:${EXPFILE} -bM:SRE -bnoentry -q64" @@ -495,13 +491,13 @@ case $ARCH in # On AIX a shared library is linked differently when # you want to dlopen the file - if [ $DLOPEN = "1" ] ; then - cc -G ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS} - else - cc ${OPTS} -o ${OFILE} ${OBJECTS} ${DEPS} - ar ${X64} -r ${LIBNAME} ${OFILE} - fi - FINAL_LIBS="${LIBNAME}" + cc -G ${OPTS} -o ${DLOPENLIBNAME} ${OBJECTS} ${DEPS} + + # Traditional link-time binding compatible with system lib + cc ${OPTS} -o ${OFILE} ${OBJECTS} ${DEPS} + ar ${X64} -r ${LIBNAME} ${OFILE} + + FINAL_LIBS="${LIBNAME} ${DLOPENLIBNAME}" fi ;; @@ -546,20 +542,23 @@ case $ARCH in ${LINK} ${OPTS} ${LIBNAME} ${OBJECTS} FINAL_LIBS=${LIBNAME} else - # may need these: - # CFLAGS += -fno-common - # LDFLAGS += -bundle -flat_namespace -undefined suppress # On Darwin a .bundle is used for a library that you want to dlopen - if [ $DLOPEN = "1" ] ; then - LIBSUFFIX="bundle" - FLAGS="${ARCHOPT} -bundle -multiply_defined suppress" - else - LIBSUFFIX="dylib" - FLAGS="${ARCHOPT} -dynamiclib -multiply_defined suppress -current_version ${MAJOR}.${MINOR}.0 -compatibility_version ${MAJOR}.${MINOR}.0 -install_name lib${LIBNAME}.${MAJOR}.${LIBSUFFIX}" - fi - LINKNAME="lib${LIBNAME}.${LIBSUFFIX}" - LIBNAME="lib${LIBNAME}.${MAJOR}.${LIBSUFFIX}" + FLAGS="${ARCHOPT} -bundle -multiply_defined suppress" + BLINKNAME="lib${LIBNAME}.bundle" + BLIBNAME="lib${LIBNAME}.${MAJOR}.bundle" + echo "mklib: Making Darwin bundle: " ${BLIBNAME} + if [ $CPLUSPLUS = 1 ] ; then + LINK="g++" + else + LINK="cc" + fi + ${LINK} ${FLAGS} -o ${BLIBNAME} ${OBJECTS} ${DEPS} + ln -s ${BLIBNAME} ${BLINKNAME} + # A .dylib is for link-time binding + FLAGS="${ARCHOPT} -dynamiclib -multiply_defined suppress -current_version ${MAJOR}.${MINOR}.0 -compatibility_version ${MAJOR}.${MINOR}.0 -install_name lib${LIBNAME}.${MAJOR}.${LIBSUFFIX}" + LINKNAME="lib${LIBNAME}.dylib" + LIBNAME="lib${LIBNAME}.${MAJOR}.dylib" echo "mklib: Making Darwin shared library: " ${LIBNAME} if [ $CPLUSPLUS = 1 ] ; then LINK="g++" @@ -568,7 +567,8 @@ case $ARCH in fi ${LINK} ${FLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} ln -s ${LIBNAME} ${LINKNAME} - FINAL_LIBS="${LIBNAME} ${LINKNAME}" + + FINAL_LIBS="${LIBNAME} ${LINKNAME} ${BLIBNAME} ${BLINKNAME}" fi ;; |