Skip to content

Commit 4415275

Browse files
committed
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 ```
1 parent 8372ab0 commit 4415275

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

contrib/guix/manifest.scm

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ FILE-NAME found in ./patches relative to the current file."
8383
xbinutils))
8484
;; 3. Build a cross-compiled libc with XGCC-SANS-LIBC and XKERNEL,
8585
;; derived from BASE-LIBC
86-
(xlibc (explicit-cross-configure (cross-libc target
87-
base-libc
88-
xgcc-sans-libc
89-
xbinutils
90-
xkernel)))
86+
(xlibc (cross-libc target
87+
base-libc
88+
xgcc-sans-libc
89+
xbinutils
90+
xkernel))
9191
;; 4. Build a cross-compiling gcc targeting XLIBC, derived from
9292
;; BASE-GCC
9393
(xgcc (explicit-cross-configure (cross-gcc target
@@ -130,7 +130,7 @@ chain for " target " development."))
130130
#:key
131131
(base-gcc-for-libc base-gcc)
132132
(base-kernel-headers base-linux-kernel-headers)
133-
(base-libc (hardened-glibc glibc-2.27))
133+
(base-libc glibc-2.27)
134134
(base-gcc (make-gcc-rpath-link (hardened-gcc base-gcc))))
135135
"Convenience wrapper around MAKE-CROSS-TOOLCHAIN with default values
136136
desirable for building Bitcoin Core release binaries."
@@ -513,17 +513,6 @@ and endian independent.")
513513
inspecting signatures in Mach-O binaries.")
514514
(license license:expat))))
515515

516-
;; https://www.gnu.org/software/libc/manual/html_node/Configuring-and-compiling.html
517-
;; We don't use --disable-werror directly, as that would be passed through to bash,
518-
;; and cause it's build to fail.
519-
(define (hardened-glibc glibc)
520-
(package-with-extra-configure-variable (
521-
package-with-extra-configure-variable (
522-
package-with-extra-configure-variable glibc
523-
"enable_werror" "no")
524-
"--enable-stack-protector" "all")
525-
"--enable-bind-now" "yes"))
526-
527516
(define-public mingw-w64-base-gcc
528517
(package
529518
(inherit base-gcc)
@@ -556,7 +545,28 @@ inspecting signatures in Mach-O binaries.")
556545
(patches (search-our-patches "glibc-2.27-riscv64-Use-__has_include-to-include-asm-syscalls.h.patch"
557546
"glibc-2.27-fcommon.patch"
558547
"glibc-2.27-guix-prefix.patch"
559-
"glibc-2.27-no-librt.patch"))))))
548+
"glibc-2.27-no-librt.patch"))))
549+
(arguments
550+
(substitute-keyword-arguments (package-arguments glibc)
551+
((#:configure-flags flags)
552+
`(append ,flags
553+
;; https://www.gnu.org/software/libc/manual/html_node/Configuring-and-compiling.html
554+
(list "--enable-stack-protector=all",
555+
"--enable-bind-now",
556+
"--disable-werror",
557+
building-on)))
558+
((#:phases phases)
559+
`(modify-phases ,phases
560+
(add-before 'configure 'set-etc-rpc-installation-directory
561+
(lambda* (#:key outputs #:allow-other-keys)
562+
;; Install the rpc data base file under `$out/etc/rpc'.
563+
;; Otherwise build will fail with "Permission denied."
564+
(let ((out (assoc-ref outputs "out")))
565+
(substitute* "sunrpc/Makefile"
566+
(("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
567+
(string-append out "/etc/rpc" suffix "\n"))
568+
(("^install-others =.*$")
569+
(string-append "install-others = " out "/etc/rpc\n"))))))))))))
560570

561571
(packages->manifest
562572
(append

0 commit comments

Comments
 (0)