guix: consolidate glibc 2.27 package

Refactor our glibc 2.27 to be a single 'package', and avoid the use of
`package-with-extra-configure-variable`. This also lets us drop the
`enable_werror` workaround, and just use --disable-werror directly.

Employ the same workaround as the Guix glibc, to avoid a "permission
denied" failure during build:
```bash
make  subdir=sunrpc -C sunrpc ..=../ subdir_install
make[2]: Entering directory '/tmp/guix-build-glibc-cross-x86_64-linux-gnu-2.27.drv-0/source/sunrpc'
.././scripts/mkinstalldirs /gnu/store/ga8jciqrd5lh52m572x3mk4q1smf5agq-glibc-cross-x86_64-linux-gnu-2.27/include/rpc
mkdir -p -- /gnu/store/ga8jciqrd5lh52m572x3mk4q1smf5agq-glibc-cross-x86_64-linux-gnu-2.27/include/rpc
/gnu/store/kvpvk5wh70wdbjnr83hh85rg22ysxm9h-coreutils-8.32/bin/install -c -m 644 rpc/netdb.h /gnu/store/ga8jciqrd5lh52m572x3mk4q1smf5agq-glibc-cross-x86_64-linux-gnu-2.27/include/rpc/netdb.h
.././scripts/mkinstalldirs /gnu/store/ga8jciqrd5lh52m572x3mk4q1smf5agq-glibc-cross-x86_64-linux-gnu-2.27/include/nfs
mkdir -p -- /gnu/store/ga8jciqrd5lh52m572x3mk4q1smf5agq-glibc-cross-x86_64-linux-gnu-2.27/include/nfs
/gnu/store/kvpvk5wh70wdbjnr83hh85rg22ysxm9h-coreutils-8.32/bin/install -c -m 644 ../sysdeps/unix/sysv/linux/nfs/nfs.h /gnu/store/ga8jciqrd5lh52m572x3mk4q1smf5agq-glibc-cross-x86_64-linux-gnu-2.27/include/nfs/nfs.h
/gnu/store/kvpvk5wh70wdbjnr83hh85rg22ysxm9h-coreutils-8.32/bin/install -c -m 644 /tmp/guix-build-glibc-cross-x86_64-linux-gnu-2.27.drv-0/build/gnu/lib-names-64.h /gnu/store/ga8jciqrd5lh52m572x3mk4q1smf5agq-glibc-cross-x86_64-linux-gnu-2.27/include/gnu/lib-names-64.h
/gnu/store/kvpvk5wh70wdbjnr83hh85rg22ysxm9h-coreutils-8.32/bin/install -c -m 644 etc.rpc /etc/rpc
/gnu/store/kvpvk5wh70wdbjnr83hh85rg22ysxm9h-coreutils-8.32/bin/install: cannot create regular file '/etc/rpc': Permission denied
make[2]: *** [Makefile:197: /etc/rpc] Error 1
```
pull/28324/head
fanquake 1 year ago
parent 8372ab0ea3
commit 4415275f96
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

@ -83,11 +83,11 @@ FILE-NAME found in ./patches relative to the current file."
xbinutils)) xbinutils))
;; 3. Build a cross-compiled libc with XGCC-SANS-LIBC and XKERNEL, ;; 3. Build a cross-compiled libc with XGCC-SANS-LIBC and XKERNEL,
;; derived from BASE-LIBC ;; derived from BASE-LIBC
(xlibc (explicit-cross-configure (cross-libc target (xlibc (cross-libc target
base-libc base-libc
xgcc-sans-libc xgcc-sans-libc
xbinutils xbinutils
xkernel))) xkernel))
;; 4. Build a cross-compiling gcc targeting XLIBC, derived from ;; 4. Build a cross-compiling gcc targeting XLIBC, derived from
;; BASE-GCC ;; BASE-GCC
(xgcc (explicit-cross-configure (cross-gcc target (xgcc (explicit-cross-configure (cross-gcc target
@ -130,7 +130,7 @@ chain for " target " development."))
#:key #:key
(base-gcc-for-libc base-gcc) (base-gcc-for-libc base-gcc)
(base-kernel-headers base-linux-kernel-headers) (base-kernel-headers base-linux-kernel-headers)
(base-libc (hardened-glibc glibc-2.27)) (base-libc glibc-2.27)
(base-gcc (make-gcc-rpath-link (hardened-gcc base-gcc)))) (base-gcc (make-gcc-rpath-link (hardened-gcc base-gcc))))
"Convenience wrapper around MAKE-CROSS-TOOLCHAIN with default values "Convenience wrapper around MAKE-CROSS-TOOLCHAIN with default values
desirable for building Bitcoin Core release binaries." desirable for building Bitcoin Core release binaries."
@ -513,17 +513,6 @@ and endian independent.")
inspecting signatures in Mach-O binaries.") inspecting signatures in Mach-O binaries.")
(license license:expat)))) (license license:expat))))
;; https://www.gnu.org/software/libc/manual/html_node/Configuring-and-compiling.html
;; We don't use --disable-werror directly, as that would be passed through to bash,
;; and cause it's build to fail.
(define (hardened-glibc glibc)
(package-with-extra-configure-variable (
package-with-extra-configure-variable (
package-with-extra-configure-variable glibc
"enable_werror" "no")
"--enable-stack-protector" "all")
"--enable-bind-now" "yes"))
(define-public mingw-w64-base-gcc (define-public mingw-w64-base-gcc
(package (package
(inherit base-gcc) (inherit base-gcc)
@ -556,7 +545,28 @@ inspecting signatures in Mach-O binaries.")
(patches (search-our-patches "glibc-2.27-riscv64-Use-__has_include-to-include-asm-syscalls.h.patch" (patches (search-our-patches "glibc-2.27-riscv64-Use-__has_include-to-include-asm-syscalls.h.patch"
"glibc-2.27-fcommon.patch" "glibc-2.27-fcommon.patch"
"glibc-2.27-guix-prefix.patch" "glibc-2.27-guix-prefix.patch"
"glibc-2.27-no-librt.patch")))))) "glibc-2.27-no-librt.patch"))))
(arguments
(substitute-keyword-arguments (package-arguments glibc)
((#:configure-flags flags)
`(append ,flags
;; https://www.gnu.org/software/libc/manual/html_node/Configuring-and-compiling.html
(list "--enable-stack-protector=all",
"--enable-bind-now",
"--disable-werror",
building-on)))
((#:phases phases)
`(modify-phases ,phases
(add-before 'configure 'set-etc-rpc-installation-directory
(lambda* (#:key outputs #:allow-other-keys)
;; Install the rpc data base file under `$out/etc/rpc'.
;; Otherwise build will fail with "Permission denied."
(let ((out (assoc-ref outputs "out")))
(substitute* "sunrpc/Makefile"
(("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
(string-append out "/etc/rpc" suffix "\n"))
(("^install-others =.*$")
(string-append "install-others = " out "/etc/rpc\n"))))))))))))
(packages->manifest (packages->manifest
(append (append

Loading…
Cancel
Save