diff options
author | Andy Skinner <[email protected]> | 2008-02-07 13:19:55 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2008-02-07 13:19:55 -0700 |
commit | 762c074012b10e0f859d518b096c120392d7d03d (patch) | |
tree | a48d377a00786033de2435e7989d7d9b4e8a66b0 /bin | |
parent | 51f2ee3bfb72001daf2d6c0e498dd7f1aa8f08f6 (diff) |
added -altopts to allow overriding all other opts
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/mklib | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/bin/mklib b/bin/mklib index 0fb9930ea25..b21658797a0 100755 --- a/bin/mklib +++ b/bin/mklib @@ -71,6 +71,7 @@ do 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' + echo ' -altopts OPTS alternate options to override all others' echo " -noprefix don't prefix library name with 'lib' nor add any suffix" echo ' -exports FILE only export the symbols listed in FILE' echo ' -h, --help display this information and exit' @@ -111,7 +112,6 @@ do DEPS="$DEPS $1" ;; '-pthread') - # for FreeBSD DEPS="$DEPS -pthread" ;; '-cplusplus') @@ -135,6 +135,10 @@ do shift 1; ARCHOPT=$1 ;; + '-altopts') + shift 1; + ALTOPTS=$1 + ;; '-noprefix') NOPREFIX=1 ;; @@ -225,6 +229,10 @@ case $ARCH in OPTS="-m32 ${OPTS}" fi + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + rm -f ${LIBNAME} # make lib ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} @@ -235,6 +243,9 @@ case $ARCH in echo "mklib: Making" $ARCH "static library: " ${LIBNAME} LINK="ar" OPTS="-ru" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi rm -f ${LIBNAME} # make lib ${LINK} ${OPTS} ${LIBNAME} ${OBJECTS} @@ -270,6 +281,9 @@ case $ARCH in if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then OPTS="-m32 ${OPTS}" fi + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi if [ x${PATCH} = "x" ] ; then VERSION="${MAJOR}.${MINOR}" @@ -352,7 +366,9 @@ case $ARCH in if [ "${SPARCV9}" ] ; then OPTS="${OPTS} -xarch=v9" fi - + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi # for debug: #echo "mklib: linker is" ${LINK} ${OPTS} if [ $NOPREFIX = 1 ] ; then @@ -383,6 +399,9 @@ case $ARCH in # No "lib" or ".so" part echo "mklib: Making FreeBSD shared library: " ${LIBNAME} OPTS="-shared" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi rm -f ${LIBNAME} ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} FINAL_LIBS=${LIBNAME} @@ -396,6 +415,9 @@ case $ARCH in else SHLIB="lib${LIBNAME}.so.${MAJOR}" OPTS="-shared -Wl,-soname,${SHLIB}" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi echo "mklib: Making FreeBSD shared library: " ${SHLIB} rm -f ${SHLIB} ${LINK} ${OPTS} ${LDFLAGS} -o ${SHLIB} ${OBJECTS} ${DEPS} @@ -449,6 +471,10 @@ case $ARCH in exit 1 fi + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + if [ $CPLUSPLUS = 1 ] ; then LINK="CC" else @@ -529,6 +555,10 @@ case $ARCH in } }' | sort -u >> ${EXPFILE} + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + # On AIX a shared library is linked differently when # you want to dlopen the file if [ $DLOPEN = "1" ] ; then @@ -580,6 +610,9 @@ case $ARCH in echo "mklib: Making Darwin static library: " ${LIBNAME} LINK="ar" OPTS="-ruvs" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi ${LINK} ${OPTS} ${LIBNAME} ${OBJECTS} FINAL_LIBS=${LIBNAME} else @@ -605,6 +638,10 @@ case $ARCH in OPTS="${OPTS} -arch i386" fi + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + # XXX can we always add -isysroot /Developer/SDKs/MacOSX10.4u.sdk # to OPTS here? @@ -670,6 +707,9 @@ case $ARCH in echo "mklib: Making Intel ICC static library: " ${LIBNAME}.a LINK="ar" OPTS="-ruv" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi # make lib ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS} # finish up @@ -680,6 +720,9 @@ case $ARCH in else OPTS="-shared" fi + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi VERSION="${MAJOR}.${MINOR}.${PATCH}" echo "mklib: Making Intel ICC shared library: " ${LIBNAME}.so.${VERSION} @@ -744,6 +787,9 @@ case $ARCH in echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a LINK="ar" OPTS="-ru" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi # make lib ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS} ranlib ${LIBNAME}.a @@ -751,6 +797,9 @@ case $ARCH in FINAL_LIBS=${LIBNAME}.a else OPTS="-shared -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}-${MAJOR}.dll if [ $CPLUSPLUS = 1 ] ; then |