summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@tungstengraphics.com>2008-06-10 20:17:16 +0100
committerAlan Hourihane <alanh@tungstengraphics.com>2008-06-11 14:10:08 +0100
commit4566b006f1a6bbdb96871e511e10e16f18bad23e (patch)
tree6938da5e79dec0f33ca93ac0bef68d6d56f71f00 /bin
parentbd9264210097d08073a4ea3619ca25db56245280 (diff)
downloadexternal_mesa3d-4566b006f1a6bbdb96871e511e10e16f18bad23e.zip
external_mesa3d-4566b006f1a6bbdb96871e511e10e16f18bad23e.tar.gz
external_mesa3d-4566b006f1a6bbdb96871e511e10e16f18bad23e.tar.bz2
Bring in DRI2 changes
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mklib125
1 files changed, 100 insertions, 25 deletions
diff --git a/bin/mklib b/bin/mklib
index e17e2fe..2fb215e 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -34,6 +34,7 @@ MINOR=0
PATCH=""
DEPS=""
LINK=""
+LDFLAGS=""
CPLUSPLUS=0
STATIC=0
DLOPEN=0
@@ -63,12 +64,14 @@ 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'
@@ -94,12 +97,19 @@ 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"
@@ -128,6 +138,10 @@ do
shift 1;
ARCHOPT=$1
;;
+ '-altopts')
+ shift 1;
+ ALTOPTS=$1
+ ;;
'-noprefix')
NOPREFIX=1
;;
@@ -187,7 +201,7 @@ fi
#
case $ARCH in
- 'Linux' | 'OpenBSD' | 'GNU' | GNU/*)
+ 'Linux' | 'OpenBSD' | 'DragonFly' | 'GNU' | GNU/*)
# we assume gcc
if [ "x$LINK" = "x" ] ; then
@@ -218,9 +232,13 @@ case $ARCH in
OPTS="-m32 ${OPTS}"
fi
+ if [ "${ALTOPTS}" ] ; then
+ OPTS=${ALTOPTS}
+ fi
+
rm -f ${LIBNAME}
# make lib
- ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
+ ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
# finish up
FINAL_LIBS="${LIBNAME}"
elif [ $STATIC = 1 ] ; then
@@ -228,6 +246,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}
@@ -263,6 +284,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}"
@@ -278,7 +302,7 @@ case $ARCH in
rm -f ${LIBNAME}.so
# make lib
- ${LINK} ${OPTS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS}
+ ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS}
# make usual symlinks
ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR}
ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so
@@ -345,15 +369,17 @@ 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} -o ${LIBNAME} ${OBJECTS} ${DEPS}
+ ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
else
rm -f ${LIBNAME}.${MAJOR} ${LIBNAME}
- ${LINK} ${OPTS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS}
+ ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS}
ln -s ${LIBNAME}.${MAJOR} ${LIBNAME}
fi
FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}"
@@ -376,8 +402,11 @@ 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} -o ${LIBNAME} ${OBJECTS} ${DEPS}
+ ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
FINAL_LIBS=${LIBNAME}
elif [ $STATIC = 1 ] ; then
STLIB="lib${LIBNAME}.a"
@@ -389,9 +418,12 @@ 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} -o ${SHLIB} ${OBJECTS} ${DEPS}
+ ${LINK} ${OPTS} ${LDFLAGS} -o ${SHLIB} ${OBJECTS} ${DEPS}
ln -sf ${SHLIB} "lib${LIBNAME}.so"
FINAL_LIBS="${SHLIB} lib${LIBNAME}.so"
fi
@@ -442,6 +474,10 @@ case $ARCH in
exit 1
fi
+ if [ "${ALTOPTS}" ] ; then
+ OPTS=${ALTOPTS}
+ fi
+
if [ $CPLUSPLUS = 1 ] ; then
LINK="CC"
else
@@ -449,7 +485,7 @@ case $ARCH in
fi
echo "mklib: Making IRIX " ${ABI} " shared library: " ${LIBNAME}
- ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
+ ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
FINAL_LIBS=${LIBNAME}
fi
;;
@@ -522,12 +558,16 @@ 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} -o ${LIBNAME} ${OBJECTS} ${DEPS}
+ cc -G ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
else
- cc ${OPTS} -o ${OFILE} ${OBJECTS} ${DEPS}
+ cc ${OPTS} ${LDFLAGS} -o ${OFILE} ${OBJECTS} ${DEPS}
ar ${X64} -r ${LIBNAME} ${OFILE}
fi
@@ -573,6 +613,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
@@ -584,19 +627,37 @@ 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
- LINKNAME="lib${LIBNAME}.${LIBSUFFIX}"
- LIBNAME="lib${LIBNAME}.${MAJOR}.${LIBSUFFIX}"
+
+ 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}"
# examine first object to determine ABI
set ${OBJECTS}
- 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
+ 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
# XXX can we always add -isysroot /Developer/SDKs/MacOSX10.4u.sdk
# to OPTS here?
@@ -609,9 +670,11 @@ case $ARCH in
fi
echo "mklib: Making Darwin shared library: " ${LIBNAME}
- ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
+
+ ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
ln -s ${LIBNAME} ${LINKNAME}
- FINAL_LIBS="${LIBNAME} ${LINKNAME}"
+ ln -s ${LIBNAME} ${LINKNAME2}
+ FINAL_LIBS="${LIBNAME} ${LINKNAME} ${LINKNAME2}"
fi
;;
@@ -663,6 +726,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
@@ -673,6 +739,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}
@@ -686,7 +755,7 @@ case $ARCH in
rm -f ${LIBNAME}.so.${MAJOR}
rm -f ${LIBNAME}.so
# make lib
- ${LINK} ${OPTS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS}
+ ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS}
# make usual symlinks
ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR}
ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so
@@ -737,6 +806,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
@@ -744,6 +816,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
@@ -758,7 +833,7 @@ case $ARCH in
rm -f ${LIBNAME}.a
# make lib
- ${LINK} ${OPTS} -o ${CYGNAME}-${MAJOR}.dll ${OBJECTS} ${DEPS}
+ ${LINK} ${OPTS} ${LDFLAGS} -o ${CYGNAME}-${MAJOR}.dll ${OBJECTS} ${DEPS}
# make usual symlinks
ln -s ${LIBNAME}-${MAJOR}.dll.a ${LIBNAME}.dll.a
# finish up