aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-09-07 09:37:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-09-07 09:37:42 +0200
commit17c1214943959b304ab5cdcccacec8a70c7a6c0f (patch)
tree3ead6c0655e543cb76895af2df7576761179ee89
parentf221ca94a304abaa79239cf2cbaf3ffafbbc092c (diff)
Search for .tbd in addition to .dylib in Mac OS
Besides .dylib, Mac OS now also has "text-based stub libraries" that use the .tbd extension. They appear to be similar to Windows import libraries and contain information such as the location of the .dylib library, its symbols, etc. For example, there is /Library/.../MacOSX13.3.sdk/usr/lib/libsqlite3.tbd which points to /usr/lib/libsqlite3.dylib (but which itself is invisible/inaccessible, presumably for security). Note that for now we are treating the .tbd library as the shared library but could probably do the more elaborate dance with ad hoc members like on Windows if really necessary.
-rw-r--r--libbuild2/cc/common.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/libbuild2/cc/common.cxx b/libbuild2/cc/common.cxx
index 2f428c3..6d36099 100644
--- a/libbuild2/cc/common.cxx
+++ b/libbuild2/cc/common.cxx
@@ -1148,6 +1148,31 @@ namespace build2
s->path_mtime (move (f), mt);
}
}
+ else if (!ext && tsys == "darwin")
+ {
+ // Besides .dylib, Mac OS now also has "text-based stub libraries"
+ // that use the .tbd extension. They appear to be similar to
+ // Windows import libraries and contain information such as the
+ // location of the .dylib library, its symbols, etc. For example,
+ // there is /Library/.../MacOSX13.3.sdk/usr/lib/libsqlite3.tbd
+ // which points to /usr/lib/libsqlite3.dylib (but which itself is
+ // invisible/inaccessible, presumably for security).
+ //
+ // Note that for now we are treating the .tbd library as the
+ // shared library but could probably do the more elaborate dance
+ // with ad hoc members like on Windows if really necessary.
+ //
+ se = string ("tbd");
+ f = f.base (); // Remove .dylib.
+ f += ".tbd";
+ mt = mtime (f);
+
+ if (mt != timestamp_nonexistent)
+ {
+ insert_library (ctx, s, name, d, ld, se, exist, trace);
+ s->path_mtime (move (f), mt);
+ }
+ }
}
// liba