# -arch ARCH override using `uname` to determine architecture
# -archopt OPT specify an extra achitecture-specific option OPT
# -noprefix don't prefix library name with "lib" or any suffix
+# -exports FILE only export the symbols listed in FILE
#
# The library name should just be "GL" or "GLU", etc. The 'lib' prefix
# will be added here if needed, as well as the ".so" or ".a" suffix,
ARCH="auto"
ARCHOPT=""
NOPREFIX=0
+EXPORTS=""
#
'-arch') shift 1; ARCH=$1;;
'-archopt') shift 1; ARCHOPT=$1;;
'-noprefix') NOPREFIX=1;;
+ '-exports') shift 1; EXPORTS=$1;;
-*) echo "mklib: Unknown option: " $1 ; exit 1;;
*) break
esac
echo MINOR is $MINOR
echo PATCH is $PATCH
echo DEPS are $DEPS
+ echo "EXPORTS in" $EXPORTS
echo "-----------------"
fi
case $ARCH in
'Linux' | 'OpenBSD')
- # GCC-based environment
+ # we assume gcc
# Set default compilers if env vars not set
if [ "x$CXX" = "x" ] ; then
else
OPTS="-shared -Wl,-soname,${LIBNAME}.so.${MAJOR}"
fi
+ if [ $EXPORTS ] ; then
+ #OPTS="${OPTS} -Xlinker --retain-symbols-file ${EXPORTS}"
+ # Make the 'exptmp' file for --version-script option
+ echo "VERSION_${MAJOR}.${MINOR} {" > exptmp
+ echo "global:" >> exptmp
+ sed 's/$/;/' ${EXPORTS} >> exptmp
+ echo "local:" >> exptmp
+ echo "*;" >> exptmp
+ echo "};" >> exptmp
+ OPTS="${OPTS} -Xlinker --version-script=exptmp"
+ # exptmp is removed below
+ fi
if [ x${PATCH} = "x" ] ; then
VERSION="${MAJOR}.${MINOR}"
else
ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so
# finish up
FINAL_LIBS="${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so"
+ rm -f exptmp
fi
;;