From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id kAyBKKLHVmQwSAEASxT56A (envelope-from ) for ; Sat, 06 May 2023 23:33:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id EAR4KKLHVmSQwAAA9RJhRA (envelope-from ) for ; Sat, 06 May 2023 23:33:22 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E400BE4D2 for ; Sat, 6 May 2023 23:33:21 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pvPWa-0004Yn-MU; Sat, 06 May 2023 17:33:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pvPWY-0004YZ-HN for guix-patches@gnu.org; Sat, 06 May 2023 17:33:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pvPWY-0001P0-9B for guix-patches@gnu.org; Sat, 06 May 2023 17:33:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pvPWX-0000FR-Uc for guix-patches@gnu.org; Sat, 06 May 2023 17:33:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63329] [PATCH v2] gnu: Use gexps for gcc-boot0 and related packages. References: <54e8a32abd9f31253787d5997dbed172d794024f.1683379349.git.mail@cbaines.net> In-Reply-To: <54e8a32abd9f31253787d5997dbed172d794024f.1683379349.git.mail@cbaines.net> Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 06 May 2023 21:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63329 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63329@debbugs.gnu.org Received: via spool by 63329-submit@debbugs.gnu.org id=B63329.1683408757915 (code B ref 63329); Sat, 06 May 2023 21:33:01 +0000 Received: (at 63329) by debbugs.gnu.org; 6 May 2023 21:32:37 +0000 Received: from localhost ([127.0.0.1]:35867 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pvPW8-0000Ee-Eo for submit@debbugs.gnu.org; Sat, 06 May 2023 17:32:37 -0400 Received: from mira.cbaines.net ([212.71.252.8]:42498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pvPW5-0000EV-Ls for 63329@debbugs.gnu.org; Sat, 06 May 2023 17:32:35 -0400 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:3a91:a0a4:ecee:f157]) by mira.cbaines.net (Postfix) with ESMTPSA id C249427BBE2 for <63329@debbugs.gnu.org>; Sat, 6 May 2023 22:32:31 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 8f020309 for <63329@debbugs.gnu.org>; Sat, 6 May 2023 21:32:30 +0000 (UTC) From: Christopher Baines Date: Sat, 6 May 2023 22:32:30 +0100 Message-Id: <7c5922aed25834bcc4cfd248a5107960f3700ae2.1683408750.git.mail@cbaines.net> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1683408802; a=rsa-sha256; cv=none; b=JAVypn2Nxgspru/UReGwHM0UO0QDplLXwWLxWTmTgVLFz4KXyTrfQ0qJchdaAcbZAjtRyK injemmzOxiEQRy9T7VWP2wciEPLSnIU9jFQLc98Wv1QNRfXNxlcGcJsyY1LIfPDIzO+ori sQo14mItV7jwbO40TMeNYppS0E3sA/te8jpKXp/X2fm6MthCrUDHbO8RGktBeOfnW1vS4h C0q4M8w3RjYi1690T3JrdBPKpFNq3YRf1cFdr8bhcxKQAwuQ4n5nSau1i/TvuAyqlEcUHP 0PQqu8fXTwi1KUCi4KKs5KTbHKDtSsK4Uf2h+IYBVW1u+jRfsoDWRjrj62GBGQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1683408802; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=GV8g/jy7L6e/4oDn4LMh7DGt729kggCfmhYo/0smDyo=; b=SE6vfTEISFVToIABdhuZxfSNo3+WJzPUwQeWReZ1oI9YCR2ndnZU8DMbbIHpXtQ6CVHZNZ VlLGvIGJcvg5s6spEy9E3zqLWtT5Quah7huzPl0S86PgZc/TooCYF/1ZT66Ej2qxqm7ovo Y9tW89vKAGVw+LwgbYkUNLL3UahMZYx0oGXaYCq0UdEFs5u8q5i+zpTtfsPBBxufa8aPiZ GnbecUNB74xNB9M5XsjhTaEoyfGq27+lXgllauiI4p3S40wfde2WbpRl0oXPHR3coY84Ty YscvyUuFWCKV8bXDla+Aekb3emDbJOXaZyY3hL2Tmsvbz3CYpM1mmdGobDcLEw== X-Migadu-Spam-Score: -0.51 X-Spam-Score: -0.51 X-Migadu-Queue-Id: E400BE4D2 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-TUID: 5TU4YNFIBVui There are currently problems with native or cross building for i586-gnu, and one factor mixed up with this is that some of the gcc packages use sexp's for the phases, and thus introducing gexp's has caused problems. As part of the going in circles with this, this commit switches gcc-boot0 to use gexp's in it's arguments, and then also modifies libstdc++-boot0, libstdc++-boot0-gcc7, cross-gcc-wrapper, gcc-final and make-libstdc++ to handle this change. If done correctly, this change shouldn't affect any derivations. * gnu/packages/commencement.scm (libstdc++-boot0, libstdc++-boot0-gcc7, gcc-boot0, gcc-final)[arguments]: Use gexps. (cross-gcc-wrapper): Use gexps in the generated package. * gnu/packages/gcc.scm (make-libstdc++): Use gexps in the generated package. --- gnu/packages/commencement.scm | 421 +++++++++++++++++----------------- gnu/packages/gcc.scm | 109 ++++----- 2 files changed, 267 insertions(+), 263 deletions(-) diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index fc1c508b38..c4b50ec2c4 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -2259,13 +2259,13 @@ (define libstdc++-boot0 ((or "i686-linux" "x86_64-linux") (substitute-keyword-arguments (package-arguments lib) ((#:phases phases) - `(modify-phases ,phases - (add-after 'unpack 'workaround-wrapper-bug - ;; XXX: The crude gcc-cross-wrapper causes "g++ -v" to - ;; fail, which in turn confuses the configure script. - (lambda _ - (substitute* "libstdc++-v3/configure" - (("g\\+\\+ -v") "true")))))))) + #~(modify-phases #$phases + (add-after 'unpack 'workaround-wrapper-bug + ;; XXX: The crude gcc-cross-wrapper causes "g++ -v" to + ;; fail, which in turn confuses the configure script. + (lambda _ + (substitute* "libstdc++-v3/configure" + (("g\\+\\+ -v") "true")))))))) (_ (package-arguments lib))) ;; Explicitly add #:modules so MAKE-LIBSTDC++ can be changed @@ -2292,28 +2292,28 @@ (define libstdc++-boot0-gcc7 ,@(substitute-keyword-arguments (package-arguments lib) ((#:phases phases) - `(modify-phases ,phases - (add-after 'unpack 'unpack-gmp&co - (lambda* (#:key inputs #:allow-other-keys) - (let ((gmp (assoc-ref %build-inputs "gmp-source")) - (mpfr (assoc-ref %build-inputs "mpfr-source")) - (mpc (assoc-ref %build-inputs "mpc-source"))) - - ;; To reduce the set of pre-built bootstrap inputs, build - ;; GMP & co. from GCC. - (for-each (lambda (source) - (invoke "tar" "xvf" source)) - (list gmp mpfr mpc)) - - ;; Create symlinks like `gmp' -> `gmp-x.y.z'. - ,@(map (lambda (lib) - ;; Drop trailing letters, as gmp-6.0.0a unpacks - ;; into gmp-6.0.0. - `(symlink ,(string-trim-right - (package-full-name lib "-") - char-set:letter) - ,(package-name lib))) - (list gmp-6.0 mpfr mpc)))))))))) + #~(modify-phases #$phases + (add-after 'unpack 'unpack-gmp&co + (lambda* (#:key inputs #:allow-other-keys) + (let ((gmp (assoc-ref %build-inputs "gmp-source")) + (mpfr (assoc-ref %build-inputs "mpfr-source")) + (mpc (assoc-ref %build-inputs "mpc-source"))) + + ;; To reduce the set of pre-built bootstrap inputs, build + ;; GMP & co. from GCC. + (for-each (lambda (source) + (invoke "tar" "xvf" source)) + (list gmp mpfr mpc)) + + ;; Create symlinks like `gmp' -> `gmp-x.y.z'. + #$@(map (lambda (lib) + ;; Drop trailing letters, as gmp-6.0.0a unpacks + ;; into gmp-6.0.0. + #~(symlink #$(string-trim-right + (package-full-name lib "-") + char-set:letter) + #$(package-name lib))) + (list gmp-6.0 mpfr mpc)))))))))) (inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp-6.0))) ("mpfr-source" ,(bootstrap-origin (package-source mpfr))) ("mpc-source" ,(bootstrap-origin (package-source mpc))) @@ -2338,81 +2338,82 @@ (define gcc-boot0 (system* #$(file-append coreutils-boot0 "/bin/rm") "-rf" "gcc/testsuite/go.test/test/fixedbugs/issue27836.dir")))))) (arguments - `(#:guile ,%bootstrap-guile - #:implicit-inputs? #f - #:modules ((guix build gnu-build-system) + (cons* + #:guile %bootstrap-guile + #:implicit-inputs? #f + #:modules '((guix build gnu-build-system) (guix build utils) (ice-9 regex) (srfi srfi-1) (srfi srfi-26)) - ,@(substitute-keyword-arguments (package-arguments gcc) - ((#:configure-flags flags) - `(append (list ,(string-append "--target=" (boot-triplet)) - - ;; No libc yet. - "--without-headers" - - ;; Disable features not needed at this stage. - "--disable-shared" - "--enable-languages=c,c++" - - ;; libstdc++ cannot be built at this stage - ;; ("Link tests are not allowed after - ;; GCC_NO_EXECUTABLES."). - "--disable-libstdc++-v3" - - "--disable-threads" - "--disable-libmudflap" - "--disable-libatomic" - "--disable-libsanitizer" - "--disable-libitm" - "--disable-libgomp" - "--disable-libmpx" - "--disable-libcilkrts" - "--disable-libvtv" - "--disable-libssp" - "--disable-libquadmath" - "--disable-decimal-float") - (remove (cut string-match - "--(with-system-zlib|enable-languages.*)" <>) - ,flags))) - ((#:make-flags flags) - `(let* ((libc (assoc-ref %build-inputs "libc")) - (libc-native (or (assoc-ref %build-inputs "libc-native") - libc))) - `(,(string-append "LDFLAGS=" - "-Wl,-rpath=" libc-native "/lib " - "-Wl,-dynamic-linker " - "-Wl," libc-native ,(glibc-dynamic-linker - (match (%current-system) - ("x86_64-linux" "i686-linux") - (_ (%current-system)))))))) - ((#:phases phases) - `(modify-phases ,phases - (add-after 'unpack 'unpack-gmp&co - (lambda* (#:key inputs #:allow-other-keys) - (let ((gmp (assoc-ref %build-inputs "gmp-source")) - (mpfr (assoc-ref %build-inputs "mpfr-source")) - (mpc (assoc-ref %build-inputs "mpc-source"))) - - ;; To reduce the set of pre-built bootstrap inputs, build - ;; GMP & co. from GCC. - (for-each (lambda (source) - (invoke "tar" "xvf" source)) - (list gmp mpfr mpc)) - - ;; Create symlinks like `gmp' -> `gmp-x.y.z'. - ,@(map (lambda (lib) - ;; Drop trailing letters, as gmp-6.0.0a unpacks - ;; into gmp-6.0.0. - `(symlink ,(string-trim-right - (package-full-name lib "-") - char-set:letter) - ,(package-name lib))) - (list gmp-6.0 mpfr mpc))))) - ,(match (%current-system) - ((or "i686-linux" "x86_64-linux") - '(add-before 'configure 'fix-libcc1 + (substitute-keyword-arguments (package-arguments gcc) + ((#:configure-flags flags) + #~(append (list #$(string-append "--target=" (boot-triplet)) + + ;; No libc yet. + "--without-headers" + + ;; Disable features not needed at this stage. + "--disable-shared" + "--enable-languages=c,c++" + + ;; libstdc++ cannot be built at this stage + ;; ("Link tests are not allowed after + ;; GCC_NO_EXECUTABLES."). + "--disable-libstdc++-v3" + + "--disable-threads" + "--disable-libmudflap" + "--disable-libatomic" + "--disable-libsanitizer" + "--disable-libitm" + "--disable-libgomp" + "--disable-libmpx" + "--disable-libcilkrts" + "--disable-libvtv" + "--disable-libssp" + "--disable-libquadmath" + "--disable-decimal-float") + (remove (cut string-match + "--(with-system-zlib|enable-languages.*)" <>) + #$flags))) + ((#:make-flags flags) + `(let* ((libc (assoc-ref %build-inputs "libc")) + (libc-native (or (assoc-ref %build-inputs "libc-native") + libc))) + `(,(string-append "LDFLAGS=" + "-Wl,-rpath=" libc-native "/lib " + "-Wl,-dynamic-linker " + "-Wl," libc-native ,(glibc-dynamic-linker + (match (%current-system) + ("x86_64-linux" "i686-linux") + (_ (%current-system)))))))) + ((#:phases phases) + #~(modify-phases #$phases + (add-after 'unpack 'unpack-gmp&co + (lambda* (#:key inputs #:allow-other-keys) + (let ((gmp (assoc-ref %build-inputs "gmp-source")) + (mpfr (assoc-ref %build-inputs "mpfr-source")) + (mpc (assoc-ref %build-inputs "mpc-source"))) + + ;; To reduce the set of pre-built bootstrap inputs, build + ;; GMP & co. from GCC. + (for-each (lambda (source) + (invoke "tar" "xvf" source)) + (list gmp mpfr mpc)) + + ;; Create symlinks like `gmp' -> `gmp-x.y.z'. + #$@(map (lambda (lib) + ;; Drop trailing letters, as gmp-6.0.0a unpacks + ;; into gmp-6.0.0. + #~(symlink #$(string-trim-right + (package-full-name lib "-") + char-set:letter) + #$(package-name lib))) + (list gmp-6.0 mpfr mpc))))) + #$(match (%current-system) + ((or "i686-linux" "x86_64-linux") + #~(add-before 'configure 'fix-libcc1 (lambda* (#:key inputs #:allow-other-keys) ;; libcc1.so NEEDs libgcc_s.so, so provide one here ;; to placate the 'validate-runpath' phase. @@ -2423,18 +2424,18 @@ (define gcc-boot0 ;; XXX: "g++ -v" is broken (see also libstdc++ above). (substitute* "libcc1/configure" (("g\\+\\+ -v") "true"))))) - (_ '(add-before 'configure 'return-true + (_ #~(add-before 'configure 'return-true (lambda _ #t)))) - (add-after 'install 'symlink-libgcc_eh - (lambda* (#:key outputs #:allow-other-keys) - (let ((out (assoc-ref outputs "lib"))) - ;; Glibc wants to link against libgcc_eh, so provide - ;; it. - (with-directory-excursion - (string-append out "/lib/gcc/" - ,(boot-triplet) - "/" ,(package-version gcc)) - (symlink "libgcc.a" "libgcc_eh.a")))))))))) + (add-after 'install 'symlink-libgcc_eh + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "lib"))) + ;; Glibc wants to link against libgcc_eh, so provide + ;; it. + (with-directory-excursion + (string-append out "/lib/gcc/" + #$(boot-triplet) + "/" #$(package-version gcc)) + (symlink "libgcc.a" "libgcc_eh.a")))))))))) (inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp-6.0))) ("mpfr-source" ,(bootstrap-origin (package-source mpfr))) @@ -2888,41 +2889,42 @@ (define (cross-gcc-wrapper gcc binutils glibc bash) (build-system trivial-build-system) (outputs '("out")) (arguments - `(#:guile ,%bootstrap-guile - #:modules ((guix build utils)) - #:builder (begin - (use-modules (guix build utils)) - - (let* ((binutils (assoc-ref %build-inputs "binutils")) - (gcc (assoc-ref %build-inputs "gcc")) - (libc (assoc-ref %build-inputs "libc")) - (bash (assoc-ref %build-inputs "bash")) - (out (assoc-ref %outputs "out")) - (bindir (string-append out "/bin")) - (triplet ,(boot-triplet))) - (define (wrap-program program) - ;; GCC-BOOT0 is a libc-less cross-compiler, so it - ;; needs to be told where to find the crt files and - ;; the dynamic linker. - (call-with-output-file program - (lambda (p) - (format p "#!~a/bin/bash + (list + #:guile %bootstrap-guile + #:modules '((guix build utils)) + #:builder #~(begin + (use-modules (guix build utils)) + + (let* ((binutils (assoc-ref %build-inputs "binutils")) + (gcc (assoc-ref %build-inputs "gcc")) + (libc (assoc-ref %build-inputs "libc")) + (bash (assoc-ref %build-inputs "bash")) + (out (assoc-ref %outputs "out")) + (bindir (string-append out "/bin")) + (triplet #$(boot-triplet))) + (define (wrap-program program) + ;; GCC-BOOT0 is a libc-less cross-compiler, so it + ;; needs to be told where to find the crt files and + ;; the dynamic linker. + (call-with-output-file program + (lambda (p) + (format p "#!~a/bin/bash exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" - bash - gcc triplet program - libc libc - ,(glibc-dynamic-linker)))) - - (chmod program #o555)) - - (mkdir-p bindir) - (with-directory-excursion bindir - (for-each (lambda (tool) - (symlink (string-append binutils "/bin/" - triplet "-" tool) - tool)) - '("ar" "ranlib")) - (for-each wrap-program '("gcc" "g++"))))))) + bash + gcc triplet program + libc libc + #$(glibc-dynamic-linker)))) + + (chmod program #o555)) + + (mkdir-p bindir) + (with-directory-excursion bindir + (for-each (lambda (tool) + (symlink (string-append binutils "/bin/" + triplet "-" tool) + tool)) + '("ar" "ranlib")) + (for-each wrap-program '("gcc" "g++"))))))) (native-inputs `(("binutils" ,binutils) ("gcc" ,gcc) @@ -3122,79 +3124,80 @@ (define gcc-final (outputs (delete "debug" (package-outputs gcc-boot0))) (arguments - `(#:guile ,%bootstrap-guile - #:implicit-inputs? #f + (cons* + #:guile %bootstrap-guile + #:implicit-inputs? #f - #:allowed-references ("out" "lib" ,zlib-final + #:allowed-references `("out" "lib" ,zlib-final ,glibc-final ,static-bash-for-glibc) - ;; Things like libasan.so and libstdc++.so NEED ld.so for some - ;; reason, but it is not in their RUNPATH. This is a false - ;; positive, so turn it off. - #:validate-runpath? #f + ;; Things like libasan.so and libstdc++.so NEED ld.so for some + ;; reason, but it is not in their RUNPATH. This is a false + ;; positive, so turn it off. + #:validate-runpath? #f - ;; Additional modules for the libstdc++ phase below. - #:modules ((srfi srfi-1) + ;; Additional modules for the libstdc++ phase below. + #:modules `((srfi srfi-1) (srfi srfi-26) ,@%gnu-build-system-modules) - ,@(substitute-keyword-arguments (package-arguments gcc) - ((#:make-flags flags) - ;; Since $LIBRARY_PATH is not honored, add the relevant flags. - `(let ((zlib (assoc-ref %build-inputs "zlib"))) - (map (lambda (flag) - (if (string-prefix? "LDFLAGS=" flag) - (string-append flag " -L" - (assoc-ref %build-inputs "libstdc++") - "/lib -L" zlib "/lib -Wl,-rpath=" - zlib "/lib") - flag)) - ,flags))) - ;; Build again GMP & co. within GCC's build process, because it's hard - ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus - ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.) - ((#:phases phases) - `(modify-phases ,phases - (add-after 'unpack 'unpack-gmp&co - (lambda* (#:key inputs #:allow-other-keys) - (let ((gmp (assoc-ref %build-inputs "gmp-source")) - (mpfr (assoc-ref %build-inputs "mpfr-source")) - (mpc (assoc-ref %build-inputs "mpc-source"))) - - ;; To reduce the set of pre-built bootstrap inputs, build - ;; GMP & co. from GCC. - (for-each (lambda (source) - (invoke "tar" "xvf" source)) - (list gmp mpfr mpc)) - - ;; Create symlinks like `gmp' -> `gmp-x.y.z'. - ,@(map (lambda (lib) - ;; Drop trailing letters, as gmp-6.0.0a unpacks - ;; into gmp-6.0.0. - `(symlink ,(string-trim-right + (substitute-keyword-arguments (package-arguments gcc) + ((#:make-flags flags) + ;; Since $LIBRARY_PATH is not honored, add the relevant flags. + #~(let ((zlib (assoc-ref %build-inputs "zlib"))) + (map (lambda (flag) + (if (string-prefix? "LDFLAGS=" flag) + (string-append flag " -L" + (assoc-ref %build-inputs "libstdc++") + "/lib -L" zlib "/lib -Wl,-rpath=" + zlib "/lib") + flag)) + #$flags))) + ;; Build again GMP & co. within GCC's build process, because it's hard + ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus + ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.) + ((#:phases phases) + #~(modify-phases #$phases + (add-after 'unpack 'unpack-gmp&co + (lambda* (#:key inputs #:allow-other-keys) + (let ((gmp (assoc-ref %build-inputs "gmp-source")) + (mpfr (assoc-ref %build-inputs "mpfr-source")) + (mpc (assoc-ref %build-inputs "mpc-source"))) + + ;; To reduce the set of pre-built bootstrap inputs, build + ;; GMP & co. from GCC. + (for-each (lambda (source) + (invoke "tar" "xvf" source)) + (list gmp mpfr mpc)) + + ;; Create symlinks like `gmp' -> `gmp-x.y.z'. + #$@(map (lambda (lib) + ;; Drop trailing letters, as gmp-6.0.0a unpacks + ;; into gmp-6.0.0. + #~(symlink #$(string-trim-right (package-full-name lib "-") char-set:letter) - ,(package-name lib))) - (list gmp-6.0 mpfr mpc))))) - (add-after 'unpack 'fix-build-with-external-libstdc++ - (lambda* (#:key inputs #:allow-other-keys) - (let ((libstdc++ (assoc-ref inputs "libstdc++"))) - ;; Fix a regression in GCC 11 where the libstc++ input - ;; shadows glibc headers when building libstdc++. An - ;; upstream fix was added in GCC 11.3.0, but it only - ;; hides system include directories, not those on - ;; CPLUS_INCLUDE_PATH. See discussion at - ;; . - (substitute* "libstdc++-v3/src/c++17/Makefile.in" - (("AM_CXXFLAGS = ") - (string-append "CPLUS_INCLUDE_PATH = " - (string-join - (remove (cut string-prefix? libstdc++ <>) - (string-split - (getenv "CPLUS_INCLUDE_PATH") - #\:)) - ":") - "\nAM_CXXFLAGS = "))))))))))) + #$(package-name lib))) + (list gmp-6.0 mpfr mpc))))) + (add-after 'unpack 'fix-build-with-external-libstdc++ + (lambda* (#:key inputs #:allow-other-keys) + (let ((libstdc++ (assoc-ref inputs "libstdc++"))) + ;; Fix a regression in GCC 11 where the libstc++ input + ;; shadows glibc headers when building libstdc++. An + ;; upstream fix was added in GCC 11.3.0, but it only + ;; hides system include directories, not those on + ;; CPLUS_INCLUDE_PATH. See discussion at + ;; . + (substitute* "libstdc++-v3/src/c++17/Makefile.in" + (("AM_CXXFLAGS = ") + (string-append "CPLUS_INCLUDE_PATH = " + (string-join + (remove (cut string-prefix? libstdc++ <>) + (string-split + (getenv "CPLUS_INCLUDE_PATH") + #\:)) + ":") + "\nAM_CXXFLAGS = "))))))))))) ;; This time we want Texinfo, so we get the manual. Add ;; STATIC-BASH-FOR-GLIBC so that it's used in the final shebangs of diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index fade5bb64b..d1c79b8dc2 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -864,62 +864,63 @@ (define-public (make-libstdc++ gcc) (inherit gcc) (name "libstdc++") (arguments - `(#:out-of-source? #t - #:modules ((srfi srfi-1) + (list + #:out-of-source? #t + #:modules `((srfi srfi-1) (srfi srfi-26) ,@%gnu-build-system-modules) - #:phases - (modify-phases %standard-phases - ,@(if (version>=? (package-version gcc) "11") - `((add-after 'unpack 'hide-gcc-headers - (lambda* (#:key native-inputs inputs #:allow-other-keys) - (let ((gcc (assoc-ref (or native-inputs inputs) - ,(if (%current-target-system) - "cross-gcc" - "gcc")))) - ;; Fix a regression in GCC 11 where the GCC headers - ;; shadows glibc headers when building libstdc++. An - ;; upstream fix was added in GCC 11.3.0, but it only - ;; hides system include directories, not those on - ;; CPLUS_INCLUDE_PATH. See discussion at - ;; - ;; and the similar adjustment in GCC-FINAL. - (substitute* "libstdc++-v3/src/c++17/Makefile.in" - (("AM_CXXFLAGS = ") - (string-append ,(if (%current-target-system) - "CROSS_CPLUS_INCLUDE_PATH = " - "CPLUS_INCLUDE_PATH = ") - (string-join - (remove (cut string-prefix? gcc <>) - (string-split - (getenv - ,(if (%current-target-system) - "CROSS_CPLUS_INCLUDE_PATH" - "CPLUS_INCLUDE_PATH")) - #\:)) - ":") - "\nAM_CXXFLAGS = "))))))) - '()) - ,@(let ((version (package-version gcc))) - (if (and (target-ppc64le?) - (version>=? version "11") - (not (version>=? version "12"))) - `((add-after 'unpack 'patch-powerpc - (lambda* (#:key inputs #:allow-other-keys) - (invoke "patch" "--force" "-p1" "-i" - (assoc-ref inputs "powerpc64le-patch"))))) - '())) - ;; Force rs6000 (i.e., powerpc) libdir to be /lib and not /lib64. - (add-before 'chdir 'fix-rs6000-libdir - (lambda _ - (when (file-exists? "gcc/config/rs6000") - (substitute* (find-files "gcc/config/rs6000") - (("/lib64") "/lib"))))) - (add-before 'configure 'chdir - (lambda _ - (chdir "libstdc++-v3")))) - - #:configure-flags `("--disable-libstdcxx-pch" + #:phases + #~(modify-phases %standard-phases + #$@(if (version>=? (package-version gcc) "11") + #~((add-after 'unpack 'hide-gcc-headers + (lambda* (#:key native-inputs inputs #:allow-other-keys) + (let ((gcc (assoc-ref (or native-inputs inputs) + #$(if (%current-target-system) + "cross-gcc" + "gcc")))) + ;; Fix a regression in GCC 11 where the GCC headers + ;; shadows glibc headers when building libstdc++. An + ;; upstream fix was added in GCC 11.3.0, but it only + ;; hides system include directories, not those on + ;; CPLUS_INCLUDE_PATH. See discussion at + ;; + ;; and the similar adjustment in GCC-FINAL. + (substitute* "libstdc++-v3/src/c++17/Makefile.in" + (("AM_CXXFLAGS = ") + (string-append #$(if (%current-target-system) + "CROSS_CPLUS_INCLUDE_PATH = " + "CPLUS_INCLUDE_PATH = ") + (string-join + (remove (cut string-prefix? gcc <>) + (string-split + (getenv + #$(if (%current-target-system) + "CROSS_CPLUS_INCLUDE_PATH" + "CPLUS_INCLUDE_PATH")) + #\:)) + ":") + "\nAM_CXXFLAGS = "))))))) + '()) + #$@(let ((version (package-version gcc))) + (if (and (target-ppc64le?) + (version>=? version "11") + (not (version>=? version "12"))) + #~((add-after 'unpack 'patch-powerpc + (lambda* (#:key inputs #:allow-other-keys) + (invoke "patch" "--force" "-p1" "-i" + (assoc-ref inputs "powerpc64le-patch"))))) + '())) + ;; Force rs6000 (i.e., powerpc) libdir to be /lib and not /lib64. + (add-before 'chdir 'fix-rs6000-libdir + (lambda _ + (when (file-exists? "gcc/config/rs6000") + (substitute* (find-files "gcc/config/rs6000") + (("/lib64") "/lib"))))) + (add-before 'configure 'chdir + (lambda _ + (chdir "libstdc++-v3")))) + + #:configure-flags '`("--disable-libstdcxx-pch" ,(string-append "--with-gxx-include-dir=" (assoc-ref %outputs "out") "/include")))) base-commit: 40d6615ca2755605e8aab790fbbae0221ec1d827 -- 2.39.1