From cc2738c71ad454dba35cb8c33c4fce2481e344e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Kochen?= Date: Tue, 14 Mar 2023 22:38:19 +0100 Subject: [PATCH] swift: reduce closure size of swift-lib --- pkgs/development/compilers/swift/compiler/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/swift/compiler/default.nix b/pkgs/development/compilers/swift/compiler/default.nix index 5f37c3ec841b..0c0083c334aa 100644 --- a/pkgs/development/compilers/swift/compiler/default.nix +++ b/pkgs/development/compilers/swift/compiler/default.nix @@ -619,7 +619,12 @@ in stdenv.mkDerivation { # Swift has a separate resource root from Clang, but locates the Clang # resource root via subdir or symlink. Provide a default here, but we also # patch Swift to prefer NIX_CC if set. - ln -s ${clang}/resource-root $lib/lib/swift/clang + # + # NOTE: We don't symlink directly here, because that'd add a run-time dep + # on the full Clang compiler to every Swift executable. The copy here is + # just copying the 3 symlinks inside to smaller closures. + mkdir $lib/lib/swift/clang + cp -P ${clang}/resource-root/* $lib/lib/swift/clang/ ${lib.optionalString stdenv.isDarwin '' # Install required library for ObjC interop.