summaryrefslogtreecommitdiff
path: root/pkgtools/libnbcompat/files/nbcompat.awk
diff options
context:
space:
mode:
Diffstat (limited to 'pkgtools/libnbcompat/files/nbcompat.awk')
-rw-r--r--pkgtools/libnbcompat/files/nbcompat.awk24
1 files changed, 24 insertions, 0 deletions
diff --git a/pkgtools/libnbcompat/files/nbcompat.awk b/pkgtools/libnbcompat/files/nbcompat.awk
new file mode 100644
index 00000000000..147739009bc
--- /dev/null
+++ b/pkgtools/libnbcompat/files/nbcompat.awk
@@ -0,0 +1,24 @@
+BEGIN { process = 1 }
+
+/NBCOMPAT template section follows\./ { process = 0 }
+
+/^\#[ ]*define[ ]+PACKAGE_.*/ {
+ if (process == 0)
+ next;
+ print "/* " $0 " */";
+ next;
+}
+
+/^\#[ ]*define[ ]+/ {
+ if (process == 0)
+ next;
+ guard = $0;
+ sub("^#[ ]*define[ ]+", "", guard);
+ sub("[ ]+.*", "", guard);
+ print "#ifndef " guard;
+ print $0;
+ print "#endif";
+ next;
+}
+
+{ print }