From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nikita Gillmann Subject: Re: Packaging =?utf-8?B?4oCYY2xhbmctdG9vbHMtZXh0cmHigJkgKOKAmGNs?= =?utf-8?B?YW5nLXRpZHnigJks?= etc.) Date: Fri, 24 Apr 2020 19:07:36 +0200 Message-ID: <20200424170736.qvuiz5bzgdp2olrl@hex> References: <87eesdhup7.fsf@inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:35858) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jS1oE-000314-Ub for guix-devel@gnu.org; Fri, 24 Apr 2020 13:08:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jS1oD-0001tH-MM for guix-devel@gnu.org; Fri, 24 Apr 2020 13:08:14 -0400 Received: from aibo.runbox.com ([91.220.196.211]:53742) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jS1oD-0001sK-3m for guix-devel@gnu.org; Fri, 24 Apr 2020 13:08:13 -0400 Content-Disposition: inline In-Reply-To: <87eesdhup7.fsf@inria.fr> 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: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel Ludovic Courtès transcribed 4.9K bytes: > Hello! > > The patch below produces a ‘clang’ package that contains > ‘clang-tools-extra’ commands¹. > [...] > 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. Is it? The way we build clang and clang-tools-extra in pkgsrc is to have them separate. Refer to lang/clang-tools-extra and lang/clang to see how. The gist is, BUILD_TARGET for clang-tools-extra gets overridden and appended with targets to build. That'S just after skipping through the clang-tools-extra package for a minute. I'm not sure if this is applicable to guix in any way. > Thanks in advance! :-) > > Ludo’. > > ¹ https://releases.llvm.org/10.0.0/tools/clang/tools/extra/docs/index.html > > 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))