@@ -41,29 +41,8 @@ FILE-NAME found in ./patches relative to the current file."
4141 ((%patch-path (list (string-append (dirname (current-filename)) " /patches" ))))
4242 (list (search-patch file-name) ...)))
4343
44- (define (make-gcc-rpath-link xgcc )
45- "Given a XGCC package, return a modified package that replace each instance of
46- -rpath in the default system spec that's inserted by Guix with -rpath-link"
47- (package
48- (inherit xgcc)
49- (arguments
50- (substitute-keyword-arguments (package-arguments xgcc)
51- ((#:phases phases)
52- `(modify-phases ,phases
53- (add-after 'pre-configure 'replace-rpath-with-rpath-link
54- (lambda _
55- (substitute* (cons " gcc/config/rs6000/sysv4.h"
56- (find-files " gcc/config"
57- " ^gnu-user.*\\ .h$" ))
58- ((" -rpath=" ) " -rpath-link=" ))
59- #t ))))))))
60-
6144(define building-on (string-append " --build=" (list-ref (string-split (%current-system) #\- ) 0 ) " -guix-linux-gnu" ))
6245
63- (define (explicit-cross-configure package )
64- (define building-on (string-append (list-ref (string-split (%current-system) #\- ) 0 ) " -guix-linux-gnu" ))
65- (package-with-extra-configure-variable package " --build" building-on))
66-
6746(define (make-cross-toolchain target
6847 base-gcc-for-libc
6948 base-kernel-headers
@@ -73,9 +52,9 @@ FILE-NAME found in ./patches relative to the current file."
7352 (let* ((xbinutils (cross-binutils target))
7453 ; ; 1. Build a cross-compiling gcc without targeting any libc, derived
7554 ; ; from BASE-GCC-FOR-LIBC
76- (xgcc-sans-libc (explicit-cross-configure ( cross-gcc target
77- #:xgcc base-gcc-for-libc
78- #:xbinutils xbinutils) ))
55+ (xgcc-sans-libc (cross-gcc target
56+ #:xgcc base-gcc-for-libc
57+ #:xbinutils xbinutils))
7958 ; ; 2. Build cross-compiled kernel headers with XGCC-SANS-LIBC, derived
8059 ; ; from BASE-KERNEL-HEADERS
8160 (xkernel (cross-kernel-headers target
@@ -84,17 +63,17 @@ FILE-NAME found in ./patches relative to the current file."
8463 xbinutils))
8564 ; ; 3. Build a cross-compiled libc with XGCC-SANS-LIBC and XKERNEL,
8665 ; ; derived from BASE-LIBC
87- (xlibc (explicit-cross-configure ( cross-libc target
88- base-libc
89- xgcc-sans-libc
90- xbinutils
91- xkernel) ))
66+ (xlibc (cross-libc target
67+ base-libc
68+ xgcc-sans-libc
69+ xbinutils
70+ xkernel))
9271 ; ; 4. Build a cross-compiling gcc targeting XLIBC, derived from
9372 ; ; BASE-GCC
94- (xgcc (explicit-cross-configure ( cross-gcc target
95- #:xgcc base-gcc
96- #:xbinutils xbinutils
97- #:libc xlibc) )))
73+ (xgcc (cross-gcc target
74+ #:xgcc base-gcc
75+ #:xbinutils xbinutils
76+ #:libc xlibc)))
9877 ; ; Define a meta-package that propagates the resulting XBINUTILS, XLIBC, and
9978 ; ; XGCC
10079 (package
@@ -118,21 +97,12 @@ chain for " target " development."))
11897(define base-gcc gcc-10)
11998(define base-linux-kernel-headers linux-libre-headers-5.15)
12099
121- ; ; https://gcc.gnu.org/install/configure.html
122- (define (hardened-gcc gcc )
123- (package-with-extra-configure-variable (
124- package-with-extra-configure-variable (
125- package-with-extra-configure-variable gcc
126- " --enable-initfini-array" " yes" )
127- " --enable-default-ssp" " yes" )
128- " --enable-default-pie" " yes" ))
129-
130100(define* (make-bitcoin-cross-toolchain target
131101 #:key
132- (base-gcc-for-libc base-gcc)
102+ (base-gcc-for-libc linux- base-gcc)
133103 (base-kernel-headers base-linux-kernel-headers)
134- (base-libc (hardened- glibc glibc -2.28) )
135- (base-gcc (make-gcc-rpath-link (hardened-gcc base-gcc)) ))
104+ (base-libc glibc-2.28)
105+ (base-gcc linux- base-gcc))
136106 " Convenience wrapper around MAKE-CROSS-TOOLCHAIN with default values
137107desirable for building Dash Core release binaries."
138108 (make-cross-toolchain target
@@ -517,17 +487,6 @@ and endian independent.")
517487inspecting signatures in Mach-O binaries." )
518488 (license license:expat))))
519489
520- ; ; https://www.gnu.org/software/libc/manual/html_node/Configuring-and-compiling.html
521- ; ; We don't use --disable-werror directly, as that would be passed through to bash,
522- ; ; and cause it's build to fail.
523- (define (hardened-glibc glibc )
524- (package-with-extra-configure-variable (
525- package-with-extra-configure-variable (
526- package-with-extra-configure-variable glibc
527- " enable_werror" " no" )
528- " --enable-stack-protector" " strong" )
529- " --enable-bind-now" " yes" ))
530-
531490(define-public mingw-w64-base-gcc
532491 (package
533492 (inherit base-gcc)
@@ -544,6 +503,30 @@ inspecting signatures in Mach-O binaries.")
544503 ; ; and thus will ensure that this works properly.
545504 `(cons " gcc_cv_libc_provides_ssp=yes" ,flags))))))
546505
506+ (define-public linux-base-gcc
507+ (package
508+ (inherit base-gcc)
509+ (arguments
510+ (substitute-keyword-arguments (package-arguments base-gcc)
511+ ((#:configure-flags flags)
512+ `(append ,flags
513+ ; ; https://gcc.gnu.org/install/configure.html
514+ (list " --enable-initfini-array=yes" ,
515+ " --enable-default-ssp=yes" ,
516+ " --enable-default-pie=yes" ,
517+ building-on)))
518+ ((#:phases phases)
519+ `(modify-phases ,phases
520+ ; ; Given a XGCC package, return a modified package that replace each instance of
521+ ; ; -rpath in the default system spec that's inserted by Guix with -rpath-link
522+ (add-after 'pre-configure 'replace-rpath-with-rpath-link
523+ (lambda _
524+ (substitute* (cons " gcc/config/rs6000/sysv4.h"
525+ (find-files " gcc/config"
526+ " ^gnu-user.*\\ .h$" ))
527+ ((" -rpath=" ) " -rpath-link=" ))
528+ #t ))))))))
529+
547530(define-public glibc-2.28
548531 (package
549532 (inherit glibc-2.31)
@@ -559,7 +542,28 @@ inspecting signatures in Mach-O binaries.")
559542 " 0wm0if2n4z48kpn85va6yb4iac34crds2f55ddpz1hykx6jp1pb6" ))
560543 (patches (search-our-patches " glibc-2.27-fcommon.patch"
561544 " glibc-2.27-guix-prefix.patch"
562- " glibc-2.27-no-librt.patch" ))))))
545+ " glibc-2.27-no-librt.patch" ))))
546+ (arguments
547+ (substitute-keyword-arguments (package-arguments glibc)
548+ ((#:configure-flags flags)
549+ `(append ,flags
550+ ; ; https://www.gnu.org/software/libc/manual/html_node/Configuring-and-compiling.html
551+ (list " --enable-stack-protector=all" ,
552+ " --enable-bind-now" ,
553+ " --disable-werror" ,
554+ building-on)))
555+ ((#:phases phases)
556+ `(modify-phases ,phases
557+ (add-before 'configure 'set-etc-rpc-installation-directory
558+ (lambda* (#:key outputs #:allow-other-keys)
559+ ; ; Install the rpc data base file under `$out/etc/rpc'.
560+ ; ; Otherwise build will fail with "Permission denied."
561+ (let ((out (assoc-ref outputs " out" )))
562+ (substitute* " sunrpc/Makefile"
563+ ((" ^\\ $\\ (inst_sysconfdir\\ )/rpc(.*)$" _ suffix)
564+ (string-append out " /etc/rpc" suffix " \n " ))
565+ ((" ^install-others =.*$" )
566+ (string-append " install-others = " out " /etc/rpc\n " ))))))))))))
563567
564568(packages->manifest
565569 (append
0 commit comments