gnu: Add libc-for-target and glibc/hurd.
* gnu/packages/patches/glibc-2.37-hurd-clock_t_centiseconds.patch * gnu/packages/patches/glibc-2.37-hurd-local-clock_gettime_MONOTONIC.patch * gnu/packages/patches/glibc-2.37-versioned-locpath.patch: New patches. * gnu/local.mk (dist_patch_DATA): Register them. * gnu/packages/base.scm (glibc/hurd, libc-for-target): New variables. (glibc/hurd-headers): Use glibc/hurd. * gnu/packages/commencement.scm (glibc-final-with-bootstrap-bash)[outputs, source, arguments] (glibc-final)[source]: Use libc-for-target instead of glibc. * gnu/packages/cross-base.scm (cross-libc/deprecated, cross-libc*): Use libc-for-target. This part fixes https://issues.guix.gnu.org/63641#25 * gnu/packages/commencement.scm (%final-inputs): Change to memoized lambda taking "system". * gnu/packages/commencement.scm (canonical-package): Likewise, and update user, passing (%current-system). (make-gcc-toolchain): Update user, passing (%current-system). * gnu/packages/base.scm (%final-inputs): Likewise. * guix/scripts/refresh.scm (options->update-specs): Likewise. * guix/build-system/gnu.scm (standard-packages): Add optional "system" parameter. (lower): Update caller. Co-authored-by: Ludovic Courtès <ludo@gnu.org> Co-authored-by: Janneke Nieuwenhuizen <janneke@gnu.org>
parent
0613df90dd
commit
0dd293b4d9
|
@ -1260,6 +1260,9 @@ dist_patch_DATA = \
|
||||||
%D%/packages/patches/glibc-hidden-visibility-ldconfig.patch \
|
%D%/packages/patches/glibc-hidden-visibility-ldconfig.patch \
|
||||||
%D%/packages/patches/glibc-hurd-clock_gettime_monotonic.patch \
|
%D%/packages/patches/glibc-hurd-clock_gettime_monotonic.patch \
|
||||||
%D%/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch \
|
%D%/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch \
|
||||||
|
%D%/packages/patches/glibc-2.37-hurd-clock_t_centiseconds.patch \
|
||||||
|
%D%/packages/patches/glibc-2.37-hurd-local-clock_gettime_MONOTONIC.patch \
|
||||||
|
%D%/packages/patches/glibc-2.37-versioned-locpath.patch \
|
||||||
%D%/packages/patches/glibc-hurd-clock_t_centiseconds.patch \
|
%D%/packages/patches/glibc-hurd-clock_t_centiseconds.patch \
|
||||||
%D%/packages/patches/glibc-hurd-gettyent.patch \
|
%D%/packages/patches/glibc-hurd-gettyent.patch \
|
||||||
%D%/packages/patches/glibc-hurd-mach-print.patch \
|
%D%/packages/patches/glibc-hurd-mach-print.patch \
|
||||||
|
|
|
@ -76,6 +76,7 @@
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:export (glibc
|
#:export (glibc
|
||||||
|
libc-for-target
|
||||||
make-ld-wrapper
|
make-ld-wrapper
|
||||||
libiconv-if-needed))
|
libiconv-if-needed))
|
||||||
|
|
||||||
|
@ -1420,20 +1421,41 @@ variety of options. It is an alternative to the shell \"type\" built-in
|
||||||
command.")
|
command.")
|
||||||
(license gpl3+))) ; some files are under GPLv2+
|
(license gpl3+))) ; some files are under GPLv2+
|
||||||
|
|
||||||
|
(define-public glibc/hurd
|
||||||
|
(package/inherit glibc
|
||||||
|
(name "glibc-hurd")
|
||||||
|
(version "2.37")
|
||||||
|
(source (origin
|
||||||
|
(method url-fetch)
|
||||||
|
(uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
|
||||||
|
(sha256
|
||||||
|
(base32
|
||||||
|
"0hqsp4dzrjx0iga6jv0magjw26dh82pxlmk8yis5v0d127qyymr2"))
|
||||||
|
(patches (search-patches "glibc-ldd-powerpc.patch"
|
||||||
|
"glibc-dl-cache.patch"
|
||||||
|
"glibc-2.37-versioned-locpath.patch"
|
||||||
|
"glibc-reinstate-prlimit64-fallback.patch"
|
||||||
|
"glibc-supported-locales.patch"
|
||||||
|
"glibc-2.37-hurd-clock_t_centiseconds.patch"
|
||||||
|
"glibc-2.37-hurd-local-clock_gettime_MONOTONIC.patch"
|
||||||
|
"glibc-hurd-mach-print.patch"
|
||||||
|
"glibc-hurd-gettyent.patch"))))
|
||||||
|
(supported-systems %hurd-systems)))
|
||||||
|
|
||||||
(define-public glibc/hurd-headers
|
(define-public glibc/hurd-headers
|
||||||
(package (inherit glibc)
|
(package/inherit glibc/hurd
|
||||||
(name "glibc-hurd-headers")
|
(name "glibc-hurd-headers")
|
||||||
(outputs '("out"))
|
(outputs '("out"))
|
||||||
(propagated-inputs (list gnumach-headers hurd-headers))
|
(propagated-inputs (list gnumach-headers hurd-headers))
|
||||||
(native-inputs
|
(native-inputs
|
||||||
(modify-inputs (package-native-inputs glibc)
|
(modify-inputs (package-native-inputs glibc/hurd)
|
||||||
(prepend (if (%current-target-system)
|
(prepend (if (%current-target-system)
|
||||||
(let* ((cross-base (resolve-interface '(gnu packages cross-base)))
|
(let* ((cross-base (resolve-interface '(gnu packages cross-base)))
|
||||||
(cross-mig (module-ref cross-base 'cross-mig)))
|
(cross-mig (module-ref cross-base 'cross-mig)))
|
||||||
(cross-mig (%current-target-system)))
|
(cross-mig (%current-target-system)))
|
||||||
mig))))
|
mig))))
|
||||||
(arguments
|
(arguments
|
||||||
(substitute-keyword-arguments (package-arguments glibc)
|
(substitute-keyword-arguments (package-arguments glibc/hurd)
|
||||||
;; We just pass the flags really needed to build the headers.
|
;; We just pass the flags really needed to build the headers.
|
||||||
((#:configure-flags flags)
|
((#:configure-flags flags)
|
||||||
`(list "--enable-add-ons"
|
`(list "--enable-add-ons"
|
||||||
|
@ -1454,6 +1476,15 @@ command.")
|
||||||
(delete 'build))))) ; nothing to build
|
(delete 'build))))) ; nothing to build
|
||||||
(supported-systems %hurd-systems)))
|
(supported-systems %hurd-systems)))
|
||||||
|
|
||||||
|
(define* (libc-for-target #:optional
|
||||||
|
(target (or (%current-target-system)
|
||||||
|
(%current-system))))
|
||||||
|
(match target
|
||||||
|
((? target-hurd?)
|
||||||
|
glibc/hurd)
|
||||||
|
(_
|
||||||
|
glibc)))
|
||||||
|
|
||||||
(define-public tzdata
|
(define-public tzdata
|
||||||
(package
|
(package
|
||||||
(name "tzdata")
|
(name "tzdata")
|
||||||
|
@ -1602,6 +1633,6 @@ package needs iconv ,@(libiconv-if-needed) should be added."
|
||||||
"Return the list of \"final inputs\"."
|
"Return the list of \"final inputs\"."
|
||||||
;; Avoid circular dependency by lazily resolving 'commencement'.
|
;; Avoid circular dependency by lazily resolving 'commencement'.
|
||||||
(let ((iface (resolve-interface '(gnu packages commencement))))
|
(let ((iface (resolve-interface '(gnu packages commencement))))
|
||||||
(module-ref iface '%final-inputs)))
|
((module-ref iface '%final-inputs) (%current-system))))
|
||||||
|
|
||||||
;;; base.scm ends here
|
;;; base.scm ends here
|
||||||
|
|
|
@ -2822,64 +2822,65 @@ memoized as a function of '%current-system'."
|
||||||
("binutils-cross" ,binutils-boot0)
|
("binutils-cross" ,binutils-boot0)
|
||||||
,@(alist-delete "binutils" (%boot0-inputs))))
|
,@(alist-delete "binutils" (%boot0-inputs))))
|
||||||
|
|
||||||
(define glibc-final-with-bootstrap-bash
|
(define/system-dependent glibc-final-with-bootstrap-bash
|
||||||
;; The final libc, "cross-built". If everything went well, the resulting
|
;; The final libc, "cross-built". If everything went well, the resulting
|
||||||
;; store path has no dependencies. Actually, the really-final libc is
|
;; store path has no dependencies. Actually, the really-final libc is
|
||||||
;; built just below; the only difference is that this one uses the
|
;; built just below; the only difference is that this one uses the
|
||||||
;; bootstrap Bash.
|
;; bootstrap Bash.
|
||||||
(package
|
(let ((libc (libc-for-target)))
|
||||||
(inherit glibc)
|
(package
|
||||||
(name "glibc-intermediate")
|
(inherit libc)
|
||||||
(outputs (delete "debug" (package-outputs glibc)))
|
(name "glibc-intermediate")
|
||||||
(source (bootstrap-origin (package-source glibc)))
|
(outputs (delete "debug" (package-outputs libc)))
|
||||||
(arguments
|
(source (bootstrap-origin (package-source libc)))
|
||||||
`(#:guile ,%bootstrap-guile
|
(arguments
|
||||||
#:implicit-inputs? #f
|
`(#:guile ,%bootstrap-guile
|
||||||
|
#:implicit-inputs? #f
|
||||||
|
|
||||||
,@(substitute-keyword-arguments (package-arguments glibc)
|
,@(substitute-keyword-arguments (package-arguments libc)
|
||||||
((#:configure-flags flags)
|
((#:configure-flags flags)
|
||||||
`(append (list ,(string-append "--host=" (boot-triplet))
|
`(append (list ,(string-append "--host=" (boot-triplet))
|
||||||
,(string-append "--build="
|
,(string-append "--build="
|
||||||
(nix-system->gnu-triplet))
|
(nix-system->gnu-triplet))
|
||||||
,(if (system-hurd?) "--disable-werror"
|
,(if (system-hurd?) "--disable-werror"
|
||||||
""))
|
""))
|
||||||
,flags))
|
,flags))
|
||||||
((#:phases phases)
|
((#:phases phases)
|
||||||
`(modify-phases ,phases
|
`(modify-phases ,phases
|
||||||
(add-before 'configure 'pre-configure
|
(add-before 'configure 'pre-configure
|
||||||
(lambda* (#:key inputs #:allow-other-keys)
|
(lambda* (#:key inputs #:allow-other-keys)
|
||||||
;; Don't clobber include paths with the bootstrap libc.
|
;; Don't clobber include paths with the bootstrap libc.
|
||||||
(unsetenv "C_INCLUDE_PATH")
|
(unsetenv "C_INCLUDE_PATH")
|
||||||
(unsetenv "CPLUS_INCLUDE_PATH")
|
(unsetenv "CPLUS_INCLUDE_PATH")
|
||||||
|
|
||||||
;; Tell 'libpthread' where to find 'libihash' on Hurd systems.
|
;; Tell 'libpthread' where to find 'libihash' on Hurd systems.
|
||||||
,@(if (system-hurd?)
|
,@(if (system-hurd?)
|
||||||
'((substitute* '("sysdeps/mach/Makefile"
|
'((substitute* '("sysdeps/mach/Makefile"
|
||||||
"sysdeps/mach/hurd/Makefile")
|
"sysdeps/mach/hurd/Makefile")
|
||||||
(("LDLIBS-pthread.so =.*")
|
(("LDLIBS-pthread.so =.*")
|
||||||
(string-append "LDLIBS-pthread.so = "
|
(string-append "LDLIBS-pthread.so = "
|
||||||
(assoc-ref %build-inputs "kernel-headers")
|
(assoc-ref %build-inputs "kernel-headers")
|
||||||
"/lib/libihash.a\n"))))
|
"/lib/libihash.a\n"))))
|
||||||
'()))))))))
|
'()))))))))
|
||||||
(propagated-inputs `(("kernel-headers" ,(kernel-headers-boot0))))
|
(propagated-inputs `(("kernel-headers" ,(kernel-headers-boot0))))
|
||||||
(native-inputs
|
(native-inputs
|
||||||
`(("bison" ,bison-boot0)
|
`(("bison" ,bison-boot0)
|
||||||
("texinfo" ,texinfo-boot0)
|
("texinfo" ,texinfo-boot0)
|
||||||
("perl" ,perl-boot0)
|
("perl" ,perl-boot0)
|
||||||
("python" ,python-boot0)))
|
("python" ,python-boot0)))
|
||||||
(inputs
|
(inputs
|
||||||
`( ;; The boot inputs. That includes the bootstrap libc. We don't want
|
`( ;; The boot inputs. That includes the bootstrap libc. We don't want
|
||||||
;; it in $CPATH, hence the 'pre-configure' phase above.
|
;; it in $CPATH, hence the 'pre-configure' phase above.
|
||||||
,@(%boot1-inputs)
|
,@(%boot1-inputs)
|
||||||
|
|
||||||
;; A native MiG is needed to build Glibc on Hurd.
|
;; A native MiG is needed to build Glibc on Hurd.
|
||||||
,@(if (system-hurd?)
|
,@(if (system-hurd?)
|
||||||
`(("mig" ,mig-boot0))
|
`(("mig" ,mig-boot0))
|
||||||
'())
|
'())
|
||||||
|
|
||||||
;; Here, we use the bootstrap Bash, which is not satisfactory
|
;; Here, we use the bootstrap Bash, which is not satisfactory
|
||||||
;; because we don't want to depend on bootstrap tools.
|
;; because we don't want to depend on bootstrap tools.
|
||||||
("static-bash" ,@(assoc-ref (%boot0-inputs) "bash"))))))
|
("static-bash" ,@(assoc-ref (%boot0-inputs) "bash")))))))
|
||||||
|
|
||||||
(define (cross-gcc-wrapper gcc binutils glibc bash)
|
(define (cross-gcc-wrapper gcc binutils glibc bash)
|
||||||
"Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC
|
"Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC
|
||||||
|
@ -2997,39 +2998,39 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
|
||||||
(("^PROGRAMS =.*$")
|
(("^PROGRAMS =.*$")
|
||||||
"PROGRAMS =\n")))))))))
|
"PROGRAMS =\n")))))))))
|
||||||
|
|
||||||
(define glibc-final
|
(define/system-dependent glibc-final
|
||||||
;; The final glibc, which embeds the statically-linked Bash built above.
|
;; The final glibc, which embeds the statically-linked Bash built above.
|
||||||
;; Use 'package/inherit' so we get the 'replacement' of 'glibc', if any.
|
;; Use 'package/inherit' so we get the 'replacement' of 'glibc', if any.
|
||||||
(package/inherit
|
(let ((libc (libc-for-target)))
|
||||||
glibc
|
(package/inherit libc
|
||||||
(name "glibc")
|
(name "glibc")
|
||||||
(source (bootstrap-origin (package-source glibc)))
|
(source (bootstrap-origin (package-source libc)))
|
||||||
(inputs `(("static-bash" ,static-bash-for-glibc)
|
(inputs `(("static-bash" ,static-bash-for-glibc)
|
||||||
,@(alist-delete
|
,@(alist-delete
|
||||||
"static-bash"
|
"static-bash"
|
||||||
(package-inputs glibc-final-with-bootstrap-bash))))
|
(package-inputs glibc-final-with-bootstrap-bash))))
|
||||||
|
|
||||||
;; This time we need 'msgfmt' to install all the libc.mo files.
|
;; This time we need 'msgfmt' to install all the libc.mo files.
|
||||||
(native-inputs `(,@(package-native-inputs glibc-final-with-bootstrap-bash)
|
(native-inputs `(,@(package-native-inputs glibc-final-with-bootstrap-bash)
|
||||||
("gettext" ,gettext-boot0)))
|
("gettext" ,gettext-boot0)))
|
||||||
|
|
||||||
(propagated-inputs
|
(propagated-inputs
|
||||||
(package-propagated-inputs glibc-final-with-bootstrap-bash))
|
(package-propagated-inputs glibc-final-with-bootstrap-bash))
|
||||||
|
|
||||||
;; The final libc only refers to itself, but the 'debug' output contains
|
;; The final libc only refers to itself, but the 'debug' output contains
|
||||||
;; references to GCC-BOOT0 and to the Linux headers. XXX: Would be great
|
;; references to GCC-BOOT0 and to the Linux headers. XXX: Would be great
|
||||||
;; if 'allowed-references' were per-output.
|
;; if 'allowed-references' were per-output.
|
||||||
(arguments
|
(arguments
|
||||||
`(#:allowed-references
|
`(#:allowed-references
|
||||||
(,(gexp-input gcc-boot0 "lib")
|
(,(gexp-input gcc-boot0 "lib")
|
||||||
,(kernel-headers-boot0)
|
,(kernel-headers-boot0)
|
||||||
,static-bash-for-glibc
|
,static-bash-for-glibc
|
||||||
,@(if (system-hurd?)
|
,@(if (system-hurd?)
|
||||||
`(,gnumach-headers-boot0
|
`(,gnumach-headers-boot0
|
||||||
,hurd-headers-boot0)
|
,hurd-headers-boot0)
|
||||||
'())
|
'())
|
||||||
,@(package-outputs glibc-final-with-bootstrap-bash))
|
,@(package-outputs glibc-final-with-bootstrap-bash))
|
||||||
,@(package-arguments glibc-final-with-bootstrap-bash)))))
|
,@(package-arguments glibc-final-with-bootstrap-bash))))))
|
||||||
|
|
||||||
(define/system-dependent gcc-boot0-wrapped
|
(define/system-dependent gcc-boot0-wrapped
|
||||||
;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
|
;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
|
||||||
|
@ -3356,45 +3357,49 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
|
||||||
(package/inherit sed (native-inputs `(("perl" ,perl-boot0))))))
|
(package/inherit sed (native-inputs `(("perl" ,perl-boot0))))))
|
||||||
|
|
||||||
(define-public %final-inputs
|
(define-public %final-inputs
|
||||||
;; Final derivations used as implicit inputs by 'gnu-build-system'. We
|
;; The 'glibc-final' package is not the same depending on what system is
|
||||||
;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are
|
;; targeted, so this whole list must be parameterized.
|
||||||
;; used for origins that have patches, thereby avoiding circular
|
(mlambda (system)
|
||||||
;; dependencies.
|
;; Final derivations used as implicit inputs by 'gnu-build-system'. We
|
||||||
(let ((finalize (compose with-boot6
|
;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are
|
||||||
package-with-bootstrap-guile)))
|
;; used for origins that have patches, thereby avoiding circular
|
||||||
`(,@(map (match-lambda
|
;; dependencies.
|
||||||
((name package)
|
(let ((finalize (compose with-boot6
|
||||||
(list name (finalize package))))
|
package-with-bootstrap-guile)))
|
||||||
`(("tar" ,tar)
|
`(,@(map (match-lambda
|
||||||
("gzip" ,gzip)
|
((name package)
|
||||||
("bzip2" ,bzip2)
|
(list name (finalize package))))
|
||||||
("file" ,file)
|
`(("tar" ,tar)
|
||||||
("diffutils" ,diffutils)
|
("gzip" ,gzip)
|
||||||
("patch" ,patch)
|
("bzip2" ,bzip2)
|
||||||
("findutils" ,findutils)
|
("file" ,file)
|
||||||
("gawk" ,gawk)))
|
("diffutils" ,diffutils)
|
||||||
("sed" ,sed-final)
|
("patch" ,patch)
|
||||||
("grep" ,grep-final)
|
("findutils" ,findutils)
|
||||||
("xz" ,xz-final)
|
("gawk" ,gawk)))
|
||||||
("coreutils" ,coreutils-final)
|
("sed" ,sed-final)
|
||||||
("make" ,gnu-make-final)
|
("grep" ,grep-final)
|
||||||
("bash" ,bash-final)
|
("xz" ,xz-final)
|
||||||
("ld-wrapper" ,ld-wrapper)
|
("coreutils" ,coreutils-final)
|
||||||
("binutils" ,binutils-final)
|
("make" ,gnu-make-final)
|
||||||
("gcc" ,gcc-final)
|
("bash" ,bash-final)
|
||||||
("libc" ,glibc-final)
|
("ld-wrapper" ,ld-wrapper)
|
||||||
("libc:static" ,glibc-final "static")
|
("binutils" ,binutils-final)
|
||||||
("locales" ,glibc-utf8-locales-final))))
|
("gcc" ,gcc-final)
|
||||||
|
("libc" ,glibc-final)
|
||||||
|
("libc:static" ,glibc-final "static")
|
||||||
|
("locales" ,glibc-utf8-locales-final)))))
|
||||||
|
|
||||||
(define-public canonical-package
|
(define-public canonical-package
|
||||||
(let ((name->package (fold (lambda (input result)
|
(let ((name->package (mlambda (system)
|
||||||
(match input
|
(fold (lambda (input result)
|
||||||
((_ package . outputs)
|
(match input
|
||||||
(vhash-cons (package-full-name package)
|
((_ package . outputs)
|
||||||
package result))))
|
(vhash-cons (package-full-name package)
|
||||||
vlist-null
|
package result))))
|
||||||
`(("guile" ,guile-final)
|
vlist-null
|
||||||
,@%final-inputs))))
|
`(("guile" ,guile-final)
|
||||||
|
,@(%final-inputs system))))))
|
||||||
(lambda (package)
|
(lambda (package)
|
||||||
"Return the 'canonical' variant of PACKAGE---i.e., if PACKAGE is one of
|
"Return the 'canonical' variant of PACKAGE---i.e., if PACKAGE is one of
|
||||||
the implicit inputs of 'gnu-build-system', return that one, otherwise return
|
the implicit inputs of 'gnu-build-system', return that one, otherwise return
|
||||||
|
@ -3404,7 +3409,8 @@ The goal is to avoid duplication in cases like GUILE-FINAL vs. GUILE-2.2,
|
||||||
COREUTILS-FINAL vs. COREUTILS, etc."
|
COREUTILS-FINAL vs. COREUTILS, etc."
|
||||||
;; XXX: This doesn't handle dependencies of the final inputs, such as
|
;; XXX: This doesn't handle dependencies of the final inputs, such as
|
||||||
;; libunistring, GMP, etc.
|
;; libunistring, GMP, etc.
|
||||||
(match (vhash-assoc (package-full-name package) name->package)
|
(match (vhash-assoc (package-full-name package)
|
||||||
|
(name->package (%current-system)))
|
||||||
((_ . canon)
|
((_ . canon)
|
||||||
;; In general we want CANON, except if we're cross-compiling: CANON
|
;; In general we want CANON, except if we're cross-compiling: CANON
|
||||||
;; uses explicit inputs, so it is "anchored" in the bootstrapped
|
;; uses explicit inputs, so it is "anchored" in the bootstrapped
|
||||||
|
@ -3486,7 +3492,8 @@ is the GNU Compiler Collection.")
|
||||||
;; install everything that we need, and (2) to make sure ld-wrapper comes
|
;; install everything that we need, and (2) to make sure ld-wrapper comes
|
||||||
;; before Binutils' ld in the user's profile.
|
;; before Binutils' ld in the user's profile.
|
||||||
(inputs `(("gcc" ,gcc)
|
(inputs `(("gcc" ,gcc)
|
||||||
("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper")))
|
("ld-wrapper" ,(car (assoc-ref (%final-inputs (%current-system))
|
||||||
|
"ld-wrapper")))
|
||||||
("binutils" ,binutils-final)
|
("binutils" ,binutils-final)
|
||||||
("libc" ,libc)
|
("libc" ,libc)
|
||||||
("libc-debug" ,libc "debug")
|
("libc-debug" ,libc "debug")
|
||||||
|
|
|
@ -578,7 +578,7 @@ the base compiler. Use XBINUTILS as the associated cross-Binutils."
|
||||||
|
|
||||||
(define* (cross-libc/deprecated target
|
(define* (cross-libc/deprecated target
|
||||||
#:optional
|
#:optional
|
||||||
(libc glibc)
|
(libc (libc-for-target target))
|
||||||
(xgcc (cross-gcc target))
|
(xgcc (cross-gcc target))
|
||||||
(xbinutils (cross-binutils target))
|
(xbinutils (cross-binutils target))
|
||||||
(xheaders (cross-kernel-headers target)))
|
(xheaders (cross-kernel-headers target)))
|
||||||
|
@ -591,7 +591,7 @@ the base compiler. Use XBINUTILS as the associated cross-Binutils."
|
||||||
|
|
||||||
(define* (cross-libc* target
|
(define* (cross-libc* target
|
||||||
#:key
|
#:key
|
||||||
(libc glibc)
|
(libc (libc-for-target target))
|
||||||
(xgcc (cross-gcc target))
|
(xgcc (cross-gcc target))
|
||||||
(xbinutils (cross-binutils target))
|
(xbinutils (cross-binutils target))
|
||||||
(xheaders (cross-kernel-headers target)))
|
(xheaders (cross-kernel-headers target)))
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
Taken from: https://salsa.debian.org/glibc-team/glibc/-/blob/9ce19663f00176f30d6eab29fd14db3e7cd53dcf/debian/patches/hurd-i386/unsubmitted-clock_t_centiseconds.diff
|
||||||
|
|
||||||
|
Some applications assume centisecond precision, or at most millisecond precision
|
||||||
|
(e.g. guile). This is a work-around for them.
|
||||||
|
|
||||||
|
---
|
||||||
|
getclktck.c | 5 ++---
|
||||||
|
setitimer.c | 2 +-
|
||||||
|
times.c | 2 +-
|
||||||
|
4 files changed, 8 insertions(+), 9 deletions(-)
|
||||||
|
commit d57f2f9b4bd007846af2fb4217486ea572579010
|
||||||
|
Author: Richard Braun <rbraun@sceen.net>
|
||||||
|
Date: Tue Aug 27 11:35:31 2013 +0200
|
||||||
|
|
||||||
|
Express CPU time (clock_t of times(2)) in centiseconds
|
||||||
|
|
||||||
|
diff --git a/sysdeps/mach/hurd/getclktck.c b/sysdeps/mach/hurd/getclktck.c
|
||||||
|
index 69be2cc..5f7d946 100644
|
||||||
|
--- a/sysdeps/mach/hurd/getclktck.c
|
||||||
|
+++ b/sysdeps/mach/hurd/getclktck.c
|
||||||
|
@@ -18,12 +18,11 @@
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
-/* Return frequency of `times'.
|
||||||
|
- Since Mach reports CPU times in microseconds, we always use 1 million. */
|
||||||
|
+/* Return frequency of `times'. */
|
||||||
|
int
|
||||||
|
__getclktck (void)
|
||||||
|
{
|
||||||
|
- return 1000000;
|
||||||
|
+ return 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Before glibc 2.2, the Hurd actually did this differently, so we
|
||||||
|
diff --git a/sysdeps/mach/hurd/setitimer.c b/sysdeps/mach/hurd/setitimer.c
|
||||||
|
index 39b6b16..4992c89 100644
|
||||||
|
--- a/sysdeps/mach/hurd/setitimer.c
|
||||||
|
+++ b/sysdeps/mach/hurd/setitimer.c
|
||||||
|
@@ -42,7 +42,7 @@ quantize_timeval (struct timeval *tv)
|
||||||
|
static time_t quantum = -1;
|
||||||
|
|
||||||
|
if (quantum == -1)
|
||||||
|
- quantum = 1000000 / __getclktck ();
|
||||||
|
+ quantum = 100 / __getclktck ();
|
||||||
|
|
||||||
|
tv->tv_usec = ((tv->tv_usec + (quantum - 1)) / quantum) * quantum;
|
||||||
|
if (tv->tv_usec >= 1000000)
|
||||||
|
diff --git a/sysdeps/mach/hurd/times.c b/sysdeps/mach/hurd/times.c
|
||||||
|
index 9e13a75..593c33a 100644
|
||||||
|
--- a/sysdeps/mach/hurd/times.c
|
||||||
|
+++ b/sysdeps/mach/hurd/times.c
|
||||||
|
@@ -29,7 +29,7 @@
|
||||||
|
static inline clock_t
|
||||||
|
clock_from_time_value (const time_value_t *t)
|
||||||
|
{
|
||||||
|
- return t->seconds * 1000000 + t->microseconds;
|
||||||
|
+ return t->seconds * 100 + t->microseconds / 10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Store the CPU time used by this process and all its
|
|
@ -0,0 +1,135 @@
|
||||||
|
Taken from: https://salsa.debian.org/glibc-team/glibc/-/blob/9ce19663f00176f30d6eab29fd14db3e7cd53dcf/debian/patches/hurd-i386/local-clock_gettime_MONOTONIC.diff
|
||||||
|
|
||||||
|
Use the realtime clock for the monotonic clock. This is of course not a proper
|
||||||
|
implementation (which is being done in Mach), but will permit to fix at least
|
||||||
|
the iceweasel stack.
|
||||||
|
|
||||||
|
vlc however doesn't build when _POSIX_CLOCK_SELECTION is enabled but
|
||||||
|
_POSIX_TIMERS is not, and they refuse to fix that (see #765578), so disable the
|
||||||
|
former.
|
||||||
|
|
||||||
|
---
|
||||||
|
sysdeps/mach/hurd/bits/posix_opt.h | 2 +-
|
||||||
|
sysdeps/unix/clock_gettime.c | 1 +
|
||||||
|
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
Index: glibc-2.27/sysdeps/mach/clock_gettime.c
|
||||||
|
===================================================================
|
||||||
|
--- glibc-2.27.orig/sysdeps/mach/clock_gettime.c
|
||||||
|
+++ glibc-2.27/sysdeps/mach/clock_gettime.c
|
||||||
|
@@ -31,6 +31,10 @@ __clock_gettime (clockid_t clock_id, str
|
||||||
|
switch (clock_id) {
|
||||||
|
|
||||||
|
case CLOCK_REALTIME:
|
||||||
|
+ case CLOCK_MONOTONIC:
|
||||||
|
+ case CLOCK_MONOTONIC_RAW:
|
||||||
|
+ case CLOCK_REALTIME_COARSE:
|
||||||
|
+ case CLOCK_MONOTONIC_COARSE:
|
||||||
|
{
|
||||||
|
/* __host_get_time can only fail if passed an invalid host_t.
|
||||||
|
__mach_host_self could theoretically fail (producing an
|
||||||
|
Index: glibc-2.27/rt/timer_create.c
|
||||||
|
===================================================================
|
||||||
|
--- glibc-2.27.orig/rt/timer_create.c
|
||||||
|
+++ glibc-2.27/rt/timer_create.c
|
||||||
|
@@ -48,7 +48,7 @@ timer_create (clockid_t clock_id, struct
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (clock_id != CLOCK_REALTIME)
|
||||||
|
+ if (clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC && clock_id != CLOCK_MONOTONIC_RAW && clock_id != CLOCK_REALTIME_COARSE && clock_id != CLOCK_MONOTONIC_COARSE)
|
||||||
|
{
|
||||||
|
__set_errno (EINVAL);
|
||||||
|
return -1;
|
||||||
|
Index: glibc-2.27/sysdeps/mach/hurd/bits/posix_opt.h
|
||||||
|
===================================================================
|
||||||
|
--- glibc-2.27.orig/sysdeps/mach/hurd/bits/posix_opt.h
|
||||||
|
+++ glibc-2.27/sysdeps/mach/hurd/bits/posix_opt.h
|
||||||
|
@@ -163,10 +163,10 @@
|
||||||
|
#define _POSIX_THREAD_PROCESS_SHARED -1
|
||||||
|
|
||||||
|
/* The monotonic clock might be available. */
|
||||||
|
-#define _POSIX_MONOTONIC_CLOCK 0
|
||||||
|
+#define _POSIX_MONOTONIC_CLOCK 200809L
|
||||||
|
|
||||||
|
-/* The clock selection interfaces are available. */
|
||||||
|
-#define _POSIX_CLOCK_SELECTION 200809L
|
||||||
|
+/* The clock selection interfaces are not really available yet. */
|
||||||
|
+#define _POSIX_CLOCK_SELECTION -1
|
||||||
|
|
||||||
|
/* Advisory information interfaces could be available in future. */
|
||||||
|
#define _POSIX_ADVISORY_INFO 0
|
||||||
|
Index: glibc-upstream/sysdeps/posix/clock_getres.c
|
||||||
|
===================================================================
|
||||||
|
--- glibc-upstream.orig/sysdeps/posix/clock_getres.c
|
||||||
|
+++ glibc-upstream/sysdeps/posix/clock_getres.c
|
||||||
|
@@ -52,6 +52,10 @@ __clock_getres (clockid_t clock_id, stru
|
||||||
|
switch (clock_id)
|
||||||
|
{
|
||||||
|
case CLOCK_REALTIME:
|
||||||
|
+ case CLOCK_MONOTONIC:
|
||||||
|
+ case CLOCK_MONOTONIC_RAW:
|
||||||
|
+ case CLOCK_REALTIME_COARSE:
|
||||||
|
+ case CLOCK_MONOTONIC_COARSE:
|
||||||
|
retval = realtime_getres (res);
|
||||||
|
break;
|
||||||
|
|
||||||
|
--- ./sysdeps/mach/clock_nanosleep.c.original 2020-07-21 00:31:35.226113142 +0200
|
||||||
|
+++ ./sysdeps/mach/clock_nanosleep.c 2020-07-21 00:31:49.026185761 +0200
|
||||||
|
@@ -62,7 +62,7 @@
|
||||||
|
__clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
|
||||||
|
struct timespec *rem)
|
||||||
|
{
|
||||||
|
- if (clock_id != CLOCK_REALTIME
|
||||||
|
+ if ((clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC && clock_id != CLOCK_MONOTONIC_RAW && clock_id != CLOCK_REALTIME_COARSE && clock_id != CLOCK_MONOTONIC_COARSE)
|
||||||
|
|| !valid_nanoseconds (req->tv_nsec)
|
||||||
|
|| (flags != 0 && flags != TIMER_ABSTIME))
|
||||||
|
return EINVAL;
|
||||||
|
Index: glibc-2.32/hurd/hurdlock.c
|
||||||
|
===================================================================
|
||||||
|
--- glibc-2.32.orig/hurd/hurdlock.c
|
||||||
|
+++ glibc-2.32/hurd/hurdlock.c
|
||||||
|
@@ -47,7 +47,7 @@ int
|
||||||
|
__lll_abstimed_wait (void *ptr, int val,
|
||||||
|
const struct timespec *tsp, int flags, int clk)
|
||||||
|
{
|
||||||
|
- if (clk != CLOCK_REALTIME)
|
||||||
|
+ if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC)
|
||||||
|
return EINVAL;
|
||||||
|
|
||||||
|
int mlsec = compute_reltime (tsp, clk);
|
||||||
|
@@ -59,7 +59,7 @@ int
|
||||||
|
__lll_abstimed_wait_intr (void *ptr, int val,
|
||||||
|
const struct timespec *tsp, int flags, int clk)
|
||||||
|
{
|
||||||
|
- if (clk != CLOCK_REALTIME)
|
||||||
|
+ if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC)
|
||||||
|
return EINVAL;
|
||||||
|
|
||||||
|
int mlsec = compute_reltime (tsp, clk);
|
||||||
|
@@ -79,7 +79,7 @@ int
|
||||||
|
__lll_abstimed_xwait (void *ptr, int lo, int hi,
|
||||||
|
const struct timespec *tsp, int flags, int clk)
|
||||||
|
{
|
||||||
|
- if (clk != CLOCK_REALTIME)
|
||||||
|
+ if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC)
|
||||||
|
return EINVAL;
|
||||||
|
|
||||||
|
int mlsec = compute_reltime (tsp, clk);
|
||||||
|
@@ -91,7 +91,7 @@ int
|
||||||
|
__lll_abstimed_lock (void *ptr,
|
||||||
|
const struct timespec *tsp, int flags, int clk)
|
||||||
|
{
|
||||||
|
- if (clk != CLOCK_REALTIME)
|
||||||
|
+ if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC)
|
||||||
|
return EINVAL;
|
||||||
|
|
||||||
|
if (__lll_trylock (ptr) == 0)
|
||||||
|
@@ -177,7 +177,7 @@ __lll_robust_abstimed_lock (void *ptr,
|
||||||
|
int wait_time = 25;
|
||||||
|
unsigned int val;
|
||||||
|
|
||||||
|
- if (clk != CLOCK_REALTIME)
|
||||||
|
+ if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC)
|
||||||
|
return EINVAL;
|
||||||
|
|
||||||
|
while (1)
|
|
@ -0,0 +1,264 @@
|
||||||
|
From d73ba2caa10b8e9f51ff4239cc32eeb4e0de4279 Mon Sep 17 00:00:00 2001
|
||||||
|
Message-Id: <d73ba2caa10b8e9f51ff4239cc32eeb4e0de4279.1683980025.git.dev@jpoiret.xyz>
|
||||||
|
From: Josselin Poiret <dev@jpoiret.xyz>
|
||||||
|
Date: Sat, 13 May 2023 14:10:43 +0200
|
||||||
|
Subject: [PATCH] Add versioned locpath
|
||||||
|
|
||||||
|
From: Josselin Poiret <dev@jpoiret.xyz>
|
||||||
|
|
||||||
|
The format of locale data can be incompatible between libc versions, and
|
||||||
|
loading incompatible data can lead to 'setlocale' returning EINVAL at best
|
||||||
|
or triggering an assertion failure at worst. See
|
||||||
|
https://lists.gnu.org/archive/html/guix-devel/2015-09/msg00717.html
|
||||||
|
for background information.
|
||||||
|
|
||||||
|
To address that, this patch changes libc to honor a new 'GUIX_LOCPATH'
|
||||||
|
variable, and to look for locale data in version-specific sub-directories of
|
||||||
|
that variable. So, if GUIX_LOCPATH=/foo:/bar, locale data is searched for in
|
||||||
|
/foo/X.Y and /bar/X.Y, where X.Y is the libc version number.
|
||||||
|
|
||||||
|
That way, a single 'GUIX_LOCPATH' setting can work even if different libc
|
||||||
|
versions coexist on the system.
|
||||||
|
|
||||||
|
|
||||||
|
This patch is adapted from the 2.35 patch.
|
||||||
|
|
||||||
|
---
|
||||||
|
locale/newlocale.c | 15 ++--------
|
||||||
|
locale/setlocale.c | 68 +++++++++++++++++++++++++++++++++++++-------
|
||||||
|
string/Makefile | 1 +
|
||||||
|
string/argz-suffix.c | 56 ++++++++++++++++++++++++++++++++++++
|
||||||
|
string/argz.h | 10 +++++++
|
||||||
|
5 files changed, 127 insertions(+), 23 deletions(-)
|
||||||
|
create mode 100644 string/argz-suffix.c
|
||||||
|
|
||||||
|
diff --git a/locale/newlocale.c b/locale/newlocale.c
|
||||||
|
index 108d2428bf..6218e0fa77 100644
|
||||||
|
--- a/locale/newlocale.c
|
||||||
|
+++ b/locale/newlocale.c
|
||||||
|
@@ -29,6 +29,7 @@
|
||||||
|
/* Lock for protecting global data. */
|
||||||
|
__libc_rwlock_define (extern , __libc_setlocale_lock attribute_hidden)
|
||||||
|
|
||||||
|
+extern error_t compute_locale_search_path (char **, size_t *);
|
||||||
|
|
||||||
|
/* Use this when we come along an error. */
|
||||||
|
#define ERROR_RETURN \
|
||||||
|
@@ -47,7 +48,6 @@ __newlocale (int category_mask, const char *locale, locale_t base)
|
||||||
|
locale_t result_ptr;
|
||||||
|
char *locale_path;
|
||||||
|
size_t locale_path_len;
|
||||||
|
- const char *locpath_var;
|
||||||
|
int cnt;
|
||||||
|
size_t names_len;
|
||||||
|
|
||||||
|
@@ -101,17 +101,8 @@ __newlocale (int category_mask, const char *locale, locale_t base)
|
||||||
|
locale_path = NULL;
|
||||||
|
locale_path_len = 0;
|
||||||
|
|
||||||
|
- locpath_var = getenv ("LOCPATH");
|
||||||
|
- if (locpath_var != NULL && locpath_var[0] != '\0')
|
||||||
|
- {
|
||||||
|
- if (__argz_create_sep (locpath_var, ':',
|
||||||
|
- &locale_path, &locale_path_len) != 0)
|
||||||
|
- return NULL;
|
||||||
|
-
|
||||||
|
- if (__argz_add_sep (&locale_path, &locale_path_len,
|
||||||
|
- _nl_default_locale_path, ':') != 0)
|
||||||
|
- return NULL;
|
||||||
|
- }
|
||||||
|
+ if (compute_locale_search_path (&locale_path, &locale_path_len) != 0)
|
||||||
|
+ return NULL;
|
||||||
|
|
||||||
|
/* Get the names for the locales we are interested in. We either
|
||||||
|
allow a composite name or a single name. */
|
||||||
|
diff --git a/locale/setlocale.c b/locale/setlocale.c
|
||||||
|
index dd73fa4248..d8eb799384 100644
|
||||||
|
--- a/locale/setlocale.c
|
||||||
|
+++ b/locale/setlocale.c
|
||||||
|
@@ -213,12 +213,65 @@ setdata (int category, struct __locale_data *data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* Return in *LOCALE_PATH and *LOCALE_PATH_LEN the locale data search path as
|
||||||
|
+ a colon-separated list. Return ENOMEN on error, zero otherwise. */
|
||||||
|
+error_t
|
||||||
|
+compute_locale_search_path (char **locale_path, size_t *locale_path_len)
|
||||||
|
+{
|
||||||
|
+ char* guix_locpath_var = getenv ("GUIX_LOCPATH");
|
||||||
|
+ char *locpath_var = getenv ("LOCPATH");
|
||||||
|
+
|
||||||
|
+ if (guix_locpath_var != NULL && guix_locpath_var[0] != '\0')
|
||||||
|
+ {
|
||||||
|
+ /* Entries in 'GUIX_LOCPATH' take precedence over 'LOCPATH'. These
|
||||||
|
+ entries are systematically prefixed with "/X.Y" where "X.Y" is the
|
||||||
|
+ libc version. */
|
||||||
|
+ if (__argz_create_sep (guix_locpath_var, ':',
|
||||||
|
+ locale_path, locale_path_len) != 0
|
||||||
|
+ || __argz_suffix_entries (locale_path, locale_path_len,
|
||||||
|
+ "/" VERSION) != 0)
|
||||||
|
+ goto bail_out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (locpath_var != NULL && locpath_var[0] != '\0')
|
||||||
|
+ {
|
||||||
|
+ char *reg_locale_path = NULL;
|
||||||
|
+ size_t reg_locale_path_len = 0;
|
||||||
|
+
|
||||||
|
+ if (__argz_create_sep (locpath_var, ':',
|
||||||
|
+ ®_locale_path, ®_locale_path_len) != 0)
|
||||||
|
+ goto bail_out;
|
||||||
|
+
|
||||||
|
+ if (__argz_append (locale_path, locale_path_len,
|
||||||
|
+ reg_locale_path, reg_locale_path_len) != 0)
|
||||||
|
+ goto bail_out;
|
||||||
|
+
|
||||||
|
+ free (reg_locale_path);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (*locale_path != NULL)
|
||||||
|
+ {
|
||||||
|
+ /* Append the system default locale directory. */
|
||||||
|
+ if (__argz_add_sep (locale_path, locale_path_len,
|
||||||
|
+ _nl_default_locale_path, ':') != 0)
|
||||||
|
+ goto bail_out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ bail_out:
|
||||||
|
+ free (*locale_path);
|
||||||
|
+ *locale_path = NULL;
|
||||||
|
+ *locale_path_len = 0;
|
||||||
|
+
|
||||||
|
+ return ENOMEM;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
char *
|
||||||
|
setlocale (int category, const char *locale)
|
||||||
|
{
|
||||||
|
char *locale_path;
|
||||||
|
size_t locale_path_len;
|
||||||
|
- const char *locpath_var;
|
||||||
|
char *composite;
|
||||||
|
|
||||||
|
/* Sanity check for CATEGORY argument. */
|
||||||
|
@@ -249,17 +302,10 @@ setlocale (int category, const char *locale)
|
||||||
|
locale_path = NULL;
|
||||||
|
locale_path_len = 0;
|
||||||
|
|
||||||
|
- locpath_var = getenv ("LOCPATH");
|
||||||
|
- if (locpath_var != NULL && locpath_var[0] != '\0')
|
||||||
|
+ if (compute_locale_search_path (&locale_path, &locale_path_len) != 0)
|
||||||
|
{
|
||||||
|
- if (__argz_create_sep (locpath_var, ':',
|
||||||
|
- &locale_path, &locale_path_len) != 0
|
||||||
|
- || __argz_add_sep (&locale_path, &locale_path_len,
|
||||||
|
- _nl_default_locale_path, ':') != 0)
|
||||||
|
- {
|
||||||
|
- __libc_rwlock_unlock (__libc_setlocale_lock);
|
||||||
|
- return NULL;
|
||||||
|
- }
|
||||||
|
+ __libc_rwlock_unlock (__libc_setlocale_lock);
|
||||||
|
+ return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (category == LC_ALL)
|
||||||
|
diff --git a/string/Makefile b/string/Makefile
|
||||||
|
index 3eced0d027..a7e68729ad 100644
|
||||||
|
--- a/string/Makefile
|
||||||
|
+++ b/string/Makefile
|
||||||
|
@@ -51,6 +51,7 @@ routines := \
|
||||||
|
argz-next \
|
||||||
|
argz-replace \
|
||||||
|
argz-stringify \
|
||||||
|
+ argz-suffix \
|
||||||
|
basename \
|
||||||
|
bcopy \
|
||||||
|
bzero \
|
||||||
|
diff --git a/string/argz-suffix.c b/string/argz-suffix.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000..505b0f248c
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/string/argz-suffix.c
|
||||||
|
@@ -0,0 +1,56 @@
|
||||||
|
+/* Copyright (C) 2015 Free Software Foundation, Inc.
|
||||||
|
+ This file is part of the GNU C Library.
|
||||||
|
+ Contributed by Ludovic Courtès <ludo@gnu.org>.
|
||||||
|
+
|
||||||
|
+ 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
|
||||||
|
+ <http://www.gnu.org/licenses/>. */
|
||||||
|
+
|
||||||
|
+#include <argz.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+error_t
|
||||||
|
+__argz_suffix_entries (char **argz, size_t *argz_len, const char *suffix)
|
||||||
|
+
|
||||||
|
+{
|
||||||
|
+ size_t suffix_len = strlen (suffix);
|
||||||
|
+ size_t count = __argz_count (*argz, *argz_len);
|
||||||
|
+ size_t new_argz_len = *argz_len + count * suffix_len;
|
||||||
|
+ char *new_argz = malloc (new_argz_len);
|
||||||
|
+
|
||||||
|
+ if (new_argz)
|
||||||
|
+ {
|
||||||
|
+ char *p = new_argz, *entry;
|
||||||
|
+
|
||||||
|
+ for (entry = *argz;
|
||||||
|
+ entry != NULL;
|
||||||
|
+ entry = argz_next (*argz, *argz_len, entry))
|
||||||
|
+ {
|
||||||
|
+ p = stpcpy (p, entry);
|
||||||
|
+ p = stpcpy (p, suffix);
|
||||||
|
+ p++;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ free (*argz);
|
||||||
|
+ *argz = new_argz;
|
||||||
|
+ *argz_len = new_argz_len;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ return ENOMEM;
|
||||||
|
+}
|
||||||
|
+weak_alias (__argz_suffix_entries, argz_suffix_entries)
|
||||||
|
diff --git a/string/argz.h b/string/argz.h
|
||||||
|
index cbc588a8e6..bc6e484c9d 100644
|
||||||
|
--- a/string/argz.h
|
||||||
|
+++ b/string/argz.h
|
||||||
|
@@ -108,6 +108,16 @@ extern error_t argz_replace (char **__restrict __argz,
|
||||||
|
const char *__restrict __str,
|
||||||
|
const char *__restrict __with,
|
||||||
|
unsigned int *__restrict __replace_count);
|
||||||
|
+
|
||||||
|
+/* Suffix each entry of ARGZ & ARGZ_LEN with SUFFIX. Return 0 on success,
|
||||||
|
+ and ENOMEN if memory cannot be allocated. */
|
||||||
|
+extern error_t __argz_suffix_entries (char **__restrict __argz,
|
||||||
|
+ size_t *__restrict __argz_len,
|
||||||
|
+ const char *__restrict __suffix);
|
||||||
|
+extern error_t argz_suffix_entries (char **__restrict __argz,
|
||||||
|
+ size_t *__restrict __argz_len,
|
||||||
|
+ const char *__restrict __suffix);
|
||||||
|
+
|
||||||
|
|
||||||
|
/* Returns the next entry in ARGZ & ARGZ_LEN after ENTRY, or NULL if there
|
||||||
|
are no more. If entry is NULL, then the first entry is returned. This
|
||||||
|
--
|
||||||
|
2.40.1
|
||||||
|
|
|
@ -266,13 +266,13 @@ listed in REFS."
|
||||||
p))
|
p))
|
||||||
|
|
||||||
|
|
||||||
(define (standard-packages)
|
(define* (standard-packages #:optional (system (%current-system)))
|
||||||
"Return the list of (NAME PACKAGE OUTPUT) or (NAME PACKAGE) tuples of
|
"Return the list of (NAME PACKAGE OUTPUT) or (NAME PACKAGE) tuples of
|
||||||
standard packages used as implicit inputs of the GNU build system."
|
standard packages used as implicit inputs of the GNU build system."
|
||||||
|
|
||||||
;; Resolve (gnu packages commencement) lazily to hide circular dependency.
|
;; Resolve (gnu packages commencement) lazily to hide circular dependency.
|
||||||
(let ((distro (resolve-module '(gnu packages commencement))))
|
(let ((distro (resolve-module '(gnu packages commencement))))
|
||||||
(module-ref distro '%final-inputs)))
|
((module-ref distro '%final-inputs) system)))
|
||||||
|
|
||||||
(define* (lower name
|
(define* (lower name
|
||||||
#:key source inputs native-inputs outputs target
|
#:key source inputs native-inputs outputs target
|
||||||
|
@ -303,7 +303,7 @@ standard packages used as implicit inputs of the GNU build system."
|
||||||
(standard-cross-packages target 'host)
|
(standard-cross-packages target 'host)
|
||||||
'())
|
'())
|
||||||
,@(if implicit-inputs?
|
,@(if implicit-inputs?
|
||||||
(standard-packages)
|
(standard-packages system)
|
||||||
'())))
|
'())))
|
||||||
(host-inputs (if target inputs '()))
|
(host-inputs (if target inputs '()))
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,8 @@ options like '--recursive'."
|
||||||
(let* ((input->package (match-lambda
|
(let* ((input->package (match-lambda
|
||||||
((name (? package? package) _ ...) package)
|
((name (? package? package) _ ...) package)
|
||||||
(_ #f)))
|
(_ #f)))
|
||||||
(final-inputs (map input->package %final-inputs))
|
(final-inputs (map input->package
|
||||||
|
(%final-inputs (%current-system))))
|
||||||
(core (append final-inputs
|
(core (append final-inputs
|
||||||
(append-map (compose (cut filter-map input->package <>)
|
(append-map (compose (cut filter-map input->package <>)
|
||||||
package-transitive-inputs)
|
package-transitive-inputs)
|
||||||
|
|
Reference in New Issue