summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2020-10-21 21:23:24 +0200
committerMarius Bakke <marius@gnu.org>2020-10-22 18:41:29 +0200
commitf91046ce67fcf75183c749fec7dc603d5eba8838 (patch)
tree5793af0f3c1dde781124143e9dfd83bb39fd22cb
parenta45071978c25d4c3d66e0798b6b28fc0ce7756af (diff)
downloadguix-f91046ce67fcf75183c749fec7dc603d5eba8838.tar.gz
gnu: clang@10, clang@11: Fix CMake files.
* gnu/packages/llvm.scm (clang-from-llvm): Add phase adjust-cmake-file when
building Clang 10 or later.
-rw-r--r--gnu/packages/llvm.scm21
1 files changed, 21 insertions, 0 deletions
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index c500430dd5..eb93433c5b 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -326,6 +326,27 @@ given PATCHES.  When TOOLS-EXTRA is given, it must point to the
                                 (("@GLIBC_LIBDIR@")
                                  (string-append libc "/lib"))))))
                         #t)))
+                  ,@(if (version>=? version "10")
+                        `((add-after 'install 'adjust-cmake-file
+                            (lambda* (#:key outputs #:allow-other-keys)
+                              (let ((out (assoc-ref outputs "out")))
+                                ;; Clang generates a CMake file with "targets"
+                                ;; for each installed library file.  Downstream
+                                ;; consumers of the CMake interface can use this
+                                ;; to get absolute library locations.  Including
+                                ;; this file will needlessly assert that _all_
+                                ;; libraries are available, which causes problems
+                                ;; in Guix because some are removed (see the
+                                ;; move-extra-tools phase).  Thus, remove the
+                                ;; asserts so that the main functionality works.
+                                (substitute*
+                                    (string-append
+                                     out
+                                     "/lib/cmake/clang/ClangTargets-release.cmake")
+                                  (("list\\(APPEND _IMPORT_CHECK_TARGETS.*" all)
+                                   (string-append "# Disabled by Guix.\n#" all)))
+                                #t))))
+                        '())
                   ,@(if (version>? version "3.8")
                         `((add-after 'install 'symlink-cfi_blacklist
                             (lambda* (#:key inputs outputs #:allow-other-keys)