From patchwork Sun Jun 23 20:15:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Carl Dong X-Patchwork-Id: 14371 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 59C951714E; Sun, 23 Jun 2019 21:17:43 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 2D2661714B for ; Sun, 23 Jun 2019 21:17:42 +0100 (BST) Received: from localhost ([::1]:46656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hf8vi-00023O-7V for patchwork@mira.cbaines.net; Sun, 23 Jun 2019 16:17:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48357) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hf8vO-0001uB-Ms for guix-patches@gnu.org; Sun, 23 Jun 2019 16:17:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hf8vI-0006yQ-2E for guix-patches@gnu.org; Sun, 23 Jun 2019 16:17:15 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41167) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hf8v8-0006uF-7D for guix-patches@gnu.org; Sun, 23 Jun 2019 16:17:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hf8v7-0001ol-Vo for guix-patches@gnu.org; Sun, 23 Jun 2019 16:17:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#36346] [PATCH] gnu: Allow building toolchain with non-default libc. Resent-From: Carl Dong Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 23 Jun 2019 20:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36346 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 36346@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15613209724539 (code B ref -1); Sun, 23 Jun 2019 20:17:01 +0000 Received: (at submit) by debbugs.gnu.org; 23 Jun 2019 20:16:12 +0000 Received: from localhost ([127.0.0.1]:54707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hf8uJ-0001Af-Gy for submit@debbugs.gnu.org; Sun, 23 Jun 2019 16:16:12 -0400 Received: from lists.gnu.org ([209.51.188.17]:51489) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hf8uG-00018F-Tg for submit@debbugs.gnu.org; Sun, 23 Jun 2019 16:16:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48186) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hf8uF-0001iG-1V for guix-patches@gnu.org; Sun, 23 Jun 2019 16:16:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hf8uD-0006Bq-Fw for guix-patches@gnu.org; Sun, 23 Jun 2019 16:16:06 -0400 Received: from mail2.protonmail.ch ([185.70.40.22]:29976) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hf8uC-00065v-Me for guix-patches@gnu.org; Sun, 23 Jun 2019 16:16:05 -0400 Date: Sun, 23 Jun 2019 20:15:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=carldong.me; s=protonmail; t=1561320949; bh=8umKavWMVMDzdOpOMl4Lt0FUb2RWUWV+lLAXr7UpHIQ=; h=Date:To:From:Cc:Reply-To:Subject:Feedback-ID:From; b=PtPVw6lFhmle7kAstTCLf2aD8aGOWTVjCdMpGB39FNFFeW9DTSyluS3cCc74rQqZL CeNeELxt2VHlRSBDj1VZ+3ksKyfaFJuW3gKQbZszV/nDOWwltGax8zEft7v4qJCy4x QbQlngKJwT4PjYQyrWqVXtwZoClVqEYKC8RYU6m0= From: Carl Dong Message-ID: Feedback-ID: a8j8tDUaJ4AYuDVBywMTwsJebN4w8TVXadJLsJb8td3t3dZi9RdXFlPaQvoFKnI9KgXySsPXcRkajVyY0cGTcA==:Ext:ProtonMail MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Carl Dong Cc: Carl Dong Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches From: Carl Dong * 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 | 103 ++++++++++++++++++---------------- 2 files changed, 55 insertions(+), 50 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)))))))) -(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..13912f1352 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)) ;;; Commentary: ;;; @@ -1014,55 +1015,59 @@ COREUTILS-FINAL vs. COREUTILS, etc." ;;; GCC toolchain. ;;; -(define (make-gcc-toolchain gcc) +(define* (make-gcc-toolchain gcc + #:optional + (libc #f)) "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"))))) + (let ((gcc (if libc (make-gcc-libc gcc libc) gcc)) + (libc (if libc libc gcc-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-4.8 (make-gcc-toolchain gcc-4.8))