From 2a3fccf70f1a9f83b024106bbeffb85db688e6a9 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 20 Sep 2020 23:03:44 +0200 Subject: gnu: binutils: Update to 2.35.1. * gnu/packages/base.scm (binutils): Update to 2.35.1. [arguments]: Remove #:make-flags. [properties]: Remove. (binutils+documentation): Remove. (binutils-gold): Inherit from BINUTILS. * gnu/packages/make-bootstrap.scm (%binutils-static)[arguments]: Remove #:make-flags. --- gnu/packages/make-bootstrap.scm | 4 ---- 1 file changed, 4 deletions(-) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index b2d3e2a3267..04fdbce429e 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -375,10 +375,6 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (package-arguments binutils)) ((#:configure-flags flags _ ...) flags))) - #:make-flags ,(match (memq #:make-flags (package-arguments binutils)) - ((#:make-flags flags _ ...) - flags) - (_ ''())) #:strip-flags '("--strip-all") #:phases (modify-phases %standard-phases (add-before 'configure 'all-static -- cgit v1.3 From 986e9025a5232155e2b1deb2db15229c302d921a Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Wed, 19 May 2021 00:47:10 +0200 Subject: gnu: guile-static: Remove obsolete workaround. * gnu/packages/make-bootstrap.scm (make-guile-static)[arguments]: Don't disable JIT on ARMv7. --- gnu/packages/make-bootstrap.scm | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index f176e567110..73e78879ea8 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -702,12 +702,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." ;; When `configure' checks for ltdl availability, it ;; doesn't try to link using libtool, and thus fails ;; because of a missing -ldl. Work around that. - - ;; XXX: On ARMv7, disable JIT: it causes crashes with 3.0.2, - ;; possibly related to . - (if (target-arm32?) - ''("LDFLAGS=-ldl" "--disable-jit") - ''("LDFLAGS=-ldl"))) + ''("LDFLAGS=-ldl")) ((#:phases phases '%standard-phases) `(modify-phases ,phases -- cgit v1.3 From 69b048bf6202771ce1e0eb54f88f6b1c3433d616 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Wed, 19 May 2021 00:48:01 +0200 Subject: gnu: guile-static: Fix build without GMP. * gnu/packages/make-bootstrap.scm (make-guile-static)[arguments]: Add "--enable-mini-gmp" to #:configure-flags. --- gnu/packages/make-bootstrap.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 73e78879ea8..2cf7881bcf3 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -702,7 +702,8 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." ;; When `configure' checks for ltdl availability, it ;; doesn't try to link using libtool, and thus fails ;; because of a missing -ldl. Work around that. - ''("LDFLAGS=-ldl")) + ''("LDFLAGS=-ldl" + "--enable-mini-gmp")) ((#:phases phases '%standard-phases) `(modify-phases ,phases -- cgit v1.3 From 8740a62b6be3016a9dd0c61912152c69bdd4eb41 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 5 Jul 2021 22:18:23 +0200 Subject: gnu: bootstrap-tarballs: Fix build. * gnu/packages/make-bootstrap.scm (%bootstrap-tarballs)[arguments]: Make 'use-modules' the first expression. Failing that, 'match' would not be properly expanded when running on Guile 3.0. --- gnu/packages/make-bootstrap.scm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 2cf7881bcf3..196faad530e 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2017 Efraim Flashner ;;; Copyright © 2018 Tobias Geerinckx-Rice ;;; Copyright © 2018, 2019 Mark H Weaver @@ -880,11 +880,13 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (arguments `(#:modules ((guix build utils)) #:builder - (let ((out (assoc-ref %outputs "out"))) + (begin (use-modules (guix build utils) (ice-9 match) (srfi srfi-26)) + (define out (assoc-ref %outputs "out")) + (setvbuf (current-output-port) (cond-expand (guile-2.0 _IOLBF) (else 'line))) (mkdir out) -- cgit v1.3 From dbacdb8c03596c09e00a9f8627dae23aea7f30e4 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 5 Jul 2021 23:57:20 +0200 Subject: gnu: bootstrap-tarballs: Turn builder into a gexp. * gnu/packages/make-bootstrap.scm (%bootstrap-tarballs)[arguments]: Turn #:builder into a gexp. --- gnu/packages/make-bootstrap.scm | 42 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 196faad530e..265884020e7 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -23,6 +23,7 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu packages make-bootstrap) + #:use-module (guix gexp) #:use-module (guix utils) #:use-module (guix packages) #:use-module (guix memoization) @@ -878,27 +879,26 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (source #f) (build-system trivial-build-system) (arguments - `(#:modules ((guix build utils)) - #:builder - (begin - (use-modules (guix build utils) - (ice-9 match) - (srfi srfi-26)) - - (define out (assoc-ref %outputs "out")) - - (setvbuf (current-output-port) - (cond-expand (guile-2.0 _IOLBF) (else 'line))) - (mkdir out) - (chdir out) - (for-each (match-lambda - ((name . directory) - (for-each (lambda (file) - (format #t "~a -> ~a~%" file out) - (symlink file (basename file))) - (find-files directory "\\.tar\\.")))) - %build-inputs) - #t))) + (list #:modules '((guix build utils)) + #:builder + #~(begin + (use-modules (guix build utils) + (ice-9 match) + (srfi srfi-26)) + + (define out #$output) + + (setvbuf (current-output-port) + (cond-expand (guile-2.0 _IOLBF) (else 'line))) + (mkdir out) + (chdir out) + (for-each (match-lambda + ((name . directory) + (for-each (lambda (file) + (format #t "~a -> ~a~%" file out) + (symlink file (basename file))) + (find-files directory "\\.tar\\.")))) + %build-inputs)))) (inputs `(("guile-tarball" ,%guile-bootstrap-tarball) ,@(match (or (%current-target-system) (%current-system)) ((or "i686-linux" "x86_64-linux") -- cgit v1.3 From 637a1e7dcce4d1a2c4f2f9c478df4a640ae1f230 Mon Sep 17 00:00:00 2001 From: Maxime Devos Date: Wed, 14 Jul 2021 13:12:47 +0200 Subject: utils: Define 'target-hurd?' predicate. It behaves similarily to the other target-...? procedures. The usage of hurd-triplet? / target-hurd? in libgc appears incorrect to me, as (%current-system) is normally never false. * gnu/packages/hurd.scm (hurd-triplet?): Move to ... * guix/util.scm (target-hurd?): ... here, let its argument default to (%current-target-system) or (%current-system), and write a docstring. * gnu/packages/hurd.scm (hurd-target?, hurd-system?): Use target-hurd? instead of hurd-triplet?. * gnu/packages/bdw-gc.scm (libgc): Likewise. * gnu/packages/cross-base.scm (cross-libc)[arguments]<#:configure-flags>: Likewise. (cross-libc)[arguments]<#:phases>: Likewise. (cross-libc)[arguments]<#:native-inputs>: Likewise. * gnu/packages/make-boostrap.scm (%glibc-stripped)[inputs]: Likewise. Signed-off-by: Mathieu Othacehe --- gnu/packages/bdw-gc.scm | 4 ++-- gnu/packages/cross-base.scm | 6 +++--- gnu/packages/hurd.scm | 10 +++------- gnu/packages/make-bootstrap.scm | 2 +- guix/utils.scm | 7 +++++++ 5 files changed, 16 insertions(+), 13 deletions(-) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/bdw-gc.scm b/gnu/packages/bdw-gc.scm index 0d82889bac4..5ced11bb64a 100644 --- a/gnu/packages/bdw-gc.scm +++ b/gnu/packages/bdw-gc.scm @@ -56,8 +56,8 @@ ;; to configure script. See bug report and discussion: ;; ;; - ,@(if (hurd-triplet? (or (%current-system) - (%current-target-system))) + ,@(if (target-hurd? (or (%current-system) + (%current-target-system))) '("--disable-gcj-support") '())))) (native-inputs `(("pkg-config" ,pkg-config))) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index ced226ef34e..78cbf871ac2 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -505,7 +505,7 @@ and the cross tool chain." ,@(package-arguments libc)) ((#:configure-flags flags) `(cons ,(string-append "--host=" target) - ,(if (hurd-triplet? target) + ,(if (target-hurd? target) `(cons "--disable-werror" ,flags) flags))) ((#:phases phases) @@ -519,7 +519,7 @@ and the cross tool chain." (setenv "CROSS_LIBRARY_PATH" (string-append kernel "/lib")) ; for Hurd's libihash #t))) - ,@(if (hurd-triplet? target) + ,@(if (target-hurd? target) '((add-after 'install 'augment-libc.so (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out"))) @@ -536,7 +536,7 @@ and the cross tool chain." (native-inputs `(("cross-gcc" ,xgcc) ("cross-binutils" ,xbinutils) - ,@(if (hurd-triplet? target) + ,@(if (target-hurd? target) `(("cross-mig" ,@(assoc-ref (package-native-inputs xheaders) "cross-mig"))) diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm index 59a7b559435..222ddbce656 100644 --- a/gnu/packages/hurd.scm +++ b/gnu/packages/hurd.scm @@ -51,20 +51,16 @@ hurd-target? hurd-triplet?)) -(define (hurd-triplet? triplet) - (and (string-suffix? "-gnu" triplet) - (not (string-contains triplet "linux")))) - (define (hurd-target?) "Return true if the cross-compilation target or the current system is GNU/Hurd." - (or (and=> (%current-target-system) hurd-triplet?) + (or (and=> (%current-target-system) target-hurd?) (and (not (%current-target-system)) - (and=> (%current-system) hurd-triplet?)))) + (and=> (%current-system) target-hurd?)))) (define (hurd-system?) "Return true if the current system is the Hurd." - (and=> (%current-system) hurd-triplet?)) + (and=> (%current-system) target-hurd?)) (define (hurd-source-url version) (string-append "mirror://gnu/hurd/hurd-" diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 265884020e7..5c306c145d8 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -439,7 +439,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (assoc-ref %build-inputs "kernel-headers"))))) (inputs `(("kernel-headers" ,(if (or (and (%current-target-system) - (hurd-triplet? (%current-target-system))) + (target-hurd? (%current-target-system))) (string-suffix? "-hurd" (%current-system))) gnumach-headers linux-libre-headers)) diff --git a/guix/utils.scm b/guix/utils.scm index 1ac17b36578..8ae912c48b6 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -85,6 +85,7 @@ %current-target-system package-name->name+version target-linux? + target-hurd? target-mingw? target-arm32? target-aarch64? @@ -639,6 +640,12 @@ a character other than '@'." "Does the operating system of TARGET use the Linux kernel?" (->bool (string-contains target "linux"))) +(define* (target-hurd? #:optional (target (or (%current-target-system) + (%current-system)))) + "Does TARGET represent the GNU(/Hurd) system?" + (and (string-suffix? "-gnu" target) + (not (string-contains target "linux")))) + (define* (target-mingw? #:optional (target (%current-target-system))) (and target (string-suffix? "-mingw32" target))) -- cgit v1.3 From 8b627a77014bc64bae2481fceeb28bcd61035b5b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 25 Jul 2021 20:15:45 +0200 Subject: gnu: mes-minimal: Remove unused variable. * gnu/packages/make-bootstrap.scm (%mes-minimal): Remove unused 'triplet' variable. --- gnu/packages/make-bootstrap.scm | 49 ++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 60b6f1b42e3..32542f6da78 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -623,31 +623,30 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." ;; Two packages: first build static, bare minimum content. (define-public %mes-minimal ;; A minimal Mes without documentation. - (let ((triplet "i686-unknown-linux-gnu")) - (package - (inherit mes-0.19) - (name "mes-minimal") - (native-inputs - `(("guile" ,guile-2.2))) - (arguments - `(#:system "i686-linux" - #:strip-binaries? #f - #:configure-flags '("--mes") - #:phases - (modify-phases %standard-phases - (delete 'patch-shebangs) - (add-after 'install 'strip-install - (lambda _ - (let* ((out (assoc-ref %outputs "out")) - (share (string-append out "/share"))) - (delete-file-recursively (string-append out "/lib/guile")) - (delete-file-recursively (string-append share "/guile")) - (delete-file-recursively (string-append share "/mes/scaffold")) - - (for-each delete-file - (find-files - (string-append share "/mes/lib") - "\\.(h|c)"))))))))))) + (package + (inherit mes-0.19) + (name "mes-minimal") + (native-inputs + `(("guile" ,guile-2.2))) + (arguments + `(#:system "i686-linux" + #:strip-binaries? #f + #:configure-flags '("--mes") + #:phases + (modify-phases %standard-phases + (delete 'patch-shebangs) + (add-after 'install 'strip-install + (lambda _ + (let* ((out (assoc-ref %outputs "out")) + (share (string-append out "/share"))) + (delete-file-recursively (string-append out "/lib/guile")) + (delete-file-recursively (string-append share "/guile")) + (delete-file-recursively (string-append share "/mes/scaffold")) + + (for-each delete-file + (find-files + (string-append share "/mes/lib") + "\\.(h|c)")))))))))) ;; next remove store references. (define %mes-minimal-stripped -- cgit v1.3 From 114a9f1f803b53bd295c44b3719c1ed5dd288e40 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 25 Jul 2021 22:24:21 +0200 Subject: gnu: mescc-tools: Update to 1.2.0. Fixes . * gnu/packages/mes.scm (mescc-tools-0.5.2): Remove. (mescc-tools): Update to 1.2.0. Use 'git-fetch'. * gnu/packages/make-bootstrap.scm (%mescc-tools-static): Inherit from MESCC-TOOLS rather than MESCC-TOOLS-0.5.2. (%mes-minimal): Inherit from MES rather than MES-0.19. [arguments]: Remove 'delete-file-recursively' for /mes/scaffold. --- gnu/packages/make-bootstrap.scm | 7 ++-- gnu/packages/mes.scm | 89 ++++++++++++++--------------------------- 2 files changed, 32 insertions(+), 64 deletions(-) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 32542f6da78..9f4f5bb4af5 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -585,11 +585,11 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (define %mescc-tools-static ;; A statically linked MesCC Tools. (package - (inherit mescc-tools-0.5.2) + (inherit mescc-tools) (name "mescc-tools-static") (arguments `(#:system "i686-linux" - ,@(substitute-keyword-arguments (package-arguments mescc-tools-0.5.2) + ,@(substitute-keyword-arguments (package-arguments mescc-tools) ((#:make-flags flags) `(cons "CC=gcc -static" ,flags))))))) @@ -624,7 +624,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (define-public %mes-minimal ;; A minimal Mes without documentation. (package - (inherit mes-0.19) + (inherit mes) (name "mes-minimal") (native-inputs `(("guile" ,guile-2.2))) @@ -641,7 +641,6 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (share (string-append out "/share"))) (delete-file-recursively (string-append out "/lib/guile")) (delete-file-recursively (string-append share "/guile")) - (delete-file-recursively (string-append share "/mes/scaffold")) (for-each delete-file (find-files diff --git a/gnu/packages/mes.scm b/gnu/packages/mes.scm index ebaf4f547df..71083b50615 100644 --- a/gnu/packages/mes.scm +++ b/gnu/packages/mes.scm @@ -164,7 +164,7 @@ parsers to allow execution with Guile as extension languages."))) "15h4yhaywdc0djpjlin2jz1kzahpqxfki0r0aav1qm9nxxmnp1l0")))) (build-system gnu-build-system) (supported-systems '("i686-linux" "x86_64-linux")) - (propagated-inputs (list mescc-tools-0.5.2 nyacc-0.86)) + (propagated-inputs (list mescc-tools nyacc-0.86)) (native-inputs `(("guile" ,guile-2.2) ,@(let ((target-system (or (%current-target-system) @@ -295,69 +295,38 @@ Guile.") (lambda _ (invoke "sh" "install.sh")))))))) -(define-public mescc-tools-0.5.2 - ;; Mescc-tools used for bootstrap. - (let ((commit "bb062b0da7bf2724ca40f9002b121579898d4ef7") - (revision "0") - (version "0.5.2")) - (package - (name "mescc-tools") - (version (git-version version revision commit)) - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://git.savannah.nongnu.org/r/mescc-tools.git") - (commit commit))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1nc6rnax66vmhqsjg0kgx23pihdcxmww6v325ywf59vsq1jqjvff")))) - (build-system gnu-build-system) - (supported-systems '("i686-linux" "x86_64-linux")) - (arguments - `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))) - #:test-target "test" - #:phases (modify-phases %standard-phases - (delete 'configure)))) - (synopsis "Tools for the full source bootstrapping process") - (description - "Mescc-tools is a collection of tools for use in a full source -bootstrapping process. It consists of the M1 macro assembler, the hex2 -linker, the blood-elf symbol table generator, the kaem shell, exec_enable and -get_machine.") - (home-page "https://savannah.nongnu.org/projects/mescc-tools") - (license gpl3+)))) - (define-public mescc-tools (package - (inherit mescc-tools-0.5.2) (name "mescc-tools") - (version "0.7.0") - (source - (origin - (method url-fetch) - (uri (string-append - "http://git.savannah.nongnu.org/cgit/mescc-tools.git/snapshot/" - name "-Release_" version - ".tar.gz")) - (file-name (string-append name "-" version ".tar.gz")) - (sha256 - (base32 - "1p1ijia4rm3002f5sypidl9v5gq0mlch9b0n61rpxkdsaaxjqax3")))) - (supported-systems '("armhf-linux" "aarch64-linux" - "i686-linux" "x86_64-linux")) + (version "1.2.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://git.savannah.nongnu.org/r/mescc-tools.git") + (commit (string-append "Release_" version)) + (recursive? #t))) ;for M2libc + (file-name (git-file-name name version)) + (sha256 + (base32 + "1xkn5sspfxldy4wm8fq8gd8kwn46578zhfl12c16pq74x21zb198")))) + (build-system gnu-build-system) + (supported-systems '("i686-linux" "x86_64-linux" + "armhf-linux" "aarch64-linux" + "powerpc64le-linux")) (arguments - (substitute-keyword-arguments (package-arguments mescc-tools-0.5.2) - ((#:make-flags _) - `(list (string-append "PREFIX=" (assoc-ref %outputs "out")) - "CC=gcc")) - ((#:phases phases) - `(modify-phases ,phases - (add-after 'unpack 'patch-prefix - (lambda _ - (substitute* "sha256.sh" - (("/usr/bin/sha256sum") (which "sha256sum"))) - #t)))))))) + `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))) + #:test-target "test" + #:phases (modify-phases %standard-phases + (delete 'configure)))) + (native-inputs (list which)) + (synopsis "Tools for the full source bootstrapping process") + (description + "Mescc-tools is a collection of tools for use in a full source +bootstrapping process. It consists of the M1 macro assembler, the hex2 +linker, the blood-elf symbol table generator, the kaem shell, exec_enable and +get_machine.") + (home-page "https://savannah.nongnu.org/projects/mescc-tools") + (license gpl3+))) (define-public m2-planet (package -- cgit v1.3 From 81096caf7d122485f09226cdd8b2a117a39be4d9 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 25 Jul 2021 23:12:16 +0200 Subject: gnu: mes: Switch to Guile 3.0. * gnu/packages/mes.scm (nyacc-1.00.2)[inputs]: Change GUILE-2.2 to GUILE-3.0. (mes-0.19)[native-inputs]: Likewise. * gnu/packages/make-bootstrap.scm (%mes-minimal)[native-inputs]: Likewise. --- gnu/packages/make-bootstrap.scm | 2 +- gnu/packages/mes.scm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 9f4f5bb4af5..42e0916c9af 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -627,7 +627,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (inherit mes) (name "mes-minimal") (native-inputs - `(("guile" ,guile-2.2))) + `(("guile" ,guile-3.0))) (arguments `(#:system "i686-linux" #:strip-binaries? #f diff --git a/gnu/packages/mes.scm b/gnu/packages/mes.scm index 71083b50615..d9d41c8138a 100644 --- a/gnu/packages/mes.scm +++ b/gnu/packages/mes.scm @@ -148,7 +148,7 @@ parsers to allow execution with Guile as extension languages."))) (sha256 (base32 "065ksalfllbdrzl12dz9d9dcxrv97wqxblslngsc6kajvnvlyvpk")))) - (inputs (list guile-2.2)))) + (inputs (list guile-3.0)))) (define-public mes-0.19 ;; Mes used for bootstrap. @@ -166,7 +166,7 @@ parsers to allow execution with Guile as extension languages."))) (supported-systems '("i686-linux" "x86_64-linux")) (propagated-inputs (list mescc-tools nyacc-0.86)) (native-inputs - `(("guile" ,guile-2.2) + `(("guile" ,guile-3.0) ,@(let ((target-system (or (%current-target-system) (%current-system)))) (cond -- cgit v1.3 From da32015db011915402cb307d6e4b837482c41f1a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 26 Jul 2021 10:04:49 +0200 Subject: gnu: mes-minimal-stripped: Explicitly disallow references. * gnu/packages/make-bootstrap.scm (%mes-minimal-stripped)[arguments]: Add #:allowed-references. --- gnu/packages/make-bootstrap.scm | 1 + 1 file changed, 1 insertion(+) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 42e0916c9af..12e59e9f838 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -656,6 +656,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (build-system trivial-build-system) (arguments `(#:modules ((guix build utils)) + #:allowed-references () #:builder (begin (use-modules (guix build utils)) -- cgit v1.3 From 08005133eca561c9d090b6f535fa70b3cfef558a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 6 Sep 2021 13:46:47 +0200 Subject: gnu: glibc-static: Fix static NSS support. Support for static NSS broke in glibc 2.33, meaning that 'getpw' & co. would always fail. This patch backports the upstream fix to reinstate it. Reported by Marius Bakke. * gnu/packages/patches/glibc-static-nss.patch: New file. * gnu/packages/make-bootstrap.scm (glibc-for-bootstrap): Use it. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + gnu/packages/make-bootstrap.scm | 8 +- gnu/packages/patches/glibc-static-nss.patch | 1244 +++++++++++++++++++++++++++ 3 files changed, 1250 insertions(+), 3 deletions(-) create mode 100644 gnu/packages/patches/glibc-static-nss.patch (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/local.mk b/gnu/local.mk index 8c41b5b676f..eab40771b5a 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1146,6 +1146,7 @@ dist_patch_DATA = \ %D%/packages/patches/glibc-versioned-locpath.patch \ %D%/packages/patches/glibc-2.29-git-updates.patch \ %D%/packages/patches/glibc-2.29-supported-locales.patch \ + %D%/packages/patches/glibc-static-nss.patch \ %D%/packages/patches/glibc-supported-locales.patch \ %D%/packages/patches/gmp-arm-asm-nothumb.patch \ %D%/packages/patches/gmp-faulty-test.patch \ diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 12e59e9f838..2d7a97488d8 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -30,7 +30,7 @@ #:use-module ((guix licenses) #:select (gpl3+)) #:use-module (guix build-system trivial) #:use-module (guix build-system gnu) - #:use-module ((gnu packages) #:select (search-patch)) + #:use-module ((gnu packages) #:select (search-patch search-patches)) #:use-module (gnu packages base) #:use-module (gnu packages cross-base) #:use-module (gnu packages bash) @@ -73,8 +73,10 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (package (inherit base) (source (origin (inherit (package-source base)) - (patches (cons (search-patch "glibc-bootstrap-system.patch") - (origin-patches (package-source base)))))) + (patches (append (search-patches + "glibc-bootstrap-system.patch" + "glibc-static-nss.patch") + (origin-patches (package-source base)))))) (arguments (substitute-keyword-arguments (package-arguments base) ((#:configure-flags flags) diff --git a/gnu/packages/patches/glibc-static-nss.patch b/gnu/packages/patches/glibc-static-nss.patch new file mode 100644 index 00000000000..1a9db616cc2 --- /dev/null +++ b/gnu/packages/patches/glibc-static-nss.patch @@ -0,0 +1,1244 @@ +This patch reinstates support for static NSS, which glibc 2.33 broke: + + https://sourceware.org/bugzilla/show_bug.cgi?id=27959 + +Patch obtained by running: + + git diff f0c28504a9877be5da3ed1215f2da2d5914bbb0b..f9c8b11ed7726b858cd7b7cea0d3d7c5233d78cf + git diff 5e1ce61e3e71fb7ffe53f58fe96e67cb15f94854{^,} + git diff 135425a1dd50cbe2b9db0628d6c2b36c7889f30b{^,} + +It corresponds to these changes: + + f9c8b11ed7 * nss: Access nss_files through direct references + 6212bb67f4 * nss_files: Move into libc + 36861a968a * nss_files: Add generic code for set*ent, end*ent and file open + f0c28504a9 * nss_files: Allocate nscd file registration data on the heap + 5e1ce61e3e * nss: Fix NSS_DECLARE_MODULE_FUNCTIONS handling of _nss_*_endnetgrent + 135425a1dd * nss: Fix build error with --disable-nscd + +... plus a manual fix in 'files-network.c' to address this compilation error: + + nss_files/files-network.c: In function ‘_nss_files_parse_netent’: + nss_files/files-network.c:72:20: error: implicit declaration of function ‘__inet_network’; did you mean ‘inet_network’? [-Werror=implicit-function-declaration] + 72 | result->n_net = __inet_network (addr); + | ^~~~~~~~~~~~~~ + nss_files/files-parse.c:106:3: note: in definition of macro ‘LINE_PARSER’ + 106 | BODY; \ + | ^~~~ + +diff --git a/include/libc-symbols.h b/include/libc-symbols.h +index 127ea656c2..d41ecf4384 100644 +--- a/include/libc-symbols.h ++++ b/include/libc-symbols.h +@@ -798,29 +798,6 @@ for linking") + # define libdl_hidden_data_ver(local, name) + #endif + +-#if IS_IN (libnss_files) +-# define libnss_files_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +-# define libnss_files_hidden_tls_proto(name, attrs...) \ +- hidden_tls_proto (name, ##attrs) +-# define libnss_files_hidden_def(name) hidden_def (name) +-# define libnss_files_hidden_weak(name) hidden_weak (name) +-# define libnss_files_hidden_ver(local, name) hidden_ver (local, name) +-# define libnss_files_hidden_data_def(name) hidden_data_def (name) +-# define libnss_files_hidden_tls_def(name) hidden_tls_def (name) +-# define libnss_files_hidden_data_weak(name) hidden_data_weak (name) +-# define libnss_files_hidden_data_ver(local, name) hidden_data_ver(local, name) +-#else +-# define libnss_files_hidden_proto(name, attrs...) +-# define libnss_files_hidden_tls_proto(name, attrs...) +-# define libnss_files_hidden_def(name) +-# define libnss_files_hidden_weak(name) +-# define libnss_files_hidden_ver(local, name) +-# define libnss_files_hidden_data_def(name) +-# define libnss_files_hidden_tls_def(name) +-# define libnss_files_hidden_data_weak(name) +-# define libnss_files_hidden_data_ver(local, name) +-#endif +- + #if IS_IN (libnsl) + # define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) + # define libnsl_hidden_tls_proto(name, attrs...) \ +diff --git a/include/netdb.h b/include/netdb.h +index 82e102ff76..4dcdbb8cd4 100644 +--- a/include/netdb.h ++++ b/include/netdb.h +@@ -217,7 +217,7 @@ extern enum nss_status _nss_netgroup_parseline (char **cursor, + struct __netgrent *result, + char *buffer, size_t buflen, + int *errnop); +-libnss_files_hidden_proto (_nss_netgroup_parseline) ++libc_hidden_proto (_nss_netgroup_parseline) + + #define DECLARE_NSS_PROTOTYPES(service) \ + extern enum nss_status _nss_ ## service ## _setprotoent (int); \ +diff --git a/include/nss_files.h b/include/nss_files.h +index 6a0dcdb85b..6190cac6be 100644 +--- a/include/nss_files.h ++++ b/include/nss_files.h +@@ -19,7 +19,11 @@ + #ifndef _NSS_FILES_H + #define _NSS_FILES_H + ++#include + #include ++#if IS_IN (libc) ++#include ++#endif + + /* Open PATH for reading, as a data source for nss_files. */ + FILE *__nss_files_fopen (const char *path); +@@ -47,6 +51,63 @@ int __nss_readline_seek (FILE *fp, off64_t offset) attribute_hidden; + int __nss_parse_line_result (FILE *fp, off64_t offset, int parse_line_result); + libc_hidden_proto (__nss_parse_line_result) + ++/* Per-file data. Used by the *ent functions that need to preserve ++ state across calls. */ ++struct nss_files_per_file_data ++{ ++ FILE *stream; ++#if IS_IN (libc) ++ /* The size of locks changes between libc and nss_files, so this ++ member must be last and is only available in libc. */ ++ __libc_lock_define (, lock); ++#endif ++}; ++ ++/* File index for __nss_files_data_get. */ ++enum nss_files_file ++ { ++ nss_file_aliasent, ++ nss_file_etherent, ++ nss_file_grent, ++ nss_file_hostent, ++ nss_file_netent, ++ nss_file_protoent, ++ nss_file_pwent, ++ nss_file_rpcent, ++ nss_file_servent, ++ nss_file_sgent, ++ nss_file_spent, ++ ++ nss_file_count ++ }; ++ ++/* Obtains a pointer to the per-file data for FILE, which is written ++ to *PDATA, and tries to open the file at PATH for it. On success, ++ returns NSS_STATUS_SUCCESS, and the caller must later call ++ __nss_files_data_put. On failure, NSS_STATUS_TRYAGAIN is returned, ++ and *ERRNOP and *HERRNOP are updated if these pointers are not ++ null. */ ++enum nss_status __nss_files_data_open (struct nss_files_per_file_data **pdata, ++ enum nss_files_file file, ++ const char *path, ++ int *errnop, int *herrnop); ++libc_hidden_proto (__nss_files_data_open) ++ ++/* Unlock the per-file data, previously obtained by ++ __nss_files_data_open. */ ++void __nss_files_data_put (struct nss_files_per_file_data *data); ++libc_hidden_proto (__nss_files_data_put) ++ ++/* Performs the set*ent operation for FILE. PATH is the file to ++ open. */ ++enum nss_status __nss_files_data_setent (enum nss_files_file file, ++ const char *path); ++libc_hidden_proto (__nss_files_data_setent) ++ ++/* Performs the end*ent operation for FILE. */ ++enum nss_status __nss_files_data_endent (enum nss_files_file file); ++libc_hidden_proto (__nss_files_data_endent) ++ + struct parser_data; + + /* Instances of the parse_line function from +@@ -64,16 +125,25 @@ extern nss_files_parse_line _nss_files_parse_servent; + extern nss_files_parse_line _nss_files_parse_sgent; + extern nss_files_parse_line _nss_files_parse_spent; + +-libnss_files_hidden_proto (_nss_files_parse_etherent) ++libc_hidden_proto (_nss_files_parse_etherent) + libc_hidden_proto (_nss_files_parse_grent) +-libnss_files_hidden_proto (_nss_files_parse_netent) +-libnss_files_hidden_proto (_nss_files_parse_protoent) ++libc_hidden_proto (_nss_files_parse_netent) ++libc_hidden_proto (_nss_files_parse_protoent) + libc_hidden_proto (_nss_files_parse_pwent) +-libnss_files_hidden_proto (_nss_files_parse_rpcent) +-libnss_files_hidden_proto (_nss_files_parse_servent) ++libc_hidden_proto (_nss_files_parse_rpcent) ++libc_hidden_proto (_nss_files_parse_servent) + libc_hidden_proto (_nss_files_parse_sgent) + libc_hidden_proto (_nss_files_parse_spent) + ++NSS_DECLARE_MODULE_FUNCTIONS (files) ++#undef DEFINE_NSS_FUNCTION ++#define DEFINE_NSS_FUNCTION(x) libc_hidden_proto (_nss_files_##x) ++#include ++#undef DEFINE_NSS_FUNCTION ++ ++void _nss_files_init (void (*cb) (size_t, struct traced_file *)); ++libc_hidden_proto (_nss_files_init) ++ + /* Generic implementation of fget*ent_r. Reads lines from FP until + EOF or a successful parse into *RESULT using PARSER. Returns 0 on + success, ENOENT on EOF, ERANGE on too-small buffer. */ +diff --git a/nss/Makefile b/nss/Makefile +index 9682a31e20..63a386af18 100644 +--- a/nss/Makefile ++++ b/nss/Makefile +@@ -31,7 +31,8 @@ routines = nsswitch getnssent getnssent_r digits_dots \ + compat-lookup nss_hash nss_files_fopen \ + nss_readline nss_parse_line_result \ + nss_fgetent_r nss_module nss_action \ +- nss_action_parse nss_database ++ nss_action_parse nss_database nss_files_data \ ++ nss_files_functions + + # These are the databases that go through nss dispatch. + # Caution: if you add a database here, you must add its real name +@@ -98,9 +99,11 @@ subdir-dirs = $(services:%=nss_%) + vpath %.c $(subdir-dirs) ../locale/programs ../intl + + +-libnss_files-routines := $(addprefix files-, \ +- $(filter-out key, $(databases))) \ +- files-initgroups files-init ++routines += \ ++ $(addprefix files-, $(filter-out key, $(databases))) \ ++ files-init \ ++ files-initgroups \ ++ # routines + + libnss_db-dbs := $(addprefix db-,\ + $(filter-out hosts network key alias,\ +@@ -116,12 +119,9 @@ libnss_compat-routines := $(addprefix compat-,grp pwd spwd initgroups) \ + install-others += $(inst_vardbdir)/Makefile + + # Build static module into libc if requested +-libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes)) + libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes)) + libnss_compat-inhibit-o = $(filter-out .os,$(object-suffixes)) + ifeq ($(build-static-nss),yes) +-routines += $(libnss_files-routines) +-static-only-routines += $(libnss_files-routines) + tests-static += tst-nss-static + endif + extra-test-objs += nss_test1.os nss_test2.os +@@ -138,8 +138,6 @@ libnss-libc = $(common-objpfx)linkobj/libc.so + # for new links: + $(services:%=$(objpfx)libnss_%.so): libc-for-link = $(libnss-libc) + +-$(objpfx)libnss_db.so: $(objpfx)libnss_files.so +- + $(libnss_db-dbs:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c + @rm -f $@.new + (echo '#define EXTERN_PARSER';\ +diff --git a/nss/Versions b/nss/Versions +index fdddea104c..e551524aa9 100644 +--- a/nss/Versions ++++ b/nss/Versions +@@ -19,11 +19,12 @@ libc { + __nss_services_lookup2; __nss_next2; __nss_lookup; + __nss_hash; __nss_database_get; + __nss_files_fopen; __nss_readline; __nss_parse_line_result; +- } +-} ++ __nss_files_data_endent; ++ __nss_files_data_open; ++ __nss_files_data_put; ++ __nss_files_data_setent; + +-libnss_files { +- GLIBC_PRIVATE { ++ # Routines formerly in libnss_files.so.2. + _nss_files_setaliasent; + _nss_files_endaliasent; + _nss_files_getaliasbyname_r; +@@ -109,6 +110,14 @@ libnss_files { + } + } + ++libnss_files { ++ GLIBC_PRIVATE { ++ # Keep a version node (with a synthesized local: * directive) so that ++ # __bss_* symbols are hidden on targets that need it. ++ __libnss_files_version_placeholder; ++ } ++} ++ + libnss_db { + GLIBC_PRIVATE { + _nss_db_setetherent; +diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c +index b4b989d9bb..c158a891bd 100644 +--- a/nss/nss_files/files-XXX.c ++++ b/nss/nss_files/files-XXX.c +@@ -45,10 +45,12 @@ + # include + # define H_ERRNO_PROTO , int *herrnop + # define H_ERRNO_ARG , herrnop ++# define H_ERRNO_ARG_OR_NULL herrnop + # define H_ERRNO_SET(val) (*herrnop = (val)) + #else + # define H_ERRNO_PROTO + # define H_ERRNO_ARG ++# define H_ERRNO_ARG_OR_NULL NULL + # define H_ERRNO_SET(val) ((void) 0) + #endif + +@@ -58,15 +60,11 @@ + # define EXTRA_ARGS_VALUE + #endif + +-/* Locks the static variables in this file. */ +-__libc_lock_define_initialized (static, lock) + + /* Maintenance of the stream open on the database file. For getXXent + operations the stream needs to be held open across calls, the other + getXXbyYY operations all use their own stream. */ + +-static FILE *stream; +- + /* Open database file if not already opened. */ + static enum nss_status + internal_setent (FILE **stream) +@@ -91,42 +89,16 @@ internal_setent (FILE **stream) + enum nss_status + CONCAT(_nss_files_set,ENTNAME) (int stayopen) + { +- enum nss_status status; +- +- __libc_lock_lock (lock); +- +- status = internal_setent (&stream); +- +- __libc_lock_unlock (lock); +- +- return status; ++ return __nss_files_data_setent (CONCAT (nss_file_, ENTNAME), DATAFILE); + } ++libc_hidden_def (CONCAT (_nss_files_set,ENTNAME)) + +- +-/* Close the database file. */ +-static void +-internal_endent (FILE **stream) +-{ +- if (*stream != NULL) +- { +- fclose (*stream); +- *stream = NULL; +- } +-} +- +- +-/* Thread-safe, exported version of that. */ + enum nss_status + CONCAT(_nss_files_end,ENTNAME) (void) + { +- __libc_lock_lock (lock); +- +- internal_endent (&stream); +- +- __libc_lock_unlock (lock); +- +- return NSS_STATUS_SUCCESS; ++ return __nss_files_data_endent (CONCAT (nss_file_, ENTNAME)); + } ++libc_hidden_def (CONCAT (_nss_files_end,ENTNAME)) + + + /* Parsing the database file into `struct STRUCTURE' data structures. */ +@@ -194,28 +166,22 @@ CONCAT(_nss_files_get,ENTNAME_r) (struct STRUCTURE *result, char *buffer, + size_t buflen, int *errnop H_ERRNO_PROTO) + { + /* Return next entry in host file. */ +- enum nss_status status = NSS_STATUS_SUCCESS; +- +- __libc_lock_lock (lock); + +- /* Be prepared that the set*ent function was not called before. */ +- if (stream == NULL) +- { +- int save_errno = errno; +- +- status = internal_setent (&stream); +- +- __set_errno (save_errno); +- } +- +- if (status == NSS_STATUS_SUCCESS) +- status = internal_getent (stream, result, buffer, buflen, errnop +- H_ERRNO_ARG EXTRA_ARGS_VALUE); ++ struct nss_files_per_file_data *data; ++ enum nss_status status = __nss_files_data_open (&data, ++ CONCAT (nss_file_, ENTNAME), ++ DATAFILE, ++ errnop, H_ERRNO_ARG_OR_NULL); ++ if (status != NSS_STATUS_SUCCESS) ++ return status; + +- __libc_lock_unlock (lock); ++ status = internal_getent (data->stream, result, buffer, buflen, errnop ++ H_ERRNO_ARG EXTRA_ARGS_VALUE); + ++ __nss_files_data_put (data); + return status; + } ++libc_hidden_def (CONCAT (_nss_files_get,ENTNAME_r)) + + /* Macro for defining lookup functions for this file-based database. + +@@ -248,8 +214,9 @@ _nss_files_get##name##_r (proto, \ + == NSS_STATUS_SUCCESS) \ + { break_if_match } \ + \ +- internal_endent (&stream); \ ++ fclose (stream); \ + } \ + \ + return status; \ +-} ++} \ ++libc_hidden_def (_nss_files_get##name##_r) +diff --git a/nss/nss_files/files-alias.c b/nss/nss_files/files-alias.c +index 30971bfe56..8c6e176ff6 100644 +--- a/nss/nss_files/files-alias.c ++++ b/nss/nss_files/files-alias.c +@@ -31,18 +31,11 @@ + #include "nsswitch.h" + #include + +-NSS_DECLARE_MODULE_FUNCTIONS (files) +- +-/* Locks the static variables in this file. */ +-__libc_lock_define_initialized (static, lock) + + /* Maintenance of the stream open on the database file. For getXXent + operations the stream needs to be held open across calls, the other + getXXbyYY operations all use their own stream. */ + +-static FILE *stream; +- +- + static enum nss_status + internal_setent (FILE **stream) + { +@@ -66,42 +59,16 @@ internal_setent (FILE **stream) + enum nss_status + _nss_files_setaliasent (void) + { +- enum nss_status status; +- +- __libc_lock_lock (lock); +- +- status = internal_setent (&stream); +- +- __libc_lock_unlock (lock); +- +- return status; ++ return __nss_files_data_setent (nss_file_aliasent, "/etc/aliases"); + } ++libc_hidden_def (_nss_files_setaliasent) + +- +-/* Close the database file. */ +-static void +-internal_endent (FILE **stream) +-{ +- if (*stream != NULL) +- { +- fclose (*stream); +- *stream = NULL; +- } +-} +- +- +-/* Thread-safe, exported version of that. */ + enum nss_status + _nss_files_endaliasent (void) + { +- __libc_lock_lock (lock); +- +- internal_endent (&stream); +- +- __libc_lock_unlock (lock); +- +- return NSS_STATUS_SUCCESS; ++ return __nss_files_data_endent (nss_file_aliasent); + } ++libc_hidden_def (_nss_files_endaliasent) + + /* Parsing the database file into `struct aliasent' data structures. */ + static enum nss_status +@@ -131,7 +98,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result, + /* Read the first line. It must contain the alias name and + possibly some alias names. */ + first_unused[room_left - 1] = '\xff'; +- line = fgets_unlocked (first_unused, room_left, stream); ++ line = __fgets_unlocked (first_unused, room_left, stream); + if (line == NULL) + /* Nothing to read. */ + break; +@@ -220,7 +187,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result, + /* If the file does not exist we simply ignore + the statement. */ + if (listfile != NULL +- && (old_line = strdup (line)) != NULL) ++ && (old_line = __strdup (line)) != NULL) + { + while (! feof_unlocked (listfile)) + { +@@ -232,8 +199,8 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result, + } + + first_unused[room_left - 1] = '\xff'; +- line = fgets_unlocked (first_unused, room_left, +- listfile); ++ line = __fgets_unlocked (first_unused, room_left, ++ listfile); + if (line == NULL) + break; + if (first_unused[room_left - 1] != '\xff') +@@ -335,7 +302,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result, + /* The just read character is a white space and so + can be ignored. */ + first_unused[room_left - 1] = '\xff'; +- line = fgets_unlocked (first_unused, room_left, stream); ++ line = __fgets_unlocked (first_unused, room_left, stream); + if (line == NULL) + { + /* Continuation line without any data and +@@ -369,29 +336,25 @@ _nss_files_getaliasent_r (struct aliasent *result, char *buffer, size_t buflen, + int *errnop) + { + /* Return next entry in host file. */ +- enum nss_status status = NSS_STATUS_SUCCESS; + +- __libc_lock_lock (lock); +- +- /* Be prepared that the set*ent function was not called before. */ +- if (stream == NULL) +- status = internal_setent (&stream); +- +- if (status == NSS_STATUS_SUCCESS) +- { +- result->alias_local = 1; ++ struct nss_files_per_file_data *data; ++ enum nss_status status = __nss_files_data_open (&data, nss_file_aliasent, ++ "/etc/aliases", errnop, NULL); ++ if (status != NSS_STATUS_SUCCESS) ++ return status; + +- /* Read lines until we get a definite result. */ +- do +- status = get_next_alias (stream, NULL, result, buffer, buflen, errnop); +- while (status == NSS_STATUS_RETURN); +- } ++ result->alias_local = 1; + +- __libc_lock_unlock (lock); ++ /* Read lines until we get a definite result. */ ++ do ++ status = get_next_alias (data->stream, NULL, result, buffer, buflen, ++ errnop); ++ while (status == NSS_STATUS_RETURN); + ++ __nss_files_data_put (data); + return status; + } +- ++libc_hidden_def (_nss_files_getaliasent_r) + + enum nss_status + _nss_files_getaliasbyname_r (const char *name, struct aliasent *result, +@@ -418,9 +381,10 @@ _nss_files_getaliasbyname_r (const char *name, struct aliasent *result, + do + status = get_next_alias (stream, name, result, buffer, buflen, errnop); + while (status == NSS_STATUS_RETURN); +- } + +- internal_endent (&stream); ++ fclose (stream); ++ } + + return status; + } ++libc_hidden_def (_nss_files_getaliasbyname_r) +diff --git a/nss/nss_files/files-ethers.c b/nss/nss_files/files-ethers.c +index 2fe7f81e4b..7c2c2b9833 100644 +--- a/nss/nss_files/files-ethers.c ++++ b/nss/nss_files/files-ethers.c +@@ -20,8 +20,6 @@ + #include + #include + +-NSS_DECLARE_MODULE_FUNCTIONS (files) +- + struct etherent_data {}; + + #define ENTNAME etherent +diff --git a/nss/nss_files/files-grp.c b/nss/nss_files/files-grp.c +index 49be38e8b1..a716d948e2 100644 +--- a/nss/nss_files/files-grp.c ++++ b/nss/nss_files/files-grp.c +@@ -19,8 +19,6 @@ + #include + #include + +-NSS_DECLARE_MODULE_FUNCTIONS (files) +- + #define STRUCTURE group + #define ENTNAME grent + #define DATABASE "group" +diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c +index 2b47ec3e53..d54d91d038 100644 +--- a/nss/nss_files/files-hosts.c ++++ b/nss/nss_files/files-hosts.c +@@ -26,8 +26,6 @@ + #include + #include + +-NSS_DECLARE_MODULE_FUNCTIONS (files) +- + /* Get implementation for some internal functions. */ + #include "../resolv/res_hconf.h" + +@@ -57,12 +55,13 @@ LINE_PARSER + STRING_FIELD (addr, isspace, 1); + + /* Parse address. */ +- if (inet_pton (af == AF_UNSPEC ? AF_INET : af, addr, entdata->host_addr) ++ if (__inet_pton (af == AF_UNSPEC ? AF_INET : af, addr, entdata->host_addr) + > 0) + af = af == AF_UNSPEC ? AF_INET : af; + else + { +- if (af == AF_INET && inet_pton (AF_INET6, addr, entdata->host_addr) > 0) ++ if (af == AF_INET ++ && __inet_pton (AF_INET6, addr, entdata->host_addr) > 0) + { + if (IN6_IS_ADDR_V4MAPPED (entdata->host_addr)) + memcpy (entdata->host_addr, entdata->host_addr + 12, INADDRSZ); +@@ -76,7 +75,7 @@ LINE_PARSER + return 0; + } + else if (af == AF_UNSPEC +- && inet_pton (AF_INET6, addr, entdata->host_addr) > 0) ++ && __inet_pton (AF_INET6, addr, entdata->host_addr) > 0) + af = AF_INET6; + else + /* Illegal address: ignore line. */ +@@ -349,7 +348,7 @@ _nss_files_gethostbyname3_r (const char *name, int af, struct hostent *result, + status = gethostbyname3_multi + (stream, name, af, result, buffer, buflen, errnop, herrnop); + +- internal_endent (&stream); ++ fclose (stream); + } + + if (canonp && status == NSS_STATUS_SUCCESS) +@@ -357,6 +356,7 @@ _nss_files_gethostbyname3_r (const char *name, int af, struct hostent *result, + + return status; + } ++libc_hidden_def (_nss_files_gethostbyname3_r) + + enum nss_status + _nss_files_gethostbyname_r (const char *name, struct hostent *result, +@@ -366,6 +366,7 @@ _nss_files_gethostbyname_r (const char *name, struct hostent *result, + return _nss_files_gethostbyname3_r (name, AF_INET, result, buffer, buflen, + errnop, herrnop, NULL, NULL); + } ++libc_hidden_def (_nss_files_gethostbyname_r) + + enum nss_status + _nss_files_gethostbyname2_r (const char *name, int af, struct hostent *result, +@@ -375,6 +376,7 @@ _nss_files_gethostbyname2_r (const char *name, int af, struct hostent *result, + return _nss_files_gethostbyname3_r (name, af, result, buffer, buflen, + errnop, herrnop, NULL, NULL); + } ++libc_hidden_def (_nss_files_gethostbyname2_r) + + enum nss_status + _nss_files_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, +@@ -475,7 +477,7 @@ _nss_files_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, + status = NSS_STATUS_SUCCESS; + } + +- internal_endent (&stream); ++ fclose (stream); + } + else if (status == NSS_STATUS_TRYAGAIN) + { +@@ -490,3 +492,4 @@ _nss_files_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, + + return status; + } ++libc_hidden_def (_nss_files_gethostbyname4_r) +diff --git a/nss/nss_files/files-init.c b/nss/nss_files/files-init.c +index 717c9fd334..18ed288d04 100644 +--- a/nss/nss_files/files-init.c ++++ b/nss/nss_files/files-init.c +@@ -21,8 +21,7 @@ + #include + #include + #include +- +-NSS_DECLARE_MODULE_FUNCTIONS (files) ++#include + + static void + register_file (void (*cb) (size_t, struct traced_file *), +@@ -49,5 +48,6 @@ _nss_files_init (void (*cb) (size_t, struct traced_file *)) + register_file (cb, servdb, "/etc/services", 0); + register_file (cb, netgrdb, "/etc/netgroup", 0); + } ++libc_hidden_def (_nss_files_init) + + #endif +diff --git a/nss/nss_files/files-initgroups.c b/nss/nss_files/files-initgroups.c +index 6fcea40b55..b44211e50b 100644 +--- a/nss/nss_files/files-initgroups.c ++++ b/nss/nss_files/files-initgroups.c +@@ -28,8 +28,6 @@ + #include + #include + +-NSS_DECLARE_MODULE_FUNCTIONS (files) +- + enum nss_status + _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start, + long int *size, gid_t **groupsp, long int limit, +@@ -129,3 +127,4 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start, + + return status == NSS_STATUS_SUCCESS && !any ? NSS_STATUS_NOTFOUND : status; + } ++libc_hidden_def (_nss_files_initgroups_dyn) +diff --git a/nss/nss_files/files-netgrp.c b/nss/nss_files/files-netgrp.c +index f8c821c2f0..75bfbd9e44 100644 +--- a/nss/nss_files/files-netgrp.c ++++ b/nss/nss_files/files-netgrp.c +@@ -28,11 +28,9 @@ + #include "netgroup.h" + #include + +-NSS_DECLARE_MODULE_FUNCTIONS (files) +- + #define DATAFILE "/etc/netgroup" + +-libnss_files_hidden_proto (_nss_files_endnetgrent) ++libc_hidden_proto (_nss_files_endnetgrent) + + #define EXPAND(needed) \ + do \ +@@ -152,7 +150,7 @@ _nss_files_setnetgrent (const char *group, struct __netgrent *result) + + return status; + } +- ++libc_hidden_def (_nss_files_setnetgrent) + + enum nss_status + _nss_files_endnetgrent (struct __netgrent *result) +@@ -164,7 +162,7 @@ _nss_files_endnetgrent (struct __netgrent *result) + result->cursor = NULL; + return NSS_STATUS_SUCCESS; + } +-libnss_files_hidden_def (_nss_files_endnetgrent) ++libc_hidden_def (_nss_files_endnetgrent) + + static char * + strip_whitespace (char *str) +@@ -279,7 +277,7 @@ _nss_netgroup_parseline (char **cursor, struct __netgrent *result, + + return status; + } +-libnss_files_hidden_def (_nss_netgroup_parseline) ++libc_hidden_def (_nss_netgroup_parseline) + + + enum nss_status +@@ -293,3 +291,4 @@ _nss_files_getnetgrent_r (struct __netgrent *result, char *buffer, + + return status; + } ++libc_hidden_def (_nss_files_getnetgrent_r) +diff --git a/nss/nss_files/files-network.c b/nss/nss_files/files-network.c +index 9cd7d7dc79..217ed78609 100644 +--- a/nss/nss_files/files-network.c ++++ b/nss/nss_files/files-network.c +@@ -22,8 +22,6 @@ + #include + #include + +-NSS_DECLARE_MODULE_FUNCTIONS (files) +- + #define ENTNAME netent + #define DATABASE "networks" + #define NEED_H_ERRNO +@@ -71,7 +69,7 @@ LINE_PARSER + *cp = '\0'; + addr = newp; + } +- result->n_net = inet_network (addr); ++ result->n_net = inet_network (addr); + result->n_addrtype = AF_INET; + + }) +diff --git a/nss/nss_files/files-parse.c b/nss/nss_files/files-parse.c +index 68c51c7cbf..997eac573a 100644 +--- a/nss/nss_files/files-parse.c ++++ b/nss/nss_files/files-parse.c +@@ -74,13 +74,7 @@ struct parser_data + /* Export the line parser function so it can be used in nss_db. */ + # define parser_stclass /* Global */ + # define parse_line CONCAT(_nss_files_parse_,ENTNAME) +-# if IS_IN (libc) +-/* We are defining one of the functions that actually lives in libc +- because it is used to implement fget*ent and suchlike. */ +-# define nss_files_parse_hidden_def(name) libc_hidden_def (name) +-# else +-# define nss_files_parse_hidden_def(name) libnss_files_hidden_def (name) +-# endif ++# define nss_files_parse_hidden_def(name) libc_hidden_def (name) + #endif + + +diff --git a/nss/nss_files/files-proto.c b/nss/nss_files/files-proto.c +index 98d082c642..13072692c1 100644 +--- a/nss/nss_files/files-proto.c ++++ b/nss/nss_files/files-proto.c +@@ -19,8 +19,6 @@ + #include + #include + +-NSS_DECLARE_MODULE_FUNCTIONS (files) +- + #define ENTNAME protoent + #define DATABASE "protocols" + +diff --git a/nss/nss_files/files-pwd.c b/nss/nss_files/files-pwd.c +index b04165ddde..5c74c6da9b 100644 +--- a/nss/nss_files/files-pwd.c ++++ b/nss/nss_files/files-pwd.c +@@ -19,8 +19,6 @@ + #include + #include + +-NSS_DECLARE_MODULE_FUNCTIONS (files) +- + #define STRUCTURE passwd + #define ENTNAME pwent + #define DATABASE "passwd" +diff --git a/nss/nss_files/files-rpc.c b/nss/nss_files/files-rpc.c +index eeb2725d2c..3dea8f18f2 100644 +--- a/nss/nss_files/files-rpc.c ++++ b/nss/nss_files/files-rpc.c +@@ -19,8 +19,6 @@ + #include + #include + +-NSS_DECLARE_MODULE_FUNCTIONS (files) +- + #define ENTNAME rpcent + #define DATABASE "rpc" + +diff --git a/nss/nss_files/files-service.c b/nss/nss_files/files-service.c +index f4f0985377..a8d83e094e 100644 +--- a/nss/nss_files/files-service.c ++++ b/nss/nss_files/files-service.c +@@ -20,8 +20,6 @@ + #include + #include + +-NSS_DECLARE_MODULE_FUNCTIONS (files) +- + #define ENTNAME servent + #define DATABASE "services" + +diff --git a/nss/nss_files/files-sgrp.c b/nss/nss_files/files-sgrp.c +index 6b1c9eac02..213a408e7b 100644 +--- a/nss/nss_files/files-sgrp.c ++++ b/nss/nss_files/files-sgrp.c +@@ -19,8 +19,6 @@ + #include + #include + +-NSS_DECLARE_MODULE_FUNCTIONS (files) +- + #define STRUCTURE sgrp + #define ENTNAME sgent + #define DATABASE "gshadow" +diff --git a/nss/nss_files/files-spwd.c b/nss/nss_files/files-spwd.c +index 976deaf918..d031257a20 100644 +--- a/nss/nss_files/files-spwd.c ++++ b/nss/nss_files/files-spwd.c +@@ -19,8 +19,6 @@ + #include + #include + +-NSS_DECLARE_MODULE_FUNCTIONS (files) +- + #define STRUCTURE spwd + #define ENTNAME spent + #define DATABASE "shadow" +diff --git a/nss/nss_files_data.c b/nss/nss_files_data.c +new file mode 100644 +index 0000000000..80fbfe5fff +--- /dev/null ++++ b/nss/nss_files_data.c +@@ -0,0 +1,161 @@ ++/* Returns a pointer to the global nss_files data structure. ++ Copyright (C) 2021 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++/* This collects all per file-data. */ ++struct nss_files_data ++{ ++ struct nss_files_per_file_data files[nss_file_count]; ++}; ++ ++/* For use with allocate_once. */ ++static void *nss_files_global; ++static void * ++nss_files_global_allocate (void *closure) ++{ ++ struct nss_files_data *result = malloc (sizeof (*result)); ++ if (result != NULL) ++ { ++ for (int i = 0; i < nss_file_count; ++i) ++ { ++ result->files[i].stream = NULL; ++ __libc_lock_init (result->files[i].lock); ++ } ++ } ++ return result; ++} ++/* Like __nss_files_data_open, but does not perform the open call. */ ++static enum nss_status ++__nss_files_data_get (struct nss_files_per_file_data **pdata, ++ enum nss_files_file file, int *errnop, int *herrnop) ++{ ++ struct nss_files_data *data = allocate_once (&nss_files_global, ++ nss_files_global_allocate, ++ NULL, NULL); ++ if (data == NULL) ++ { ++ if (errnop != NULL) ++ *errnop = errno; ++ if (herrnop != NULL) ++ { ++ __set_h_errno (NETDB_INTERNAL); ++ *herrnop = NETDB_INTERNAL; ++ } ++ return NSS_STATUS_TRYAGAIN; ++ } ++ ++ *pdata = &data->files[file]; ++ __libc_lock_lock ((*pdata)->lock); ++ return NSS_STATUS_SUCCESS; ++} ++ ++/* Helper function for opening the backing file at PATH. */ ++static enum nss_status ++__nss_files_data_internal_open (struct nss_files_per_file_data *data, ++ const char *path) ++{ ++ enum nss_status status = NSS_STATUS_SUCCESS; ++ ++ if (data->stream == NULL) ++ { ++ data->stream = __nss_files_fopen (path); ++ ++ if (data->stream == NULL) ++ status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL; ++ } ++ ++ return status; ++} ++ ++ ++enum nss_status ++__nss_files_data_open (struct nss_files_per_file_data **pdata, ++ enum nss_files_file file, const char *path, ++ int *errnop, int *herrnop) ++{ ++ enum nss_status status = __nss_files_data_get (pdata, file, errnop, herrnop); ++ if (status != NSS_STATUS_SUCCESS) ++ return status; ++ ++ /* Be prepared that the set*ent function was not called before. */ ++ if ((*pdata)->stream == NULL) ++ { ++ int saved_errno = errno; ++ status = __nss_files_data_internal_open (*pdata, path); ++ __set_errno (saved_errno); ++ if (status != NSS_STATUS_SUCCESS) ++ __nss_files_data_put (*pdata); ++ } ++ ++ return status; ++} ++ ++libc_hidden_def (__nss_files_data_open) ++ ++void ++__nss_files_data_put (struct nss_files_per_file_data *data) ++{ ++ __libc_lock_unlock (data->lock); ++} ++libc_hidden_def (__nss_files_data_put) ++ ++enum nss_status ++__nss_files_data_setent (enum nss_files_file file, const char *path) ++{ ++ struct nss_files_per_file_data *data; ++ enum nss_status status = __nss_files_data_get (&data, file, NULL, NULL); ++ if (status != NSS_STATUS_SUCCESS) ++ return status; ++ ++ if (data->stream == NULL) ++ status = __nss_files_data_internal_open (data, path); ++ else ++ rewind (data->stream); ++ ++ __nss_files_data_put (data); ++ return status; ++} ++libc_hidden_def (__nss_files_data_setent) ++ ++enum nss_status ++__nss_files_data_endent (enum nss_files_file file) ++{ ++ /* No cleanup is necessary if not initialized. */ ++ struct nss_files_data *data = atomic_load_acquire (&nss_files_global); ++ if (data == NULL) ++ return NSS_STATUS_SUCCESS; ++ ++ struct nss_files_per_file_data *fdata = &data->files[file]; ++ __libc_lock_lock (fdata->lock); ++ if (fdata->stream != NULL) ++ { ++ fclose (fdata->stream); ++ fdata->stream = NULL; ++ } ++ __libc_lock_unlock (fdata->lock); ++ ++ return NSS_STATUS_SUCCESS; ++} ++libc_hidden_def (__nss_files_data_endent) +diff --git a/nss/nss_files_functions.c b/nss/nss_files_functions.c +new file mode 100644 +index 0000000000..85720b4311 +--- /dev/null ++++ b/nss/nss_files_functions.c +@@ -0,0 +1,43 @@ ++/* Direct access for nss_files functions for NSS module loading. ++ Copyright (C) 2021 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++ ++void ++__nss_files_functions (nss_module_functions_untyped pointers) ++{ ++ void **fptr = pointers; ++ ++ /* Functions which are not implemented. */ ++#define _nss_files_getcanonname_r NULL ++#define _nss_files_gethostbyaddr2_r NULL ++#define _nss_files_getpublickey NULL ++#define _nss_files_getsecretkey NULL ++#define _nss_files_netname2user NULL ++ ++#undef DEFINE_NSS_FUNCTION ++#define DEFINE_NSS_FUNCTION(x) *fptr++ = _nss_files_##x; ++#include "function.def" ++ ++#ifdef PTR_MANGLE ++ void **end = fptr; ++ for (fptr = pointers; fptr != end; ++fptr) ++ PTR_MANGLE (*fptr); ++#endif ++} +diff --git a/nss/nss_module.c b/nss/nss_module.c +index 60c070c851..7b42c585a4 100644 +--- a/nss/nss_module.c ++++ b/nss/nss_module.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + + /* Suffix after .so of NSS service modules. This is a bit of magic, + but we assume LIBNSS_FILES_SO looks like "libnss_files.so.2" and we +@@ -110,10 +111,45 @@ static const function_name nss_function_name_array[] = + #include "function.def" + }; + ++static bool ++module_load_nss_files (struct nss_module *module) ++{ ++ if (is_nscd) ++ { ++ void (*cb) (size_t, struct traced_file *) = nscd_init_cb; ++# ifdef PTR_DEMANGLE ++ PTR_DEMANGLE (cb); ++# endif ++ _nss_files_init (cb); ++ } ++ ++ /* Initialize the function pointers, following the double-checked ++ locking idiom. */ ++ __libc_lock_lock (nss_module_list_lock); ++ switch ((enum nss_module_state) atomic_load_acquire (&module->state)) ++ { ++ case nss_module_uninitialized: ++ case nss_module_failed: ++ __nss_files_functions (module->functions.untyped); ++ module->handle = NULL; ++ /* Synchronizes with unlocked __nss_module_load atomic_load_acquire. */ ++ atomic_store_release (&module->state, nss_module_loaded); ++ break; ++ case nss_module_loaded: ++ /* Nothing to clean up. */ ++ break; ++ } ++ __libc_lock_unlock (nss_module_list_lock); ++ return true; ++} ++ + /* Internal implementation of __nss_module_load. */ + static bool + module_load (struct nss_module *module) + { ++ if (strcmp (module->name, "files") == 0) ++ return module_load_nss_files (module); ++ + void *handle; + { + char *shlib_name; +@@ -360,7 +396,7 @@ __nss_module_freeres (void) + struct nss_module *current = nss_module_list; + while (current != NULL) + { +- if (current->state == nss_module_loaded) ++ if (current->state == nss_module_loaded && current->handle != NULL) + __libc_dlclose (current->handle); + + struct nss_module *next = current->next; +diff --git a/nss/nss_module.h b/nss/nss_module.h +index 05c4791d11..c1a1d90b60 100644 +--- a/nss/nss_module.h ++++ b/nss/nss_module.h +@@ -38,6 +38,10 @@ struct nss_module_functions + typedef void *nss_module_functions_untyped[sizeof (struct nss_module_functions) + / sizeof (void *)]; + ++/* Locate the nss_files functions, as if by dlopen/dlsym. */ ++void __nss_files_functions (nss_module_functions_untyped pointers) ++ attribute_hidden; ++ + /* Initialization state of a NSS module. */ + enum nss_module_state + { +diff --git a/nss/nss_readline.c b/nss/nss_readline.c +index 4b3ecbccc8..a2f397a11f 100644 +--- a/nss/nss_readline.c ++++ b/nss/nss_readline.c +@@ -40,7 +40,7 @@ __nss_readline (FILE *fp, char *buf, size_t len, off64_t *poffset) + *poffset = __ftello64 (fp); + + buf[len - 1] = '\xff'; /* Marker to recognize truncation. */ +- if (fgets_unlocked (buf, len, fp) == NULL) ++ if (__fgets_unlocked (buf, len, fp) == NULL) + { + if (feof_unlocked (fp)) + { +@@ -61,7 +61,7 @@ __nss_readline (FILE *fp, char *buf, size_t len, off64_t *poffset) + line on the next call. */ + return __nss_readline_seek (fp, *poffset); + +- /* fgets_unlocked succeeded. */ ++ /* __fgets_unlocked succeeded. */ + + /* Remove leading whitespace. */ + char *p = buf; +diff --git a/nss/nss.h b/nss/nss.h +index ae213f9a6c..c6d62adc0f 100644 +--- a/nss/nss.h ++++ b/nss/nss.h +@@ -196,7 +196,7 @@ typedef enum nss_status nss_setspent (int); + extern nss_endgrent _nss_##module##_endgrent; \ + extern nss_endhostent _nss_##module##_endhostent; \ + extern nss_endnetent _nss_##module##_endnetent; \ +- extern nss_endnetgrent _nss_##module##__endnetgrent; \ ++ extern nss_endnetgrent _nss_##module##_endnetgrent; \ + extern nss_endprotoent _nss_##module##_endprotoent; \ + extern nss_endpwent _nss_##module##_endpwent; \ + extern nss_endrpcent _nss_##module##_endrpcent; \ +diff --git a/nss/nss_module.c b/nss/nss_module.c +index 7b42c585a4..7ea5ad9887 100644 +--- a/nss/nss_module.c ++++ b/nss/nss_module.c +@@ -114,14 +114,16 @@ static const function_name nss_function_name_array[] = + static bool + module_load_nss_files (struct nss_module *module) + { ++#ifdef USE_NSCD + if (is_nscd) + { + void (*cb) (size_t, struct traced_file *) = nscd_init_cb; +-# ifdef PTR_DEMANGLE ++# ifdef PTR_DEMANGLE + PTR_DEMANGLE (cb); +-# endif ++# endif + _nss_files_init (cb); + } ++#endif + + /* Initialize the function pointers, following the double-checked + locking idiom. */ -- cgit v1.3 From 7d30e6e5c21f5e0b79f73428414fef2dbf75e7a6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 28 Sep 2021 23:41:10 +0200 Subject: gnu: make-bootstrap: Allow compilation of the statically-link gawk. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, linking would fail due to the '-fno-common' default in GCC 10: ld: /gnu/store/…-glibc-2.33-static/lib/libc.a(getopt.o): in function `_getopt_internal_r': (.text+0x6e0): multiple definition of `_getopt_internal_r'; support/libsupport.a(getopt.o):/tmp/guix-build-gawk-5.1.0.drv-0/gawk-5.1.0/support/getopt.c:404: first defined here ld: /gnu/store/…-glibc-2.33-static/lib/libc.a(getopt.o): in function `_getopt_internal': Reported by Thiago Jung Bauermann . * gnu/packages/make-bootstrap.scm (%static-inputs) : Remove getopt.o from libsupport.a. --- gnu/packages/make-bootstrap.scm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 2d7a97488d8..40c1f822308 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -206,8 +206,17 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (("^xz_LDADD =") "xz_LDADD = -all-static")) #t))))))) - (gawk (package (inherit gawk) - (source (origin (inherit (package-source gawk)) + (gawk (package + (inherit gawk) + (source (origin + (inherit (package-source gawk)) + (modules '((guix build utils))) + (snippet + ;; Do not build 'getopt.c' since that leads to a + ;; link failure due to duplicate symbols with + ;; 'libc.a'. + '(substitute* "support/Makefile.in" + (("getopt\\.\\$\\(OBJEXT\\)") ""))) (patches (cons (search-patch "gawk-shell.patch") (origin-patches (package-source gawk)))))) -- cgit v1.3 From 106181c0a0bc757b68eb683464ec8122a7d371db Mon Sep 17 00:00:00 2001 From: Thiago Jung Bauermann Date: Mon, 23 Aug 2021 18:01:35 -0300 Subject: gnu: make-bootstrap: Enable tests in static gawk build. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tests were disabled because gawk’s extension mechanism doesn’t work when it’s built statically, and some tests fail because of that. Another alternative is to disable the extension mechanism during configuration time, which causes the testsuite to pass again. * gnu/packages/make-bootstrap.scm (%static-inputs)[gawk]<#:tests?>: Remove. <#:configure-flags>: Add. Signed-off-by: Ludovic Courtès --- gnu/packages/make-bootstrap.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 40c1f822308..3fc5c2a62de 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -225,7 +225,9 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." ;; plug-in mechanism just fail on static builds: ;; ;; ./fts.awk:1: error: can't open shared library `filefuncs' for reading (No such file or directory) - #:tests? #f + ;; + ;; Therefore disable extensions support. + #:configure-flags (list "--disable-extensions") ,@(substitute-keyword-arguments (package-arguments gawk) ((#:phases phases) -- cgit v1.3 From 26d31db7429b236f55df0602c56b8b2ac31adaae Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 29 Sep 2021 12:34:48 +0200 Subject: gnu: make-bootstrap: Remove input labels. * gnu/packages/make-bootstrap.scm (%static-inputs): Remove labels. (%static-binaries)[arguments]: Special-case 'name' for "bash-static". (%linux-libre-headers-stripped)[inputs]: Remove label. (%mes-minimal)[native-inputs]: Remove label. (tarball-package)[native-inputs]: Remove labels. [inputs]: Remove. [arguments]: Rewrite as a gexp. (%bootstrap-tarballs)[inputs]: Remove labels. --- gnu/packages/make-bootstrap.scm | 103 ++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 56 deletions(-) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 3fc5c2a62de..31ce1104411 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -274,19 +274,9 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (delete 'fix-egrep-and-fgrep))))))) (finalize (compose static-package package-with-relocatable-glibc))) - `(,@(map (match-lambda - ((name package) - (list name (finalize package)))) - `(("tar" ,tar) - ("gzip" ,gzip) - ("bzip2" ,bzip2) - ("xz" ,xz) - ("patch" ,patch) - ("coreutils" ,coreutils) - ("sed" ,sed) - ("grep" ,grep) - ("gawk" ,gawk))) - ("bash" ,static-bash)))) + (append (map finalize + (list tar gzip bzip2 xz patch coreutils sed grep gawk)) + (list static-bash)))) (define %static-binaries (package @@ -331,7 +321,10 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." ;; same name as the input. (for-each (match-lambda ((name . dir) - (let ((source (string-append dir "/bin/" name))) + (let* ((name (if (string-prefix? "bash" name) + "bash" + name)) + (source (string-append dir "/bin/" name))) (format #t "copying ~s...~%" source) (copy-file source (string-append bin "/" name))))) @@ -376,7 +369,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (out (assoc-ref %outputs "out"))) (copy-linux-headers out in) #t)))) - (inputs `(("linux-libre-headers" ,linux-libre-headers))))) + (inputs (list linux-libre-headers)))) (define %binutils-static ;; Statically-linked Binutils. @@ -639,8 +632,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (package (inherit mes) (name "mes-minimal") - (native-inputs - `(("guile" ,guile-3.0))) + (native-inputs (list guile-3.0)) (arguments `(#:system "i686-linux" #:strip-binaries? #f @@ -814,37 +806,35 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (define (tarball-package pkg) "Return a package containing a tarball of PKG." - (package (inherit pkg) + (package + (inherit pkg) (name (string-append (package-name pkg) "-tarball")) (build-system trivial-build-system) - (native-inputs `(("tar" ,tar) - ("xz" ,xz))) - (inputs `(("input" ,pkg))) + (native-inputs (list tar xz)) (arguments - (let ((name (package-name pkg)) - (version (package-version pkg))) - `(#:modules ((guix build utils)) - #:builder - (begin - (use-modules (guix build utils)) - (let ((out (assoc-ref %outputs "out")) - (input (assoc-ref %build-inputs "input")) - (tar (assoc-ref %build-inputs "tar")) - (xz (assoc-ref %build-inputs "xz"))) - (mkdir out) - (set-path-environment-variable "PATH" '("bin") (list tar xz)) - (with-directory-excursion input - (invoke "tar" "cJvf" - (string-append out "/" - ,name "-" ,version - "-" - ,(or (%current-target-system) - (%current-system)) - ".tar.xz") - "." - ;; avoid non-determinism in the archive - "--sort=name" "--mtime=@0" - "--owner=root:0" "--group=root:0"))))))))) + (list #:modules '((guix build utils)) + #:builder + #~(begin + (use-modules (guix build utils)) + (let ((out #$output) + (input #$pkg) + (tar #+(this-package-native-input "tar")) + (xz #+(this-package-native-input "xz"))) + (mkdir out) + (set-path-environment-variable "PATH" '("bin") (list tar xz)) + (with-directory-excursion input + (invoke "tar" "cJvf" + (string-append out "/" + #$(package-name pkg) "-" + #$(package-version pkg) + "-" + #$(or (%current-target-system) + (%current-system)) + ".tar.xz") + "." + ;; avoid non-determinism in the archive + "--sort=name" "--mtime=@0" + "--owner=root:0" "--group=root:0")))))))) (define %bootstrap-binaries-tarball ;; A tarball with the statically-linked bootstrap binaries. @@ -907,17 +897,18 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (symlink file (basename file))) (find-files directory "\\.tar\\.")))) %build-inputs)))) - (inputs `(("guile-tarball" ,%guile-bootstrap-tarball) - ,@(match (or (%current-target-system) (%current-system)) - ((or "i686-linux" "x86_64-linux") - `(("bootstrap-mescc-tools" ,%mescc-tools-bootstrap-tarball) - ("bootstrap-mes" ,%mes-bootstrap-tarball) - ("bootstrap-linux-libre-headers" - ,%linux-libre-headers-bootstrap-tarball))) - (_ `(("gcc-tarball" ,%gcc-bootstrap-tarball) - ("binutils-tarball" ,%binutils-bootstrap-tarball) - ("glibc-tarball" ,(%glibc-bootstrap-tarball)) - ("coreutils&co-tarball" ,%bootstrap-binaries-tarball)))))) + (inputs + (append (list %guile-bootstrap-tarball) + (match (or (%current-target-system) (%current-system)) + ((or "i686-linux" "x86_64-linux") + (list %mescc-tools-bootstrap-tarball + %mes-bootstrap-tarball + %linux-libre-headers-bootstrap-tarball)) + (_ + (list %gcc-bootstrap-tarball + %binutils-bootstrap-tarball + (%glibc-bootstrap-tarball) + %bootstrap-binaries-tarball))))) (synopsis "Tarballs containing all the bootstrap binaries") (description synopsis) (home-page #f) -- cgit v1.3 From 191c1992b819e9489054a1f2d8d300bfef2fe6f2 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 29 Sep 2021 22:10:54 +0200 Subject: gnu: make-bootstrap: Remove more input labels. * gnu/packages/make-bootstrap.scm (%binutils-static-stripped)[inputs]: Remove. [arguments]: Turn #:builder into a gexp. (%mes-minimal-stripped)[inputs]: Remove. [arguments]: Turn #:builder into a gexp. (make-guile-static-stripped): Likewise. --- gnu/packages/make-bootstrap.scm | 262 +++++++++++++++++++--------------------- 1 file changed, 126 insertions(+), 136 deletions(-) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 31ce1104411..2a00ab1d2f9 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -398,32 +398,31 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (define %binutils-static-stripped ;; The subset of Binutils that we need. - (package (inherit %binutils-static) + (package + (inherit %binutils-static) (name (string-append (package-name %binutils-static) "-stripped")) (build-system trivial-build-system) (outputs '("out")) (arguments - `(#:modules ((guix build utils)) - #:builder - (begin - (use-modules (guix build utils)) - - (setvbuf (current-output-port) - (cond-expand (guile-2.0 _IOLBF) (else 'line))) - (let* ((in (assoc-ref %build-inputs "binutils")) - (out (assoc-ref %outputs "out")) - (bin (string-append out "/bin"))) - (mkdir-p bin) - (for-each (lambda (file) - (let ((target (string-append bin "/" file))) - (format #t "copying `~a'...~%" file) - (copy-file (string-append in "/bin/" file) - target) - (remove-store-references target))) - '("ar" "as" "ld" "nm" "objcopy" "objdump" - "ranlib" "readelf" "size" "strings" "strip")) - #t)))) - (inputs `(("binutils" ,%binutils-static))))) + (list #:modules '((guix build utils)) + #:builder + #~(begin + (use-modules (guix build utils)) + + (setvbuf (current-output-port) + (cond-expand (guile-2.0 _IOLBF) (else 'line))) + (let* ((in #$%binutils-static) + (out #$output) + (bin (string-append out "/bin"))) + (mkdir-p bin) + (for-each (lambda (file) + (let ((target (string-append bin "/" file))) + (format #t "copying `~a'...~%" file) + (copy-file (string-append in "/bin/" file) + target) + (remove-store-references target))) + '("ar" "as" "ld" "nm" "objcopy" "objdump" + "ranlib" "readelf" "size" "strings" "strip")))))))) (define (%glibc-stripped) ;; GNU libc's essential shared libraries, dynamic linker, and headers, @@ -536,56 +535,54 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (define %gcc-stripped ;; The subset of GCC files needed for bootstrap. - (package (inherit gcc-7) + (package + (inherit gcc-7) (name "gcc-stripped") (build-system trivial-build-system) (source #f) (outputs '("out")) ;only one output (arguments - `(#:modules ((guix build utils)) - #:builder - (begin - (use-modules (srfi srfi-1) - (srfi srfi-26) - (guix build utils)) - - (setvbuf (current-output-port) - (cond-expand (guile-2.0 _IOLBF) (else 'line))) - (let* ((out (assoc-ref %outputs "out")) - (bindir (string-append out "/bin")) - (libdir (string-append out "/lib")) - (includedir (string-append out "/include")) - (libexecdir (string-append out "/libexec")) - (gcc (assoc-ref %build-inputs "gcc"))) - (copy-recursively (string-append gcc "/bin") bindir) - (for-each remove-store-references - (find-files bindir ".*")) - - (copy-recursively (string-append gcc "/lib") libdir) - (for-each remove-store-references - (remove (cut string-suffix? ".h" <>) - (find-files libdir ".*"))) - - (copy-recursively (string-append gcc "/libexec") - libexecdir) - (for-each remove-store-references - (find-files libexecdir ".*")) - - ;; Starting from GCC 4.8, helper programs built natively - ;; (‘genchecksum’, ‘gcc-nm’, etc.) rely on C++ headers. - (copy-recursively (string-append gcc "/include/c++") - (string-append includedir "/c++")) - - ;; For native builds, check whether the binaries actually work. - ,@(if (%current-target-system) - '() - '((for-each (lambda (prog) - (invoke (string-append gcc "/bin/" prog) - "--version")) - '("gcc" "g++" "cpp")))) + (list #:modules '((guix build utils)) + #:builder + #~(begin + (use-modules (srfi srfi-1) + (srfi srfi-26) + (guix build utils)) - #t)))) - (inputs `(("gcc" ,%gcc-static))))) + (setvbuf (current-output-port) + (cond-expand (guile-2.0 _IOLBF) (else 'line))) + (let* ((out #$output) + (bindir (string-append out "/bin")) + (libdir (string-append out "/lib")) + (includedir (string-append out "/include")) + (libexecdir (string-append out "/libexec")) + (gcc #$%gcc-static)) + (copy-recursively (string-append gcc "/bin") bindir) + (for-each remove-store-references + (find-files bindir ".*")) + + (copy-recursively (string-append gcc "/lib") libdir) + (for-each remove-store-references + (remove (cut string-suffix? ".h" <>) + (find-files libdir ".*"))) + + (copy-recursively (string-append gcc "/libexec") + libexecdir) + (for-each remove-store-references + (find-files libexecdir ".*")) + + ;; Starting from GCC 4.8, helper programs built natively + ;; (‘genchecksum’, ‘gcc-nm’, etc.) rely on C++ headers. + (copy-recursively (string-append gcc "/include/c++") + (string-append includedir "/c++")) + + ;; For native builds, check whether the binaries actually work. + #$@(if (%current-target-system) + '() + '((for-each (lambda (prog) + (invoke (string-append gcc "/bin/" prog) + "--version")) + '("gcc" "g++" "cpp")))))))))) ;; Two packages: first build static, bare minimum content. (define %mescc-tools-static @@ -608,23 +605,21 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (name (string-append (package-name %mescc-tools-static) "-stripped")) (build-system trivial-build-system) (arguments - `(#:modules ((guix build utils)) - #:builder - (begin - (use-modules (guix build utils)) - (let* ((in (assoc-ref %build-inputs "mescc-tools")) - (out (assoc-ref %outputs "out")) - (bin (string-append out "/bin"))) - (mkdir-p bin) - (for-each (lambda (file) - (let ((target (string-append bin "/" file))) - (format #t "copying `~a'...~%" file) - (copy-file (string-append in "/bin/" file) - target) - (remove-store-references target))) - '( "M1" "blood-elf" "hex2")) - #t)))) - (inputs `(("mescc-tools" ,%mescc-tools-static))))) + (list #:modules '((guix build utils)) + #:builder + #~(begin + (use-modules (guix build utils)) + (let* ((in #$%mescc-tools-static) + (out #$output) + (bin (string-append out "/bin"))) + (mkdir-p bin) + (for-each (lambda (file) + (let ((target (string-append bin "/" file))) + (format #t "copying `~a'...~%" file) + (copy-file (string-append in "/bin/" file) + target) + (remove-store-references target))) + '( "M1" "blood-elf" "hex2")))))))) ;; Two packages: first build static, bare minimum content. (define-public %mes-minimal @@ -660,22 +655,20 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (name (string-append (package-name %mes-minimal) "-stripped")) (build-system trivial-build-system) (arguments - `(#:modules ((guix build utils)) - #:allowed-references () - #:builder - (begin - (use-modules (guix build utils)) - (let ((in (assoc-ref %build-inputs "mes")) - (out (assoc-ref %outputs "out"))) - - (copy-recursively in out) - (for-each (lambda (dir) - (for-each remove-store-references - (find-files (string-append out "/" dir) - ".*"))) - '("bin" "share/mes")) - #t)))) - (inputs `(("mes" ,%mes-minimal))))) + (list #:modules '((guix build utils)) + #:allowed-references '() + #:builder + #~(begin + (use-modules (guix build utils)) + (let ((in #$%mes-minimal) + (out #$output)) + + (copy-recursively in out) + (for-each (lambda (dir) + (for-each remove-store-references + (find-files (string-append out "/" dir) + ".*"))) + '("bin" "share/mes")))))))) (define* (make-guile-static guile patches) (package-with-relocatable-glibc @@ -754,44 +747,41 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (build-system trivial-build-system) (arguments ;; The end result should depend on nothing but itself. - `(#:allowed-references ("out") - #:modules ((guix build utils)) - #:builder - (let ((version ,(version-major+minor (package-version static-guile)))) - (use-modules (guix build utils)) - - (let* ((in (assoc-ref %build-inputs "guile")) - (out (assoc-ref %outputs "out")) - (guile1 (string-append in "/bin/guile")) - (guile2 (string-append out "/bin/guile"))) - (mkdir-p (string-append out "/share/guile/" version)) - (copy-recursively (string-append in "/share/guile/" version) - (string-append out "/share/guile/" version)) - - (mkdir-p (string-append out "/lib/guile/" version "/ccache")) - (copy-recursively (string-append in "/lib/guile/" version "/ccache") - (string-append out "/lib/guile/" version "/ccache")) - - (mkdir (string-append out "/bin")) - (copy-file guile1 guile2) - - ;; Verify that the relocated Guile works. - ,@(if (%current-target-system) - '() - '((invoke guile2 "--version"))) - - ;; Strip store references. - (remove-store-references guile2) - - ;; Verify that the stripped Guile works. If it aborts, it could be - ;; that it tries to open iconv descriptors and fails because libc's - ;; iconv data isn't available (see `guile-default-utf8.patch'.) - ,@(if (%current-target-system) - '() - '((invoke guile2 "--version"))) + (list #:allowed-references '("out") + #:modules '((guix build utils)) + #:builder + #~(let ((version #$(version-major+minor (package-version static-guile)))) + (use-modules (guix build utils)) - #t)))) - (inputs `(("guile" ,static-guile))) + (let* ((in #$static-guile) + (out #$output) + (guile1 (string-append in "/bin/guile")) + (guile2 (string-append out "/bin/guile"))) + (mkdir-p (string-append out "/share/guile/" version)) + (copy-recursively (string-append in "/share/guile/" version) + (string-append out "/share/guile/" version)) + + (mkdir-p (string-append out "/lib/guile/" version "/ccache")) + (copy-recursively (string-append in "/lib/guile/" version "/ccache") + (string-append out "/lib/guile/" version "/ccache")) + + (mkdir (string-append out "/bin")) + (copy-file guile1 guile2) + + ;; Verify that the relocated Guile works. + #$@(if (%current-target-system) + '() + '((invoke guile2 "--version"))) + + ;; Strip store references. + (remove-store-references guile2) + + ;; Verify that the stripped Guile works. If it aborts, it could be + ;; that it tries to open iconv descriptors and fails because libc's + ;; iconv data isn't available (see `guile-default-utf8.patch'.) + #$@(if (%current-target-system) + '() + '((invoke guile2 "--version"))))))) (outputs '("out")) (synopsis "Minimal statically-linked and relocatable Guile"))) -- cgit v1.3 From da8be73d5bd85e7fd256a23f94c5f752c796dcac Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 29 Sep 2021 22:20:46 +0200 Subject: gnu: guile-static: Disable JIT on GNU/Hurd. * gnu/packages/make-bootstrap.scm (make-guile-static): Pass "--disable-jit" when targeting GNU/Hurd. --- gnu/packages/make-bootstrap.scm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 2a00ab1d2f9..0014783b4ad 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -699,8 +699,10 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." ;; When `configure' checks for ltdl availability, it ;; doesn't try to link using libtool, and thus fails ;; because of a missing -ldl. Work around that. - ''("LDFLAGS=-ldl" - "--enable-mini-gmp")) + `(list "LDFLAGS=-ldl" "--enable-mini-gmp" + ,@(if (hurd-target?) + '("--disable-jit") + '()))) ((#:phases phases '%standard-phases) `(modify-phases ,phases -- cgit v1.3 From b00fbabdf6e5d472e0ef47d6e927045cf7a3bccc Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 30 Sep 2021 00:03:14 +0200 Subject: gnu: guile: Use 'modify-inputs' where appropriate. * gnu/packages/guile.scm (guile-3.0)[propagated-inputs]: Use 'modify-inputs'. (guile-3.0/libgc-7)[propagated-inputs]: Likewise. (guile-for-guile-emacs)[native-inputs]: Likewise. * gnu/packages/make-bootstrap.scm (make-guile-static): Likewise. --- gnu/packages/guile.scm | 29 +++++++++++++---------------- gnu/packages/make-bootstrap.scm | 9 ++++----- 2 files changed, 17 insertions(+), 21 deletions(-) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm index 5cb7ab23dc5..c1a551f56a5 100644 --- a/gnu/packages/guile.scm +++ b/gnu/packages/guile.scm @@ -63,9 +63,7 @@ #:use-module (guix build-system gnu) #:use-module (guix build-system guile) #:use-module (guix deprecation) - #:use-module (guix utils) - #:use-module (ice-9 match) - #:use-module ((srfi srfi-1) #:prefix srfi-1:)) + #:use-module (guix utils)) ;;; Commentary: ;;; @@ -327,9 +325,8 @@ without requiring the source code to be rewritten.") ;; Build with the bundled mini-GMP to avoid interference with GnuTLS' own ;; use of GMP via Nettle: . (propagated-inputs - (srfi-1:fold srfi-1:alist-delete - (package-propagated-inputs guile-2.2) - '("gmp" "libltdl"))) + (modify-inputs (package-propagated-inputs guile-2.2) + (delete "gmp" "libltdl"))) (arguments (substitute-keyword-arguments (package-arguments guile-2.0) ((#:configure-flags flags ''()) @@ -394,8 +391,8 @@ without requiring the source code to be rewritten.") (package (inherit guile-3.0-latest) (propagated-inputs - `(("bdw-gc" ,libgc-7) - ,@(srfi-1:alist-delete "bdw-gc" (package-propagated-inputs guile-3.0))))))) + (modify-inputs (package-propagated-inputs guile-3.0) + (replace "bdw-gc" libgc-7)))))) (define-public guile-3.0/fixed ;; A package of Guile that's rarely changed. It is the one used in the @@ -596,18 +593,18 @@ GNU@tie{}Guile. Use the @code{(ice-9 readline)} module and call its ;; FAIL: test-out-of-memory (substitute* "test-suite/standalone/Makefile.am" (("(check_SCRIPTS|TESTS) \\+= test-out-of-memory") "")) - + (patch-shebang "build-aux/git-version-gen") (invoke "sh" "autogen.sh") #t)))))) (native-inputs - `(("autoconf" ,autoconf) - ("automake" ,automake) - ("libtool" ,libtool) - ("flex" ,flex) - ("texinfo" ,texinfo) - ("gettext" ,gettext-minimal) - ,@(package-native-inputs guile-2.2)))))) + (modify-inputs (package-native-inputs guile-2.2) + (prepend autoconf + automake + libtool + flex + texinfo + gettext-minimal)))))) ;;; diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 0014783b4ad..267adde48c5 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -686,13 +686,12 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." (outputs (delete "debug" (package-outputs guile))) (inputs - `(("libunistring:static" ,libunistring "static") - ,@(package-inputs guile))) + (modify-inputs (package-inputs guile) + (prepend `(,libunistring "static")))) (propagated-inputs - `(("bdw-gc" ,libgc/static-libs) - ,@(alist-delete "bdw-gc" - (package-propagated-inputs guile)))) + (modify-inputs (package-propagated-inputs guile) + (replace "bdw-gc" libgc/static-libs))) (arguments (substitute-keyword-arguments (package-arguments guile) ((#:configure-flags flags '()) -- cgit v1.3 From 48b754553aeb98660fe145633616a9d965fbd60e Mon Sep 17 00:00:00 2001 From: Pierre Langlois Date: Sat, 27 Nov 2021 01:18:06 +0000 Subject: gnu: glibc-for-bootstrap: Build with GCC 7. Fixes . * gnu/packages/make-bootstrap.scm (glibc-for-bootstrap)[native-inputs]: Add gcc-7. --- gnu/packages/make-bootstrap.scm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gnu/packages/make-bootstrap.scm') diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm index 267adde48c5..4ea97368a99 100644 --- a/gnu/packages/make-bootstrap.scm +++ b/gnu/packages/make-bootstrap.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2018, 2019, 2021 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2019, 2020 Marius Bakke ;;; Copyright © 2020 Mathieu Othacehe +;;; Copyright © 2021 Pierre Langlois ;;; ;;; This file is part of GNU Guix. ;;; @@ -86,6 +87,12 @@ for `sh' in $PATH, and without nscd, and with static NSS modules." "--enable-static-nss" ,flags)))) + ;; Make sure to build glibc with the same compiler version as the rest + ;; of the bootstrap. Otherwise it fails to statically link on aarch64. + (native-inputs + `(("gcc" ,gcc-7) + ,@(package-native-inputs base))) + ;; Remove the 'debug' output to allow bit-reproducible builds (when the ;; 'debug' output is used, ELF files end up with a .gnu_debuglink, which ;; includes a CRC of the corresponding debugging symbols; those symbols -- cgit v1.3