summaryrefslogtreecommitdiff
path: root/source3/script/mksyms.sh
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-05-23 11:52:31 +0200
committerStefan Metzmacher <metze@samba.org>2008-05-23 17:19:57 +0200
commit7abda3fb9d10ec5c8b2f61508cd1362d324e3a8a (patch)
treee5f177f3e0e25ebed8e4726b3b49d56da817662d /source3/script/mksyms.sh
parent3d6911afca4c3412b71ba2aeb75abc71cabf74df (diff)
downloadsamba-7abda3fb9d10ec5c8b2f61508cd1362d324e3a8a.tar.gz
samba-7abda3fb9d10ec5c8b2f61508cd1362d324e3a8a.tar.bz2
samba-7abda3fb9d10ec5c8b2f61508cd1362d324e3a8a.zip
build: add symbol versioning when we build with gnu ld
There's --enable-symbol-versioning=no to disable it. metze (cherry picked from commit cb5492978b6b157f529806afb2f5fc6202888129) (This used to be commit a739652d94300881479262648592223536fc8eec)
Diffstat (limited to 'source3/script/mksyms.sh')
-rwxr-xr-xsource3/script/mksyms.sh34
1 files changed, 29 insertions, 5 deletions
diff --git a/source3/script/mksyms.sh b/source3/script/mksyms.sh
index 51d3fbd999..673c77a3cf 100755
--- a/source3/script/mksyms.sh
+++ b/source3/script/mksyms.sh
@@ -15,26 +15,50 @@ LANG=C; export LANG
LC_ALL=C; export LC_ALL
LC_COLLATE=C; export LC_COLLATE
-if [ $# -lt 2 ]
+if [ $# -lt 3 ]
then
- echo "Usage: $0 awk output_file header_files"
+ echo "Usage: $0 awk versionfile output_file header_files"
exit 1
fi
awk="$1"
shift
+versionfile="$1"
+shift
+
symsfile="$1"
shift
symsfile_tmp="$symsfile.$$.tmp~"
-proto_src="`echo $@ | tr ' ' '\n' | sort | uniq `"
+libname=`basename $symsfile | cut -d '.' -f1`
+verline=`grep $libname $versionfile`
+majver=`echo -n "$verline" | cut -d ':' -f2`
+minver=`echo -n "$verline" | cut -d ':' -f3`
+upname=`echo -n "$libname" | sed -e 's/^lib//' | tr '[a-z]' '[A-Z]'`
+symver="${upname}_${majver}.${minver}"
-echo creating $symsfile
+symsext=`basename $symsfile | cut -d '.' -f2-`
+
+if test x"$symsext" = x"version.syms"; then
+ echo "creating $symsfile for $symver"
+else
+ echo "creating $symsfile"
+ symver="# no symbol versioning"
+fi
+
+proto_src="`echo $@ | tr ' ' '\n' | sort | uniq `"
mkdir -p `dirname $symsfile`
-${awk} -f `dirname $0`/mksyms.awk $proto_src > $symsfile_tmp
+cat > $symsfile_tmp <<_ACEOF
+#
+# This file is automatically generated with "$0". DO NOT EDIT
+#
+$symver
+_ACEOF
+
+${awk} -f `dirname $0`/mksyms.awk $proto_src >> $symsfile_tmp
if cmp -s $symsfile $symsfile_tmp 2>/dev/null
then