From ea662ff1ed62183ae0036242f53a14bb0889cb47 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Thu, 14 Nov 2019 13:25:00 +0100 Subject: [PATCH] gnu: Add clang-toolchain. * gnu/packages/llvm.scm (make-clang-toolchain): New method. (clang-toolchain): New public variable defined using previous method. --- gnu/packages/llvm.scm | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 0a7efe980f..8c47b884ae 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -37,7 +37,9 @@ #:use-module (guix build-system cmake) #:use-module (guix build-system emacs) #:use-module (guix build-system python) + #:use-module (guix build-system trivial) #:use-module (gnu packages) + #:use-module (gnu packages base) #:use-module (gnu packages gcc) #:use-module (gnu packages bootstrap) ;glibc-dynamic-linker #:use-module (gnu packages compression) @@ -295,6 +297,51 @@ project includes the Clang front end, the Clang static analyzer, and several code analysis tools.") (license license:ncsa))) +(define (make-clang-toolchain clang) + (package + (name (string-append (package-name clang) "-toolchain")) + (version (package-version clang)) + (source #f) + (build-system trivial-build-system) + (arguments + '(#:modules ((guix build union)) + #:builder (begin + (use-modules (ice-9 match) + (srfi srfi-26) + (guix build union)) + + (let ((out (assoc-ref %outputs "out"))) + + (match %build-inputs + (((names . directories) ...) + (union-build out directories))) + + (union-build (assoc-ref %outputs "debug") + (list (assoc-ref %build-inputs + "libc-debug"))) + (union-build (assoc-ref %outputs "static") + (list (assoc-ref %build-inputs + "libc-static"))) + #t)))) + + (native-search-paths (package-native-search-paths clang)) + (search-paths (package-search-paths clang)) + + (license (package-license clang)) + (home-page "https://clang.llvm.org") + (synopsis "Complete Clang toolchain for C/C++ development") + (description "This package provides a complete Clang toolchain for C/C++ +development to be installed in user profiles. This includes Clang, as well as +libc (headers and binaries, plus debugging symbols in the @code{debug} +output), and Binutils.") + (outputs '("out" "debug" "static")) + (inputs `(("clang" ,clang) + ("ld-wrapper" ,(car (assoc-ref (%final-inputs) "ld-wrapper"))) + ("binutils" ,binutils) + ("libc" ,glibc) + ("libc-debug" ,glibc "debug") + ("libc-static" ,glibc "static"))))) + (define-public libcxx (package (name "libcxx") @@ -404,6 +451,9 @@ with that of libgomp, the GNU Offloading and Multi Processing Library.") "0svk1f70hvpwrjp6x5i9kqwrqwxnmcrw5s7f4cxyd100mdd12k08" #:patches '("clang-7.0-libc-search-path.patch"))) +(define-public clang-toolchain + (make-clang-toolchain clang)) + (define-public llvm-7 (package (inherit llvm) -- 2.24.0