summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2004-10-16 15:10:45 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2004-10-16 15:10:45 +0000
commit158a251a6b8ffa02387c767a00dc960b49098022 (patch)
treed79575168ea0765eec40452af208a638581526b4 /bin
parent901d9b9a92480ee9965558cf27f309c7e186ba08 (diff)
added initial support for -exports option, Linux/OpenBSD only for now
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mklib19
1 files changed, 18 insertions, 1 deletions
diff --git a/bin/mklib b/bin/mklib
index 2f6beff7c8..7973be8f0c 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -21,6 +21,7 @@
# -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,
@@ -48,6 +49,7 @@ INSTALLDIR="."
ARCH="auto"
ARCHOPT=""
NOPREFIX=0
+EXPORTS=""
#
@@ -68,6 +70,7 @@ do
'-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
@@ -104,6 +107,7 @@ if [ ] ; then
echo MINOR is $MINOR
echo PATCH is $PATCH
echo DEPS are $DEPS
+ echo "EXPORTS in" $EXPORTS
echo "-----------------"
fi
@@ -114,7 +118,7 @@ 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
@@ -157,6 +161,18 @@ case $ARCH in
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
@@ -183,6 +199,7 @@ case $ARCH in
ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so
# finish up
FINAL_LIBS="${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so"
+ rm -f exptmp
fi
;;