summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorGreg Hogan <code@greghogan.com>2022-02-08 18:32:29 +0000
committerLudovic Courtès <ludo@gnu.org>2022-02-16 16:49:27 +0100
commit35ea49daf6cdef5bf6156dd90add77cede364a4b (patch)
tree48757788e0351265dc1872b1e50577c0aba2ea0a /gnu
parent5d4d8d83e4aa6db2e0a325e2ffb915c12fe5234d (diff)
downloadguix-35ea49daf6cdef5bf6156dd90add77cede364a4b.tar.gz
gnu: clang: Build and link as shared libraries.
Fixes <https://issues.guix.gnu.org/52054>.

* gnu/packages/llvm.scm (clang)[arguments]<#:phases>:
Remove the separate "extra" output and build the main package and
clang-tools-extras with shared library linkage.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/llvm.scm54
1 files changed, 3 insertions, 51 deletions
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index b6d52402a8..eb949bed1b 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -188,7 +188,6 @@ given PATCHES.  When TOOLS-EXTRA is given, it must point to the
     ;; doesn't seem to be any way to do this with clang's autotools-based
     ;; build system.
     (build-system cmake-build-system)
-    (outputs (if tools-extra '("out" "extra") '("out")))
     (native-inputs (package-native-inputs llvm))
     (inputs
      `(("libxml2" ,libxml2)
@@ -229,56 +228,9 @@ given PATCHES.  When TOOLS-EXTRA is given, it must point to the
                                                (string-delete #\- (package-version llvm))
                                                ".src")
                                              "tools/extra")
-                                #t)))
-                          (add-after 'install 'move-extra-tools
-                            (lambda* (#:key outputs #:allow-other-keys)
-                              ;; Move the extra tools to the "extra" output.
-                              ;; These programs alone weigh in at 296 MiB,
-                              ;; because they statically-link a whole bunch of
-                              ;; Clang libraries.
-                              (let* ((out   (assoc-ref outputs "out"))
-                                     (extra (assoc-ref outputs "extra"))
-                                     (bin   (string-append out "/bin"))
-                                     (bin*  (string-append extra "/bin"))
-                                     (lib   (string-append out "/lib")))
-                                (define (move program)
-                                  (rename-file (string-append bin "/" program)
-                                               (string-append bin* "/"
-                                                              program)))
-
-                                (mkdir-p bin*)
-                                (for-each move
-                                          '("clang-apply-replacements"
-                                            "clang-change-namespace"
-                                            "clangd"
-                                            "clang-doc"
-                                            "clang-include-fixer"
-                                            "clang-move"
-                                            "clang-query"
-                                            "clang-reorder-fields"
-                                            "clang-tidy"
-                                            "find-all-symbols"
-                                            "modularize"
-                                            "pp-trace"))
-
-                                ;; Remove MiBs of .a files coming from
-                                ;; 'clang-tools-extra'.
-                                (for-each (lambda (component)
-                                            (delete-file
-                                             (string-append lib "/libclang"
-                                                            component ".a")))
-                                          '("ApplyReplacements"
-                                            "ChangeNamespace"
-                                            "Daemon"
-                                            "DaemonTweaks"
-                                            "Doc"
-                                            "IncludeFixer"
-                                            "IncludeFixerPlugin"
-                                            "Move"))
-                                (for-each delete-file
-                                          (find-files
-                                           lib
-                                           "^(libfindAllSymbols|libclangTidy)"))
+                                ;; Build and link to shared libraries.
+                                (substitute* "cmake/modules/AddClang.cmake"
+                                  (("BUILD_SHARED_LIBS") "True"))
                                 #t))))
                         '())
                   (add-after 'unpack 'add-missing-triplets