@@ -40,29 +40,8 @@ FILE-NAME found in ./patches relative to the current file."
40
40
((%patch-path (list (string-append (dirname (current-filename)) " /patches" ))))
41
41
(list (search-patch file-name) ...)))
42
42
43
- (define (make-gcc-rpath-link xgcc )
44
- "Given a XGCC package, return a modified package that replace each instance of
45
- -rpath in the default system spec that's inserted by Guix with -rpath-link"
46
- (package
47
- (inherit xgcc)
48
- (arguments
49
- (substitute-keyword-arguments (package-arguments xgcc)
50
- ((#:phases phases)
51
- `(modify-phases ,phases
52
- (add-after 'pre-configure 'replace-rpath-with-rpath-link
53
- (lambda _
54
- (substitute* (cons " gcc/config/rs6000/sysv4.h"
55
- (find-files " gcc/config"
56
- " ^gnu-user.*\\ .h$" ))
57
- ((" -rpath=" ) " -rpath-link=" ))
58
- #t ))))))))
59
-
60
43
(define building-on (string-append " --build=" (list-ref (string-split (%current-system) #\- ) 0 ) " -guix-linux-gnu" ))
61
44
62
- (define (explicit-cross-configure package )
63
- (define building-on (string-append (list-ref (string-split (%current-system) #\- ) 0 ) " -guix-linux-gnu" ))
64
- (package-with-extra-configure-variable package " --build" building-on))
65
-
66
45
(define (make-cross-toolchain target
67
46
base-gcc-for-libc
68
47
base-kernel-headers
@@ -72,9 +51,9 @@ FILE-NAME found in ./patches relative to the current file."
72
51
(let* ((xbinutils (cross-binutils target))
73
52
; ; 1. Build a cross-compiling gcc without targeting any libc, derived
74
53
; ; from BASE-GCC-FOR-LIBC
75
- (xgcc-sans-libc (explicit-cross-configure ( cross-gcc target
76
- #:xgcc base-gcc-for-libc
77
- #:xbinutils xbinutils) ))
54
+ (xgcc-sans-libc (cross-gcc target
55
+ #:xgcc base-gcc-for-libc
56
+ #:xbinutils xbinutils))
78
57
; ; 2. Build cross-compiled kernel headers with XGCC-SANS-LIBC, derived
79
58
; ; from BASE-KERNEL-HEADERS
80
59
(xkernel (cross-kernel-headers target
@@ -90,10 +69,10 @@ FILE-NAME found in ./patches relative to the current file."
90
69
xkernel))
91
70
; ; 4. Build a cross-compiling gcc targeting XLIBC, derived from
92
71
; ; BASE-GCC
93
- (xgcc (explicit-cross-configure ( cross-gcc target
94
- #:xgcc base-gcc
95
- #:xbinutils xbinutils
96
- #:libc xlibc) )))
72
+ (xgcc (cross-gcc target
73
+ #:xgcc base-gcc
74
+ #:xbinutils xbinutils
75
+ #:libc xlibc)))
97
76
; ; Define a meta-package that propagates the resulting XBINUTILS, XLIBC, and
98
77
; ; XGCC
99
78
(package
@@ -117,21 +96,12 @@ chain for " target " development."))
117
96
(define base-gcc gcc-10)
118
97
(define base-linux-kernel-headers linux-libre-headers-5.15)
119
98
120
- ; ; https://gcc.gnu.org/install/configure.html
121
- (define (hardened-gcc gcc )
122
- (package-with-extra-configure-variable (
123
- package-with-extra-configure-variable (
124
- package-with-extra-configure-variable gcc
125
- " --enable-initfini-array" " yes" )
126
- " --enable-default-ssp" " yes" )
127
- " --enable-default-pie" " yes" ))
128
-
129
99
(define* (make-bitcoin-cross-toolchain target
130
100
#:key
131
- (base-gcc-for-libc base-gcc)
101
+ (base-gcc-for-libc linux- base-gcc)
132
102
(base-kernel-headers base-linux-kernel-headers)
133
103
(base-libc glibc-2.27)
134
- (base-gcc (make-gcc-rpath-link (hardened-gcc base-gcc)) ))
104
+ (base-gcc linux- base-gcc))
135
105
" Convenience wrapper around MAKE-CROSS-TOOLCHAIN with default values
136
106
desirable for building Bitcoin Core release binaries."
137
107
(make-cross-toolchain target
@@ -529,6 +499,30 @@ inspecting signatures in Mach-O binaries.")
529
499
; ; and thus will ensure that this works properly.
530
500
`(cons " gcc_cv_libc_provides_ssp=yes" ,flags))))))
531
501
502
+ (define-public linux-base-gcc
503
+ (package
504
+ (inherit base-gcc)
505
+ (arguments
506
+ (substitute-keyword-arguments (package-arguments base-gcc)
507
+ ((#:configure-flags flags)
508
+ `(append ,flags
509
+ ; ; https://gcc.gnu.org/install/configure.html
510
+ (list " --enable-initfini-array=yes" ,
511
+ " --enable-default-ssp=yes" ,
512
+ " --enable-default-pie=yes" ,
513
+ building-on)))
514
+ ((#:phases phases)
515
+ `(modify-phases ,phases
516
+ ; ; Given a XGCC package, return a modified package that replace each instance of
517
+ ; ; -rpath in the default system spec that's inserted by Guix with -rpath-link
518
+ (add-after 'pre-configure 'replace-rpath-with-rpath-link
519
+ (lambda _
520
+ (substitute* (cons " gcc/config/rs6000/sysv4.h"
521
+ (find-files " gcc/config"
522
+ " ^gnu-user.*\\ .h$" ))
523
+ ((" -rpath=" ) " -rpath-link=" ))
524
+ #t ))))))))
525
+
532
526
(define-public glibc-2.27
533
527
(package
534
528
(inherit glibc-2.31)
0 commit comments