From 17c1214943959b304ab5cdcccacec8a70c7a6c0f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 7 Sep 2023 09:37:42 +0200 Subject: 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. --- libbuild2/cc/common.cxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'libbuild2/cc/common.cxx') 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 -- cgit v1.1