gnu: gcc-4.7: Add gcc-wrapper from gcc-final.

* gnu/packages/commencement.scm (gcc-boot0)[arguments]: Remove CC_FOR_BUILD strictness
relaxing from #:make-flags.
(gcc-final)[arguments]: Move stage "create-stage-wrapper" and related settings
in #:configure-flags and #:make-flags to...
* gnu/packages/gcc.scm (gcc-4.7)[arguments]: ...new "relax-gcc-14s-strictness
stage here.

Change-Id: I0c372a4f372281b54e44dd446b6e5ddac5841c5a
This commit is contained in:
Janneke Nieuwenhuizen 2024-12-12 12:34:03 +01:00
parent b0c6ca831a
commit f88111cbf1
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
2 changed files with 32 additions and 34 deletions

View file

@ -2399,13 +2399,7 @@ (define gcc-boot0
,(glibc-dynamic-linker ,(glibc-dynamic-linker
(match (%current-system) (match (%current-system)
("x86_64-linux" "i686-linux") ("x86_64-linux" "i686-linux")
(_ (%current-system)))))) (_ (%current-system))))))))))
(if (target-hurd64?)
;;Convince gmp's configure that gcc works
(list (string-append
"CC_FOR_BUILD=gcc"
" -Wno-implicit-function-declaration"))
'())))))
((#:phases phases) ((#:phases phases)
#~(modify-phases #$phases #~(modify-phases #$phases
(add-after 'unpack 'unpack-gmp&co (add-after 'unpack 'unpack-gmp&co
@ -3275,24 +3269,14 @@ (define gcc-final
"/lib -L" zlib "/lib -Wl,-rpath=" "/lib -L" zlib "/lib -Wl,-rpath="
zlib "/lib") zlib "/lib")
flag)) flag))
#$(if (or (target-hurd64?) #$flags)))
(and (target-x86?) (target-linux?)))
`(cons
(string-append
;;Convince gmp's configure that gcc works
"STAGE_CC_WRAPPER=" (getcwd) "/build/gcc.sh")
,flags)
flags))))
((#:configure-flags flags) ((#:configure-flags flags)
;; XXX FIXME: Does this need to stay separate?
(if (or (target-hurd64?) (if (or (target-hurd64?)
(and (target-x86?) (target-linux?))) (and (target-x86?) (target-linux?)))
#~(append #~(append
#$flags #$flags
(list #$(string-append (list "--disable-plugin"))
;;Convince gmp's configure that gcc works
"CC=gcc"
" -Wno-implicit-function-declaration")
"--disable-plugin"))
flags)) flags))
;; Build again GMP & co. within GCC's build process, because it's hard ;; 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 ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
@ -3338,20 +3322,7 @@ (define gcc-final
(getenv "CPLUS_INCLUDE_PATH") (getenv "CPLUS_INCLUDE_PATH")
#\:)) #\:))
":") ":")
"\nAM_CXXFLAGS = ")))))) "\nAM_CXXFLAGS = ")))))))))))
#$@(if (or (target-hurd64?)
(and (target-x86?) (target-linux?)))
#~((add-after 'configure 'create-stage-wrapper
(lambda _
(with-output-to-file "gcc.sh"
(lambda _
(format #t "#! ~a/bin/bash
exec \"$@\" \
-Wno-error \
-Wno-implicit-function-declaration"
#$static-bash-for-glibc)))
(chmod "gcc.sh" #o555))))
#~()))))))
;; This time we want Texinfo, so we get the manual. Add ;; 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 ;; STATIC-BASH-FOR-GLIBC so that it's used in the final shebangs of

View file

@ -238,6 +238,33 @@ (define-public gcc-4.7
#:phases #:phases
(modify-phases %standard-phases (modify-phases %standard-phases
(add-before 'configure 'relax-gcc-14s-strictness
(lambda* (#:key inputs #:allow-other-keys)
(let ((bash (assoc-ref inputs "bash"))
(wrapper (string-append (getcwd) "/gcc.sh"))
(stage-wrapper (string-append (getcwd) "/stage-gcc.sh")))
(with-output-to-file wrapper
(lambda _
(format #t "#! ~a/bin/bash
exec gcc \"$@\" \
-Wno-error=implicit-function-declaration"
bash)))
(chmod wrapper #o555)
(with-output-to-file stage-wrapper
(lambda _
(format #t "#! ~a/bin/bash
exec \"$@\" \
-Wno-error=implicit-function-declaration"
bash)))
(chmod stage-wrapper #o555)
;; Rather than adding CC to #:configure-flags and
;; STAGE_CC_WRAPPER to #:make-flags, we add them to the
;; environment in this easily removable stage.
(cond (,(%current-target-system) ;cross-build?
(setenv "CC_FOR_BUILD" wrapper))
(else
(setenv "CC" wrapper)
(setenv "STAGE_CC_WRAPPER" stage-wrapper))))))
(add-before 'configure 'pre-configure (add-before 'configure 'pre-configure
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let ((libdir ,(libdir)) (let ((libdir ,(libdir))