From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:40095) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkZXW-0003Ke-6h for guix-patches@gnu.org; Mon, 08 Jul 2019 15:43:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hkZXU-0006QA-RU for guix-patches@gnu.org; Mon, 08 Jul 2019 15:43:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50766) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hkZXU-0006Q1-8C for guix-patches@gnu.org; Mon, 08 Jul 2019 15:43:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hkZXT-0003nX-Vl for guix-patches@gnu.org; Mon, 08 Jul 2019 15:43:04 -0400 Subject: [bug#36346] [PATCH] gnu: Allow building toolchain with non-default libc. References: In-Reply-To: Resent-Message-ID: Date: Mon, 08 Jul 2019 19:41:58 +0000 From: Carl Dong Message-ID: <4_kqCtHTlX-MONOFQC9zlsdzOvhHCH5UOLZF_9b2nJIdAA_kZltvFZRcpFNOX-Oj8UL7loc9DY13SOGeUsfpKiLj5wDGftA96g3-661mIG8=@carldong.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Carl Dong Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 36346@debbugs.gnu.org Cc: Carl Dong From: Carl Dong Here's the updated patch, with the clarifications requested. * 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. --- gnu/packages/base.scm | 2 +- gnu/packages/commencement.scm | 111 +++++++++++++++++++--------------- 2 files changed, 62 insertions(+), 51 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 15f35009a9..e40b40681b 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -1009,7 +1009,7 @@ with the Linux kernel.") (("/bin/pwd") "pwd")) #t)))))))) =20 -(define (make-gcc-libc base-gcc libc) +(define-public (make-gcc-libc base-gcc libc) "Return a GCC that targets LIBC." (package (inherit base-gcc) (name (string-append (package-name base-gcc) "-" diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index a8ec677cee..4a41e2abf3 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -54,7 +54,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)) =20 ;;; Commentary: ;;; @@ -1014,55 +1015,65 @@ COREUTILS-FINAL vs. COREUTILS, etc." ;;; GCC toolchain. ;;; =20 -(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++ developmen= t to -be installed in user profiles. This includes GCC, as well as libc (header= s -and binaries, plus debugging symbols in the @code{debug} output), and Binu= tils.") - (home-page "https://gcc.gnu.org/") - (outputs '("out" "debug" "static")) - - ;; The main raison d'=C3=AAtre of this "meta-package" is (1) to conven= iently - ;; install everything that we need, and (2) to make sure ld-wrapper co= mes - ;; 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++ developm= ent to +be installed in user profiles. This includes GCC, as well as libc (head= ers +an d binaries, plus debugging symbols in the @code{debug} output), and Bi= nutils.") + (home-page "https://gcc.gnu.org/") + (outputs '("out" "debug" "static")) + + ;; The main raison d'=C3=AAtre of this "meta-package" is (1) to conv= eniently + ;; 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")))))) =20 (define-public gcc-toolchain-4.8 (make-gcc-toolchain gcc-4.8)) --=20 2.22.0