summary refs log tree commit diff
path: root/gnu/packages/llvm.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-09-02 23:52:40 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-09-03 00:26:13 -0400
commitccba460ffda8b2a3cefedaede58ee0efa20905cd (patch)
tree82aa3b5cfaf7df6961e80b7fbd3443b83a4a2a4f /gnu/packages/llvm.scm
parent34766a6631c97af0f13af6c16e1c9d26780e5cb5 (diff)
downloadguix-ccba460ffda8b2a3cefedaede58ee0efa20905cd.tar.gz
gnu: cling: Use gexps.
* gnu/packages/llvm.scm (cling)[configure-flags]: Use gexps and search-input-file.
[phases]: Likewise.
{patch-paths}: Use search-input-file and this-package-input.
{delete-static-libraries}: Adjust for gexps.
Diffstat (limited to 'gnu/packages/llvm.scm')
-rw-r--r--gnu/packages/llvm.scm119
1 files changed, 59 insertions, 60 deletions
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 0f4890af8c..49eb25db1f 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -21,7 +21,7 @@
 ;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2021 Lars-Dominik Braun <lars@6xq.net>
 ;;; Copyright © 2021, 2022 Guillaume Le Vaillant <glv@posteo.net>
-;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2022 Greg Hogan <code@greghogan.com>
 ;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
 ;;; Copyright © 2022 Clément Lassieur <clement@lassieur.org>
@@ -2158,65 +2158,64 @@ LLVM."))))
                 (patches (search-patches "cling-use-shared-library.patch"))))
       (build-system cmake-build-system)
       (arguments
-       `(#:build-type "Release"         ;keep the build as lean as possible
-         #:tests? #f                    ;FIXME: 78 tests fail (out of ~200)
-         #:test-target "check-cling"
-         #:configure-flags
-         (list (string-append "-DCLING_CXX_PATH="
-                              (assoc-ref %build-inputs "gcc") "/bin/g++")
-               ;; XXX: The AddLLVM.cmake module expects LLVM_EXTERNAL_LIT to
-               ;; be a Python script, not a shell executable.
-               (string-append "-DLLVM_EXTERNAL_LIT="
-                              (assoc-ref %build-inputs "python-lit")
-                              "/bin/.lit-real"))
-         #:phases
-         (modify-phases %standard-phases
-           (add-after 'unpack 'set-version
-             (lambda _
-               (make-file-writable "VERSION")
-               (call-with-output-file "VERSION"
-                 (lambda (port)
-                   (format port "~a~%" ,version)))))
-           (add-after 'unpack 'patch-paths
-             (lambda* (#:key inputs #:allow-other-keys)
-               (substitute* "lib/Interpreter/CIFactory.cpp"
-                 (("\bsed\b")
-                  (which "sed"))
-                 ;; This ensures that the default C++ library used by Cling is
-                 ;; that of the compiler that was used to build it, rather
-                 ;; than that of whatever g++ happens to be on PATH.
-                 (("ReadCompilerIncludePaths\\(CLING_CXX_RLTV")
-                  (string-append "ReadCompilerIncludePaths(\""
-                                 (assoc-ref inputs "gcc") "/bin/g++\""))
-                 ;; Cling uses libclang's CompilerInvocation::GetResourcesPath
-                 ;; to resolve Clang's library prefix, but this fails on Guix
-                 ;; because it is relative to the output of cling rather than
-                 ;; clang (see:
-                 ;; https://github.com/root-project/cling/issues/434).  Fully
-                 ;; shortcut the logic in this method to return the correct
-                 ;; static location.
-                 (("static std::string getResourceDir.*" all)
-                  (string-append all
-                                 "    return std::string(\""
-                                 (assoc-ref inputs "clang-cling")
-                                 "/lib/clang/" ,(package-version clang-cling)
-                                 "\");")))
-               ;; Check for the 'lit' command for the tests, not 'lit.py'
-               ;; (see: https://github.com/root-project/cling/issues/432).
-               (substitute* "CMakeLists.txt"
-                 (("lit.py")
-                  "lit"))))
-           (add-after 'unpack 'adjust-lit.cfg
-             ;; See: https://github.com/root-project/cling/issues/435.
-             (lambda _
-               (substitute* "test/lit.cfg"
-                 (("config.llvm_tools_dir \\+ '")
-                  "config.cling_obj_root + '/bin"))))
-           (add-after 'install 'delete-static-libraries
-             ;; This reduces the size from 17 MiB to 5.4 MiB.
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let ((out (assoc-ref outputs "out")))
-                 (for-each delete-file (find-files out "\\.a$"))))))))
+       (list
+        #:build-type "Release"          ;keep the build as lean as possible
+        #:tests? #f                     ;FIXME: 78 tests fail (out of ~200)
+        #:test-target "check-cling"
+        #:configure-flags
+        #~(list (string-append "-DCLING_CXX_PATH="
+                               (search-input-file %build-inputs "bin/g++"))
+                ;; XXX: The AddLLVM.cmake module expects LLVM_EXTERNAL_LIT to
+                ;; be a Python script, not a shell executable.
+                (string-append "-DLLVM_EXTERNAL_LIT="
+                               (search-input-file %build-inputs "bin/.lit-real")))
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'set-version
+              (lambda _
+                (make-file-writable "VERSION")
+                (call-with-output-file "VERSION"
+                  (lambda (port)
+                    (format port "~a~%" #$version)))))
+            (add-after 'unpack 'patch-paths
+              (lambda* (#:key inputs #:allow-other-keys)
+                (substitute* "lib/Interpreter/CIFactory.cpp"
+                  (("\bsed\b")
+                   (which "sed"))
+                  ;; This ensures that the default C++ library used by Cling is
+                  ;; that of the compiler that was used to build it, rather
+                  ;; than that of whatever g++ happens to be on PATH.
+                  (("ReadCompilerIncludePaths\\(CLING_CXX_RLTV")
+                   (format #f "ReadCompilerIncludePaths(~s"
+                           (search-input-file inputs "bin/g++")))
+                  ;; Cling uses libclang's CompilerInvocation::GetResourcesPath
+                  ;; to resolve Clang's library prefix, but this fails on Guix
+                  ;; because it is relative to the output of cling rather than
+                  ;; clang (see:
+                  ;; https://github.com/root-project/cling/issues/434).  Fully
+                  ;; shortcut the logic in this method to return the correct
+                  ;; static location.
+                  (("static std::string getResourceDir.*" all)
+                   (string-append all
+                                  "    return std::string(\""
+                                  #$(this-package-input "clang-cling")
+                                  "/lib/clang/" #$(package-version clang-cling)
+                                  "\");")))
+                ;; Check for the 'lit' command for the tests, not 'lit.py'
+                ;; (see: https://github.com/root-project/cling/issues/432).
+                (substitute* "CMakeLists.txt"
+                  (("lit.py")
+                   "lit"))))
+            (add-after 'unpack 'adjust-lit.cfg
+              ;; See: https://github.com/root-project/cling/issues/435.
+              (lambda _
+                (substitute* "test/lit.cfg"
+                  (("config.llvm_tools_dir \\+ '")
+                   "config.cling_obj_root + '/bin"))))
+            (add-after 'install 'delete-static-libraries
+              ;; This reduces the size from 17 MiB to 5.4 MiB.
+              (lambda _
+                (for-each delete-file (find-files #$output "\\.a$")))))))
       (native-inputs
        (list python python-lit))
       (inputs