diff options
Diffstat (limited to 'bin/mklib')
-rwxr-xr-x | bin/mklib | 125 |
1 files changed, 25 insertions, 100 deletions
@@ -34,7 +34,6 @@ MINOR=0 PATCH="" DEPS="" LINK="" -LDFLAGS="" CPLUSPLUS=0 STATIC=0 DLOPEN=0 @@ -64,14 +63,12 @@ do echo ' -LDIR search in DIR for library dependencies' echo ' -linker L explicity specify the linker program to use (eg: gcc, g++)' echo ' Not observed on all systems at this time.' - echo ' -ldflags OPT specify any additional linker flags in OPT' 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' - 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' @@ -97,19 +94,12 @@ do shift 1; LINK=$1 ;; - '-ldflags') - shift 1; - LDFLAGS=$1 - ;; -l*) DEPS="$DEPS $1" ;; -L*) DEPS="$DEPS $1" ;; - -Wl*) - DEPS="$DEPS $1" - ;; -pthread) # this is a special case (see bugzilla 10876) DEPS="$DEPS $1" @@ -138,10 +128,6 @@ do shift 1; ARCHOPT=$1 ;; - '-altopts') - shift 1; - ALTOPTS=$1 - ;; '-noprefix') NOPREFIX=1 ;; @@ -201,7 +187,7 @@ fi # case $ARCH in - 'Linux' | 'OpenBSD' | 'DragonFly' | 'GNU' | GNU/*) + 'Linux' | 'OpenBSD' | 'GNU' | GNU/*) # we assume gcc if [ "x$LINK" = "x" ] ; then @@ -232,13 +218,9 @@ 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} + ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS} # finish up FINAL_LIBS="${LIBNAME}" elif [ $STATIC = 1 ] ; then @@ -246,9 +228,6 @@ 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} @@ -284,9 +263,6 @@ 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}" @@ -302,7 +278,7 @@ case $ARCH in rm -f ${LIBNAME}.so # make lib - ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS} + ${LINK} ${OPTS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS} # make usual symlinks ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so @@ -369,17 +345,15 @@ 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 rm -f ${LIBNAME} - ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} + ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS} else rm -f ${LIBNAME}.${MAJOR} ${LIBNAME} - ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS} + ${LINK} ${OPTS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS} ln -s ${LIBNAME}.${MAJOR} ${LIBNAME} fi FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}" @@ -402,11 +376,8 @@ 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} + ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS} FINAL_LIBS=${LIBNAME} elif [ $STATIC = 1 ] ; then STLIB="lib${LIBNAME}.a" @@ -418,12 +389,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} + ${LINK} ${OPTS} -o ${SHLIB} ${OBJECTS} ${DEPS} ln -sf ${SHLIB} "lib${LIBNAME}.so" FINAL_LIBS="${SHLIB} lib${LIBNAME}.so" fi @@ -474,10 +442,6 @@ case $ARCH in exit 1 fi - if [ "${ALTOPTS}" ] ; then - OPTS=${ALTOPTS} - fi - if [ $CPLUSPLUS = 1 ] ; then LINK="CC" else @@ -485,7 +449,7 @@ case $ARCH in fi echo "mklib: Making IRIX " ${ABI} " shared library: " ${LIBNAME} - ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} + ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS} FINAL_LIBS=${LIBNAME} fi ;; @@ -558,16 +522,12 @@ 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 - cc -G ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} + cc -G ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS} else - cc ${OPTS} ${LDFLAGS} -o ${OFILE} ${OBJECTS} ${DEPS} + cc ${OPTS} -o ${OFILE} ${OBJECTS} ${DEPS} ar ${X64} -r ${LIBNAME} ${OFILE} fi @@ -613,9 +573,6 @@ 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 @@ -627,37 +584,19 @@ case $ARCH in LIBSUFFIX="dylib" OPTS="${ARCHOPT} -dynamiclib -multiply_defined suppress -current_version ${MAJOR}.${MINOR}.0 -compatibility_version ${MAJOR}.${MINOR}.0 -install_name lib${LIBNAME}.${MAJOR}.${LIBSUFFIX}" fi - - if [ ${EXPORTS} ] ; then - OPTS="${OPTS} -exported_symbols_list ${EXPORTS}" - fi - - LINKNAME="lib${LIBNAME}.${MAJOR}.${LIBSUFFIX}" - LINKNAME2="lib${LIBNAME}.${LIBSUFFIX}" - LIBNAME="lib${LIBNAME}.${MAJOR}.${MINOR}.${LIBSUFFIX}" + LINKNAME="lib${LIBNAME}.${LIBSUFFIX}" + LIBNAME="lib${LIBNAME}.${MAJOR}.${LIBSUFFIX}" # examine first object to determine ABI set ${OBJECTS} - ABI_PPC=`file $1 | grep ' ppc'` - ABI_I386=`file $1 | grep ' i386'` - ABI_PPC64=`file $1 | grep ' ppc64'` - ABI_X86_64=`file $1 | grep ' x86_64'` - if [ "${ABI_PPC}" ] ; then - OPTS="${OPTS} -arch ppc" - fi - if [ "${ABI_I386}" ] ; then - OPTS="${OPTS} -arch i386" - fi - if [ "${ABI_PPC64}" ] ; then - OPTS="${OPTS} -arch ppc64" - fi - if [ "${ABI_X86_64}" ] ; then - OPTS="${OPTS} -arch x86_64" - fi - - if [ "${ALTOPTS}" ] ; then - OPTS=${ALTOPTS} - fi + ABI_PPC=`file $1 | grep 'object ppc'` + ABI_I386=`file $1 | grep 'object i386'` + if [ "${ABI_PPC}" ] ; then + OPTS="${OPTS} -arch ppc" + fi + if [ "${ABI_I386}" ] ; then + OPTS="${OPTS} -arch i386" + fi # XXX can we always add -isysroot /Developer/SDKs/MacOSX10.4u.sdk # to OPTS here? @@ -670,11 +609,9 @@ case $ARCH in fi echo "mklib: Making Darwin shared library: " ${LIBNAME} - - ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} + ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS} ln -s ${LIBNAME} ${LINKNAME} - ln -s ${LIBNAME} ${LINKNAME2} - FINAL_LIBS="${LIBNAME} ${LINKNAME} ${LINKNAME2}" + FINAL_LIBS="${LIBNAME} ${LINKNAME}" fi ;; @@ -726,9 +663,6 @@ 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 @@ -739,9 +673,6 @@ 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} @@ -755,7 +686,7 @@ case $ARCH in rm -f ${LIBNAME}.so.${MAJOR} rm -f ${LIBNAME}.so # make lib - ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS} + ${LINK} ${OPTS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS} # make usual symlinks ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so @@ -806,9 +737,6 @@ 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 @@ -816,9 +744,6 @@ 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 @@ -833,7 +758,7 @@ case $ARCH in rm -f ${LIBNAME}.a # make lib - ${LINK} ${OPTS} ${LDFLAGS} -o ${CYGNAME}-${MAJOR}.dll ${OBJECTS} ${DEPS} + ${LINK} ${OPTS} -o ${CYGNAME}-${MAJOR}.dll ${OBJECTS} ${DEPS} # make usual symlinks ln -s ${LIBNAME}-${MAJOR}.dll.a ${LIBNAME}.dll.a # finish up |