summary refs log tree commit diff
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2019-12-12 12:09:13 +0100
committerJulien Lepiller <julien@lepiller.eu>2019-12-14 20:54:25 +0100
commit50b61ec22306181c419a3bd4c35b3c001c604994 (patch)
tree3dc81dc43e28f2c1a366e40c9f9fd2b93c490e50
parente8cbebb4769328f6ad49a4b5868f9c935e7e5372 (diff)
downloadguix-50b61ec22306181c419a3bd4c35b3c001c604994.tar.gz
gnu: llvm: split scripts to a separate output.
This reduces the closure size by almost 80 MiB.

* gnu/packages/llvm.scm (llvm-8): Add "opt-viewer" output.
-rw-r--r--gnu/packages/llvm.scm32
1 files changed, 22 insertions, 10 deletions
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 082e6e96ca..e09b7f016e 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -88,6 +88,7 @@ as \"x86_64-linux\"."
        (base32
         "0k124sxkfhfi1rca6kzkdraf4axhx99x3cw2rk55056628dvwwl8"))))
     (build-system cmake-build-system)
+    (outputs '("out" "opt-viewer"))
     (native-inputs
      `(("python" ,python-2) ;bytes->str conversion in clang>=3.7 needs python-2
        ("perl"   ,perl)))
@@ -105,16 +106,27 @@ as \"x86_64-linux\"."
 
        ;; Don't use '-g' during the build, to save space.
        #:build-type "Release"
-       #:phases (modify-phases %standard-phases
-                  (add-before 'build 'shared-lib-workaround
-                    ;; Even with CMAKE_SKIP_BUILD_RPATH=FALSE, llvm-tblgen
-                    ;; doesn't seem to get the correct rpath to be able to run
-                    ;; from the build directory.  Set LD_LIBRARY_PATH as a
-                    ;; workaround.
-                    (lambda _
-                      (setenv "LD_LIBRARY_PATH"
-                              (string-append (getcwd) "/lib"))
-                      #t)))))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'shared-lib-workaround
+           ;; Even with CMAKE_SKIP_BUILD_RPATH=FALSE, llvm-tblgen
+           ;; doesn't seem to get the correct rpath to be able to run
+           ;; from the build directory.  Set LD_LIBRARY_PATH as a
+           ;; workaround.
+           (lambda _
+             (setenv "LD_LIBRARY_PATH"
+                     (string-append (getcwd) "/lib"))
+             #t))
+         (add-after 'install 'install-opt-viewer
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (opt-viewer-out (assoc-ref outputs "opt-viewer"))
+                    (opt-viewer-share-dir (string-append opt-viewer-out "/share"))
+                    (opt-viewer-dir (string-append opt-viewer-share-dir "/opt-viewer")))
+               (mkdir-p opt-viewer-share-dir)
+               (rename-file (string-append out "/share/opt-viewer")
+                            opt-viewer-dir))
+             #t)))))
     (home-page "https://www.llvm.org")
     (synopsis "Optimizing compiler infrastructure")
     (description