From: Stefan Metzmacher Date: Thu, 22 May 2008 14:27:22 +0000 (+0200) Subject: build: add symbol versioning to libtdb via script/mksyms.* X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7b2f25dd78f8e67b2ac4b5cd333fb788669fd2d3;p=thirdparty%2Fsamba.git build: add symbol versioning to libtdb via script/mksyms.* metze --- diff --git a/source/Makefile.in b/source/Makefile.in index 71b2018a5b2..b71bb34de90 100644 --- a/source/Makefile.in +++ b/source/Makefile.in @@ -1576,7 +1576,7 @@ $(LIBTALLOC_STATIC_TARGET): $(BINARY_PREREQS) $(LIBTALLOC_OBJ0) MKSYMS_SH = $(srcdir)/script/mksyms.sh $(LIBTDB_SYMS): $(LIBTDB_HEADERS) - @$(MKSYMS_SH) $(AWK) $@ $(LIBTDB_HEADERS) + @$(MKSYMS_SH) $(AWK) $(builddir)/library-versions $@ $(LIBTDB_HEADERS) $(LIBTDB_SHARED_TARGET): $(BINARY_PREREQS) $(LIBTDB_OBJ) $(LIBTDB_SYMS) @echo Linking shared library $@ diff --git a/source/script/mksyms.awk b/source/script/mksyms.awk index a30bea4d340..dfe51dba7f0 100644 --- a/source/script/mksyms.awk +++ b/source/script/mksyms.awk @@ -9,9 +9,6 @@ BEGIN { inheader=0; current_file=""; - print "#" - print "# This file is automatically generated with \"make symbols\". DO NOT EDIT " - print "#" print "{" print "\tglobal:" } diff --git a/source/script/mksyms.sh b/source/script/mksyms.sh index 51d3fbd9992..d2f3f3a134b 100755 --- a/source/script/mksyms.sh +++ b/source/script/mksyms.sh @@ -15,26 +15,43 @@ 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~" +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}" + proto_src="`echo $@ | tr ' ' '\n' | sort | uniq `" -echo creating $symsfile +echo "creating $symsfile for $symver" 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