summary refs log tree commit diff
path: root/gnu/packages/commencement.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-07-17 15:51:10 +0200
committerLudovic Courtès <ludo@gnu.org>2019-07-17 15:51:10 +0200
commit64de896a71a9ba3091259834077d54c0146bdab6 (patch)
treeda58cc584fcc42a2b04f692aa3b1ada4c8949f5e /gnu/packages/commencement.scm
parent5247aab8d6a18a4081ab7caeddb4fc083bca1f6b (diff)
parent6bfcb729268e0d20c6ae78224aef0eaad2ee2e74 (diff)
downloadguix-64de896a71a9ba3091259834077d54c0146bdab6.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/packages/commencement.scm')
-rw-r--r--gnu/packages/commencement.scm111
1 files changed, 61 insertions, 50 deletions
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 1107bb24d2..69d1f87605 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -59,7 +59,8 @@
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 vlist)
   #:use-module (ice-9 match)
-  #:use-module (ice-9 regex))
+  #:use-module (ice-9 regex)
+  #:export (make-gcc-toolchain))
 
 ;;; Commentary:
 ;;;
@@ -2483,55 +2484,65 @@ COREUTILS-FINAL vs. COREUTILS, etc."
 ;;; GCC toolchain.
 ;;;
 
-(define (make-gcc-toolchain gcc)
-  "Return a complete toolchain for GCC."
-  (package
-    (name "gcc-toolchain")
-    (version (package-version gcc))
-    (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 gcc))
-    (search-paths (package-search-paths gcc))
-
-    (license (package-license gcc))
-    (synopsis "Complete GCC tool chain for C/C++ development")
-    (description
-     "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
-and binaries, plus debugging symbols in the @code{debug} output), and Binutils.")
-    (home-page "https://gcc.gnu.org/")
-    (outputs '("out" "debug" "static"))
-
-    ;; The main raison d'être of this "meta-package" is (1) to conveniently
-    ;; install everything that we need, and (2) to make sure ld-wrapper comes
-    ;; before Binutils' ld in the user's profile.
-    (inputs `(("gcc" ,gcc)
-              ("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper")))
-              ("binutils" ,binutils-final)
-              ("libc" ,glibc-final)
-              ("libc-debug" ,glibc-final "debug")
-              ("libc-static" ,glibc-final "static")))))
+;; Using the following procedure, a gcc toolchain targeting glibc-2.27 can be
+;; 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
+      (name (string-append (package-name gcc) "-toolchain"))
+      (version (package-version gcc))
+      (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 gcc))
+      (search-paths (package-search-paths gcc))
+
+      (license (package-license gcc))
+      (synopsis "Complete GCC tool chain for C/C++ development")
+      (description
+       "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
+an  d binaries, plus debugging symbols in the @code{debug} output), and Binutils.")
+      (home-page "https://gcc.gnu.org/")
+      (outputs '("out" "debug" "static"))
+
+      ;; The main raison d'être of this "meta-package" is (1) to conveniently
+      ;; install everything that we need, and (2) to make sure ld-wrapper comes
+      ;; before Binutils' ld in the user's profile.
+      (inputs `(("gcc" ,gcc)
+                ("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper")))
+                ("binutils" ,binutils-final)
+                ("libc" ,libc)
+                ("libc-debug" ,libc "debug")
+                ("libc-static" ,libc "static"))))))
 
 (define-public gcc-toolchain
   (make-gcc-toolchain gcc-final))