From a1df45e904caf4d26f6e44d07ce74881bb25ecd9 Mon Sep 17 00:00:00 2001 From: Chris Marusich Date: Tue, 27 Feb 2018 05:25:47 +0100 Subject: gnu: commencement: Add commentary regarding grafts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/commencement.scm: Add comments that were originally included only in the Git commit message of f00b85ff8d34df0a1879e593d4a85629b8586af7. Co-Authored-By: Ludovic Courtès --- gnu/packages/commencement.scm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gnu/packages/commencement.scm') diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index 7286e954c5..c38f40f618 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -66,6 +66,15 @@ ;;; To avoid circular dependencies, this module should not be imported ;;; directly from anywhere. ;;; +;;; Below, we frequently use "inherit" to create modified packages. The +;;; reason why we use "inherit" instead of "package/inherit" is because we do +;;; not want these commencement packages to inherit grafts. By definition, +;;; these packages are not depended on at run time by any of the packages we +;;; use. Thus it does not make sense to inherit grafts. Furthermore, those +;;; grafts would often lead to extra overhead for users who would end up +;;; downloading those "-boot0" packages just to build package replacements +;;; that are in fact not going to be used. +;;; ;;; Code: (define gnu-make-boot0 -- cgit v1.2.3 From 0fccb24765dfda3e90d7ce6981d9204f05aa6117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 7 Mar 2018 16:57:20 +0100 Subject: gnu: commencement: 'glibc-final' now inherits from 'glibc'. * gnu/packages/commencement.scm (glibc-final): Inherit from GLIBC instead of GLIBC-FINAL-WITH-BOOTSTRAP-BASH. [propagated-inputs]: New fields. --- gnu/packages/commencement.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'gnu/packages/commencement.scm') diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index c38f40f618..1584f000d4 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -673,7 +673,12 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (define glibc-final ;; The final glibc, which embeds the statically-linked Bash built above. - (package (inherit glibc-final-with-bootstrap-bash) + (package (inherit glibc) + (package + (inherit (package + (inherit glibc) + ;; Use the source patched with %BOOTSTRAP-GUILE. + (source (package-source glibc-final-with-bootstrap-bash)))) (name "glibc") (inputs `(("static-bash" ,static-bash-for-glibc) ,@(alist-delete @@ -684,6 +689,9 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (native-inputs `(,@(package-native-inputs glibc-final-with-bootstrap-bash) ("gettext" ,gettext-boot0))) + (propagated-inputs + (package-propagated-inputs glibc-final-with-bootstrap-bash)) + ;; 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 ;; if 'allowed-references' were per-output. -- cgit v1.2.3 From 7c788ed2276957ea52858d80faeca2962cd26f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 7 Mar 2018 21:30:41 +0100 Subject: gnu: commencement: 'glibc-final' inherits the replacement of 'glibc'. That was the intent of commit b672a8160755bab07fb3c13dbc43dcc26525a7b7, but that commit left 'glibc-final' ungrafted. Reported by Ricardo Wurmus at . * gnu/packages/commencement.scm (glibc-final): Use 'package/inherit' so that we inherit the 'replacement' of GLIBC. --- gnu/packages/commencement.scm | 53 ++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 28 deletions(-) (limited to 'gnu/packages/commencement.scm') diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index 1584f000d4..fe9fbebcc2 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -673,35 +673,32 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (define glibc-final ;; The final glibc, which embeds the statically-linked Bash built above. - (package (inherit glibc) - (package - (inherit (package - (inherit glibc) - ;; Use the source patched with %BOOTSTRAP-GUILE. - (source (package-source glibc-final-with-bootstrap-bash)))) - (name "glibc") - (inputs `(("static-bash" ,static-bash-for-glibc) - ,@(alist-delete - "static-bash" - (package-inputs glibc-final-with-bootstrap-bash)))) - - ;; This time we need 'msgfmt' to install all the libc.mo files. - (native-inputs `(,@(package-native-inputs glibc-final-with-bootstrap-bash) - ("gettext" ,gettext-boot0))) - - (propagated-inputs - (package-propagated-inputs glibc-final-with-bootstrap-bash)) - - ;; 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 - ;; if 'allowed-references' were per-output. - (arguments - `(#:allowed-references - ,(cons* `(,gcc-boot0 "lib") (kernel-headers-boot0) - static-bash-for-glibc - (package-outputs glibc-final-with-bootstrap-bash)) + ;; Use 'package/inherit' so we get the 'replacement' of 'glibc', if any. + (let ((glibc (package-with-bootstrap-guile glibc))) + (package/inherit glibc + (name "glibc") + (inputs `(("static-bash" ,static-bash-for-glibc) + ,@(alist-delete + "static-bash" + (package-inputs glibc-final-with-bootstrap-bash)))) + + ;; This time we need 'msgfmt' to install all the libc.mo files. + (native-inputs `(,@(package-native-inputs glibc-final-with-bootstrap-bash) + ("gettext" ,gettext-boot0))) + + (propagated-inputs + (package-propagated-inputs glibc-final-with-bootstrap-bash)) + + ;; 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 + ;; if 'allowed-references' were per-output. + (arguments + `(#:allowed-references + ,(cons* `(,gcc-boot0 "lib") (kernel-headers-boot0) + static-bash-for-glibc + (package-outputs glibc-final-with-bootstrap-bash)) - ,@(package-arguments glibc-final-with-bootstrap-bash))))) + ,@(package-arguments glibc-final-with-bootstrap-bash)))))) (define gcc-boot0-wrapped ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the -- cgit v1.2.3 From c4fb2b9f4e9ca1c5b586090b765b51b2a5042eff Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Wed, 14 Mar 2018 00:09:03 +0100 Subject: gnu: Add replacement for static-bash-for-glibc. This is needed to replace the static bash used in glibc-final. * gnu/packages/commencement.scm (patched-glibc-final-with-bootstrap-bash, patched-static-bash-for-glibc): New variables. (static-bash-for-glibc)[replacement]: Use patched-static-bash-for-glibc as a replacement. --- gnu/packages/commencement.scm | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'gnu/packages/commencement.scm') diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index fe9fbebcc2..94847b019a 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -556,6 +556,14 @@ the bootstrap environment." ;; because we don't want to depend on bootstrap tools. ("static-bash" ,@(assoc-ref %boot0-inputs "bash"))))))) +(define patched-glibc-final-with-bootstrap-bash + (package + (inherit glibc-final-with-bootstrap-bash) + (source (origin + (inherit (package-source glibc-final-with-bootstrap-bash)) + (patches (cons (search-patch "glibc-allow-kernel-2.6.32.patch") + (origin-patches (package-source glibc-final-with-bootstrap-bash)))))))) + (define (cross-gcc-wrapper gcc binutils glibc bash) "Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC that makes it available under the native tool names." @@ -632,6 +640,40 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" ("libc:static" ,glibc-final-with-bootstrap-bash "static") ,@(fold alist-delete %boot1-inputs '("gcc" "libc"))))) + (let ((p (package-with-bootstrap-guile + (package-with-explicit-inputs bash inputs + (current-source-location) + #:guile %bootstrap-guile)))) + (package (inherit p) + (replacement patched-static-bash-for-glibc))))) + +;; Same as static-bash-for-glibc, except that it uses a patched glibc for the +;; "gcc" and "bash" packages. +(define patched-static-bash-for-glibc + ;; A statically-linked Bash to be used by GLIBC-FINAL in system(3) & co. + (let* ((gcc (cross-gcc-wrapper gcc-boot0 binutils-boot0 + patched-glibc-final-with-bootstrap-bash + (car (assoc-ref %boot1-inputs "bash")))) + (bash (package + (inherit static-bash) + (arguments + (substitute-keyword-arguments + (package-arguments static-bash) + ((#:guile _ #f) + '%bootstrap-guile) + ((#:configure-flags flags '()) + ;; Add a '-L' flag so that the pseudo-cross-ld of + ;; BINUTILS-BOOT0 can find libc.a. + `(append ,flags + (list (string-append "LDFLAGS=-static -L" + (assoc-ref %build-inputs + "libc:static") + "/lib")))))))) + (inputs `(("gcc" ,gcc) + ("libc" ,patched-glibc-final-with-bootstrap-bash) + ("libc:static" ,patched-glibc-final-with-bootstrap-bash "static") + ,@(fold alist-delete %boot1-inputs + '("gcc" "libc"))))) (package-with-bootstrap-guile (package-with-explicit-inputs bash inputs (current-source-location) -- cgit v1.2.3 From 48b97be90bbbdf3108e70d9e23bc8f296d4451b5 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Wed, 14 Mar 2018 16:26:24 +0100 Subject: Revert "gnu: Add replacement for static-bash-for-glibc." This reverts commit c4fb2b9f4e9ca1c5b586090b765b51b2a5042eff. --- gnu/packages/commencement.scm | 42 ------------------------------------------ 1 file changed, 42 deletions(-) (limited to 'gnu/packages/commencement.scm') diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index 94847b019a..fe9fbebcc2 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -556,14 +556,6 @@ the bootstrap environment." ;; because we don't want to depend on bootstrap tools. ("static-bash" ,@(assoc-ref %boot0-inputs "bash"))))))) -(define patched-glibc-final-with-bootstrap-bash - (package - (inherit glibc-final-with-bootstrap-bash) - (source (origin - (inherit (package-source glibc-final-with-bootstrap-bash)) - (patches (cons (search-patch "glibc-allow-kernel-2.6.32.patch") - (origin-patches (package-source glibc-final-with-bootstrap-bash)))))))) - (define (cross-gcc-wrapper gcc binutils glibc bash) "Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC that makes it available under the native tool names." @@ -640,40 +632,6 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" ("libc:static" ,glibc-final-with-bootstrap-bash "static") ,@(fold alist-delete %boot1-inputs '("gcc" "libc"))))) - (let ((p (package-with-bootstrap-guile - (package-with-explicit-inputs bash inputs - (current-source-location) - #:guile %bootstrap-guile)))) - (package (inherit p) - (replacement patched-static-bash-for-glibc))))) - -;; Same as static-bash-for-glibc, except that it uses a patched glibc for the -;; "gcc" and "bash" packages. -(define patched-static-bash-for-glibc - ;; A statically-linked Bash to be used by GLIBC-FINAL in system(3) & co. - (let* ((gcc (cross-gcc-wrapper gcc-boot0 binutils-boot0 - patched-glibc-final-with-bootstrap-bash - (car (assoc-ref %boot1-inputs "bash")))) - (bash (package - (inherit static-bash) - (arguments - (substitute-keyword-arguments - (package-arguments static-bash) - ((#:guile _ #f) - '%bootstrap-guile) - ((#:configure-flags flags '()) - ;; Add a '-L' flag so that the pseudo-cross-ld of - ;; BINUTILS-BOOT0 can find libc.a. - `(append ,flags - (list (string-append "LDFLAGS=-static -L" - (assoc-ref %build-inputs - "libc:static") - "/lib")))))))) - (inputs `(("gcc" ,gcc) - ("libc" ,patched-glibc-final-with-bootstrap-bash) - ("libc:static" ,patched-glibc-final-with-bootstrap-bash "static") - ,@(fold alist-delete %boot1-inputs - '("gcc" "libc"))))) (package-with-bootstrap-guile (package-with-explicit-inputs bash inputs (current-source-location) -- cgit v1.2.3