unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Packaging ‘clang-tools-extra’ (‘clang-tidy’, etc.)
@ 2020-04-24 13:36 Ludovic Courtès
  2020-04-24 17:07 ` Nikita Gillmann
  2020-05-29 16:57 ` Ludovic Courtès
  0 siblings, 2 replies; 7+ messages in thread
From: Ludovic Courtès @ 2020-04-24 13:36 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1649 bytes --]

Hello!

The patch below produces a ‘clang’ package that contains
‘clang-tools-extra’ commands¹.

The problem is the size.  Before:

--8<---------------cut here---------------start------------->8---
$ guix size /gnu/store/qxdpxbvfdxfy5dnz4haql4xlxpmb5r6b-clang-10.0.0 |tail -1
total: 995.2 MiB
$ guix size /gnu/store/qxdpxbvfdxfy5dnz4haql4xlxpmb5r6b-clang-10.0.0 |head -2
store item                                                       total    self
/gnu/store/qxdpxbvfdxfy5dnz4haql4xlxpmb5r6b-clang-10.0.0           995.2   456.5  45.9%
--8<---------------cut here---------------end--------------->8---

After:

--8<---------------cut here---------------start------------->8---
$ guix size /gnu/store/5h3xgpg33wip2b8ccri690jp6ikbq16s-clang-10.0.0 |tail -1
total: 1525.4 MiB
$ guix size /gnu/store/5h3xgpg33wip2b8ccri690jp6ikbq16s-clang-10.0.0 |head -2
store item                                                       total    self
/gnu/store/5h3xgpg33wip2b8ccri690jp6ikbq16s-clang-10.0.0          1525.4   986.8  64.7%
--8<---------------cut here---------------end--------------->8---

(How they manage to fill that much disk space, I wonder.)

Any idea how to best package it?

We could of course have a ‘clang-full’ package, but it seems wasteful.
We could also have a separate output for the extra commands, but it’s
inconvenient.  It would be ideal to have a ‘clang-tools-extra’ package
that depends on ‘clang’, but building them separately appears to be
impossible.

Thanks in advance!  :-)

Ludo’.

¹ https://releases.llvm.org/10.0.0/tools/clang/tools/extra/docs/index.html


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 3114 bytes --]

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index d6c519bcbd..a3bcd75190 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -166,7 +166,11 @@ compiler.  In LLVM this library is called \"compiler-rt\".")
     (supported-systems (delete "mips64el-linux" %supported-systems))))
 
 (define* (clang-from-llvm llvm clang-runtime hash
-                          #:key (patches '()))
+                          #:key (patches '()) tools-extra)
+  "Produce Clang with dependencies on LLVM and CLANG-RUNTIME, and applying the
+given PATCHES.  When TOOLS-EXTRA is given, it must point to the
+'clang-tools-extra' tarball, which contains code for 'clang-tidy', 'pp-trace',
+'modularize', and other tools."
   (package
     (name "clang")
     (version (package-version llvm))
@@ -187,7 +191,10 @@ compiler.  In LLVM this library is called \"compiler-rt\".")
     (inputs
      `(("libxml2" ,libxml2)
        ("gcc-lib" ,gcc "lib")
-       ,@(package-inputs llvm)))
+       ,@(package-inputs llvm)
+       ,@(if tools-extra
+             `(("clang-tools-extra" ,tools-extra))
+             '())))
     (propagated-inputs
      `(("llvm" ,llvm)
        ("clang-runtime" ,clang-runtime)))
@@ -208,6 +215,19 @@ compiler.  In LLVM this library is called \"compiler-rt\".")
        #:build-type "Release"
 
        #:phases (modify-phases %standard-phases
+                  ,@(if tools-extra
+                        `((add-after 'unpack 'add-tools-extra
+                            (lambda* (#:key inputs #:allow-other-keys)
+                              (let ((extra (assoc-ref inputs
+                                                      "clang-tools-extra")))
+                                (invoke "tar" "xf" extra)
+                                (rename-file ,(string-append
+                                               "clang-tools-extra-"
+                                               (package-version llvm)
+                                               ".src")
+                                             "tools/extra")
+                                #t))))
+                        '())
                   (add-after 'unpack 'add-missing-triplets
                     (lambda _
                       ;; Clang iterates through known triplets to search for
@@ -376,7 +396,16 @@ output), and Binutils.")
 (define-public clang-10
   (clang-from-llvm llvm-10 clang-runtime-10
                    "08fbxa2a0kr3ni35ckppj0kyvlcyaywrhpqwcdrdy0z900mhcnw8"
-                   #:patches '("clang-10.0-libc-search-path.patch")))
+                   #:patches '("clang-10.0-libc-search-path.patch")
+                   #:tools-extra
+                   #f
+                   #;(origin
+                     (method url-fetch)
+                     (uri (llvm-download-uri "clang-tools-extra"
+                                             (package-version llvm-10)))
+                     (sha256
+                      (base32
+                       "074ija5s2jsdn0k035r2dzmryjmqxdnyg4xwvaqych2bazv8rpxc")))))
 
 (define-public clang-toolchain-10
   (make-clang-toolchain clang-10))

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-05-29 16:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-24 13:36 Packaging ‘clang-tools-extra’ (‘clang-tidy’, etc.) Ludovic Courtès
2020-04-24 17:07 ` Nikita Gillmann
2020-04-27  7:31   ` Ludovic Courtès
2020-04-27  8:50     ` Efraim Flashner
2020-04-27 11:23       ` Nikita Gillmann
2020-05-05 10:21       ` Ludovic Courtès
2020-05-29 16:57 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).