From 35ea49daf6cdef5bf6156dd90add77cede364a4b Mon Sep 17 00:00:00 2001 From: Greg Hogan Date: Tue, 8 Feb 2022 18:32:29 +0000 Subject: gnu: clang: Build and link as shared libraries. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes . * 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 --- gnu/packages/llvm.scm | 54 +++------------------------------------------------ 1 file 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 -- cgit v1.2.3