aboutsummaryrefslogtreecommitdiff
path: root/scripts/abi-versions.awk
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/abi-versions.awk')
-rw-r--r--scripts/abi-versions.awk39
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/abi-versions.awk b/scripts/abi-versions.awk
new file mode 100644
index 0000000..0cceaad
--- /dev/null
+++ b/scripts/abi-versions.awk
@@ -0,0 +1,39 @@
+# Script to generate <abi-versions.h> header file from Versions.all list.
+# See include/shlib-compat.h comments for explanation.
+
+BEGIN {
+ print "/* This file is automatically generated by abi-versions.awk.";
+ print " It defines symbols used by shlib-compat.h, which see. */";
+ print "\n#ifndef _ABI_VERSIONS_H\n#define _ABI_VERSIONS_H";
+}
+
+NF == 2 && $2 == "{" {
+ thislib = $1;
+ gsub(/[^A-Za-z0-9_ ]/, "_"); libid = $1;
+ printf "\n/* start %s */\n", thislib;
+ next;
+}
+$1 == "}" {
+ printf "/* end %s */\n", thislib;
+ next;
+}
+
+$2 == "=" {
+ new = $3;
+ gsub(/[^A-Za-z0-9_ ]/, "_"); id = $1;
+ printf "#define ABI_%s_%s\t0\t/* earliest supported %s */\n", libid, id, new;
+ printf "#define VERSION_%s_%s\t%s\n", libid, id, new;
+ next;
+}
+
+{
+ vers = $1;
+ gsub(/[^A-Za-z0-9_ ]/, "_"); id = $1;
+ printf "#define ABI_%s_%s\t1\t/* support %s */\n", libid, id, vers;
+ printf "#define VERSION_%s_%s\t%s\n", libid, id, vers;
+ next;
+}
+
+END {
+ print "\n#endif /* abi-versions.h */";
+}