summaryrefslogtreecommitdiff
path: root/mk/configure/cmake-rewrite.awk
diff options
context:
space:
mode:
Diffstat (limited to 'mk/configure/cmake-rewrite.awk')
-rw-r--r--mk/configure/cmake-rewrite.awk29
1 files changed, 29 insertions, 0 deletions
diff --git a/mk/configure/cmake-rewrite.awk b/mk/configure/cmake-rewrite.awk
new file mode 100644
index 00000000000..87132479eef
--- /dev/null
+++ b/mk/configure/cmake-rewrite.awk
@@ -0,0 +1,29 @@
+# $NetBSD: cmake-rewrite.awk,v 1.1 2007/12/12 01:00:38 markd Exp $
+#
+# cleanup references to libraries in the buildlink tree in files
+# written by cmake's export_library_dependencies() function
+#
+BEGIN { buildlink_dir = ARGV[1]; delete ARGV[1] }
+{
+ match($0, "_LIB_DEPENDS \"")
+ if (RSTART == 0) {
+ print
+ } else {
+ printf "%s \"", $1
+ d=substr($0,RSTART+RLENGTH,length($0))
+ while ( d != "\")") {
+ match(d,"[^;]*")
+ dep=substr(d,RSTART,RLENGTH)
+ d=substr(d,RLENGTH+2,length(d))
+ if (dep ~ "^" buildlink_dir) {
+ "ls -l " dep | getline ls_out
+ match(ls_out,"-> ")
+ if (RSTART > 0) {
+ dep=substr(ls_out,RSTART+RLENGTH,length(ls_out))
+ }
+ }
+ printf "%s;",dep
+ }
+ print d
+ }
+}