gnu: Allow building toolchain with non-default libc.

* gnu/packages/base.scm (make-gcc-libc): Make public.
* gnu/packages/commencement.scm (make-gcc-toolchain): Add 'libc'
  optional argument to specify using a non-default glibc package, also
  make public.
This commit is contained in:
Carl Dong 2019-05-13 16:02:13 -04:00 committed by Carl Dong
parent d4cafcaf30
commit 6869b6635a
No known key found for this signature in database
GPG key ID: 0CC52153197991A5
2 changed files with 56 additions and 45 deletions

View file

@ -1009,7 +1009,7 @@ (define-public glibc-2.22
(("/bin/pwd") "pwd")) (("/bin/pwd") "pwd"))
#t)))))))) #t))))))))
(define (make-gcc-libc base-gcc libc) (define-public (make-gcc-libc base-gcc libc)
"Return a GCC that targets LIBC." "Return a GCC that targets LIBC."
(package (inherit base-gcc) (package (inherit base-gcc)
(name (string-append (package-name base-gcc) "-" (name (string-append (package-name base-gcc) "-"

View file

@ -54,7 +54,8 @@ (define-module (gnu packages commencement)
#:use-module (srfi srfi-26) #:use-module (srfi srfi-26)
#:use-module (ice-9 vlist) #:use-module (ice-9 vlist)
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:use-module (ice-9 regex)) #:use-module (ice-9 regex)
#:export (make-gcc-toolchain))
;;; Commentary: ;;; Commentary:
;;; ;;;
@ -1014,10 +1015,20 @@ (define-public canonical-package
;;; GCC toolchain. ;;; GCC toolchain.
;;; ;;;
(define (make-gcc-toolchain gcc) ;; Using the following procedure, a gcc toolchain targeting glibc-2.27 can be
"Return a complete toolchain for GCC." ;; instantiated like this:
;;
;; (define-public gcc-glibc-2.27-toolchain
;; (make-gcc-toolchain gcc glibc-2.27))
(define* (make-gcc-toolchain gcc
#:optional
(libc #f))
"Return a complete toolchain for GCC. If LIBC is specified, target that libc."
(let ((gcc (if libc (make-gcc-libc gcc libc) gcc))
(libc (if libc libc glibc-final)))
(package (package
(name "gcc-toolchain") (name (string-append (package-name gcc) "-toolchain"))
(version (package-version gcc)) (version (package-version gcc))
(source #f) (source #f)
(build-system trivial-build-system) (build-system trivial-build-system)
@ -1050,7 +1061,7 @@ (define (make-gcc-toolchain gcc)
(description (description
"This package provides a complete GCC tool chain for C/C++ development to "This package provides a complete GCC tool chain for C/C++ development to
be installed in user profiles. This includes GCC, as well as libc (headers be installed in user profiles. This includes GCC, as well as libc (headers
and binaries, plus debugging symbols in the @code{debug} output), and Binutils.") an d binaries, plus debugging symbols in the @code{debug} output), and Binutils.")
(home-page "https://gcc.gnu.org/") (home-page "https://gcc.gnu.org/")
(outputs '("out" "debug" "static")) (outputs '("out" "debug" "static"))
@ -1060,9 +1071,9 @@ (define (make-gcc-toolchain gcc)
(inputs `(("gcc" ,gcc) (inputs `(("gcc" ,gcc)
("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper"))) ("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper")))
("binutils" ,binutils-final) ("binutils" ,binutils-final)
("libc" ,glibc-final) ("libc" ,libc)
("libc-debug" ,glibc-final "debug") ("libc-debug" ,libc "debug")
("libc-static" ,glibc-final "static"))))) ("libc-static" ,libc "static"))))))
(define-public gcc-toolchain-4.8 (define-public gcc-toolchain-4.8
(make-gcc-toolchain gcc-4.8)) (make-gcc-toolchain gcc-4.8))