mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-15 18:23:09 +00:00
d2965a7d85
Fixes #18840: too large closure of mesa_drivers. Tested atop 16.09: - clang compiles a hello-world app; - mesa seems to link OK; - ispc builds. Size comparison: - 80 MB of full llvm-3.7 on 16.03; - 200 MB of full llvm-3.9 on 16.09 before this patch; - 50 MB of libLLVM after this commit.
27 lines
1.0 KiB
Diff
27 lines
1.0 KiB
Diff
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
|
|
index 94d426b..37f7794 100644
|
|
--- a/tools/llvm-config/llvm-config.cpp
|
|
+++ b/tools/llvm-config/llvm-config.cpp
|
|
@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
|
|
ActiveIncludeOption = "-I" + ActiveIncludeDir;
|
|
}
|
|
|
|
+ /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
|
|
+ if (!IsInDevelopmentTree) {
|
|
+ bool WantShared = true;
|
|
+ for (int i = 1; i < argc; ++i) {
|
|
+ StringRef Arg = argv[i];
|
|
+ if (Arg == "--link-shared")
|
|
+ WantShared = true;
|
|
+ else if (Arg == "--link-static")
|
|
+ WantShared = false; // the last one wins
|
|
+ }
|
|
+
|
|
+ if (WantShared)
|
|
+ ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
|
|
+ }
|
|
+
|
|
/// We only use `shared library` mode in cases where the static library form
|
|
/// of the components provided are not available; note however that this is
|
|
/// skipped if we're run from within the build dir. However, once installed,
|