From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: Packaging =?utf-8?Q?=E2=80=98clang-tools-extra=E2=80=99_=28?= =?utf-8?Q?=E2=80=98clang-tidy=E2=80=99=2C?= etc.) Date: Fri, 24 Apr 2020 15:36:20 +0200 Message-ID: <87eesdhup7.fsf@inria.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:36786) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRyVU-0005F4-6W for guix-devel@gnu.org; Fri, 24 Apr 2020 09:36:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRyVE-0006Eh-K5 for guix-devel@gnu.org; Fri, 24 Apr 2020 09:36:39 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:30639) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jRyVD-0005eG-UJ for guix-devel@gnu.org; Fri, 24 Apr 2020 09:36:24 -0400 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane-mx.org@gnu.org Sender: "Guix-devel" To: guix-devel --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello! The patch below produces a =E2=80=98clang=E2=80=99 package that contains =E2=80=98clang-tools-extra=E2=80=99 commands=C2=B9. 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 s= elf /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 s= elf /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 =E2=80=98clang-full=E2=80=99 package, but it seem= s wasteful. We could also have a separate output for the extra commands, but it=E2=80= =99s inconvenient. It would be ideal to have a =E2=80=98clang-tools-extra=E2=80= =99 package that depends on =E2=80=98clang=E2=80=99, but building them separately appea= rs to be impossible. Thanks in advance! :-) Ludo=E2=80=99. =C2=B9 https://releases.llvm.org/10.0.0/tools/clang/tools/extra/docs/index.= html --=-=-= Content-Type: text/x-patch Content-Disposition: inline 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)) --=-=-=--