From 1300c316e9ab27ce042d41b3ebd6fad7e3c26efb Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 10 Dec 2023 18:13:24 +0100 Subject: gnu: ‘make-icecat-extension’ inherits package location. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is an improvement for the purposes of ‘guix edit’ & co. * gnu/build/icecat-extension.scm (make-icecat-extension): Add ‘location’ field. Change-Id: I896ae6823b3fe4ea013fa74e2c536f45664d8042 --- gnu/build/icecat-extension.scm | 1 + 1 file changed, 1 insertion(+) (limited to 'gnu/build') diff --git a/gnu/build/icecat-extension.scm b/gnu/build/icecat-extension.scm index 1e6a9a54e4..e6927c79df 100644 --- a/gnu/build/icecat-extension.scm +++ b/gnu/build/icecat-extension.scm @@ -29,6 +29,7 @@ (define* (make-icecat-extension pkg #:optional (pkg-output "out")) Icecat browser extension. PKG-OUTPUT specifies which output of PKG to use." (package (inherit pkg) + (location (package-location pkg)) (name (string-append (package-name pkg) "-icecat")) (native-inputs '()) (inputs '()) -- cgit v1.2.3 From 9095e10620c775145666f88ff4b0bfdc06645665 Mon Sep 17 00:00:00 2001 From: Jean-Pierre De Jesus DIAZ Date: Tue, 28 Nov 2023 12:34:50 +0100 Subject: gnu: cross-gcc: Enable multilib for AVR. * gnu/build/cross-toolchain.scm (patch-multilib-shebang): New procedure. * gnu/packages/avr.scm (make-avr-gcc): Remove uneeded phases and flags for multilib. * gnu/packages/cross-base (cross-gcc-arguments) <#:configure-flags> [target-avr?]: Remove --disable-multilib and add --enable-multilib. Change-Id: Id68d803057ac898f0a670f10487b08bf0891ab0b Signed-off-by: Efraim Flashner --- gnu/build/cross-toolchain.scm | 8 ++++++++ gnu/packages/avr.scm | 13 +------------ gnu/packages/cross-base.scm | 15 +++++++++++---- 3 files changed, 20 insertions(+), 16 deletions(-) (limited to 'gnu/build') diff --git a/gnu/build/cross-toolchain.scm b/gnu/build/cross-toolchain.scm index 9746be3e50..1933b3e49a 100644 --- a/gnu/build/cross-toolchain.scm +++ b/gnu/build/cross-toolchain.scm @@ -48,6 +48,12 @@ (define %gcc-cross-include-paths ;; Search path for target headers when cross-compiling. (map (cut string-append "CROSS_" <>) %gcc-include-paths)) +(define* (patch-genmultilib-shebang #:key inputs native-inputs #:allow-other-keys) + "Patch-shebang in the gcc/genmultilib file doesn't work as it contains several +scripts inside, each with a #!/bin/sh that needs patching." + (substitute* "gcc/genmultilib" + (("#!/bin/sh") (string-append "#!" (which "sh"))))) + (define* (make-cross-binutils-visible #:key outputs inputs target #:allow-other-keys) "Create symlinks for 'as', 'nm', and 'ld' in the \"out\" output, under @@ -173,6 +179,8 @@ (define* (cross-gcc-build-phases target "Modify PHASES to include everything needed to build a cross-GCC for TARGET, a target triplet." (modify-phases phases + (add-after 'unpack 'patch-genmultilib-shebang + patch-genmultilib-shebang) (add-before 'configure 'set-cross-path ;; This mingw32 target checking logic should match that of target-mingw? ;; in (guix utils), but (guix utils) is too large too copy over to the diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm index 23401cd249..e3671399c1 100644 --- a/gnu/packages/avr.scm +++ b/gnu/packages/avr.scm @@ -77,18 +77,7 @@ (define* (make-avr-gcc/implementation #:key (xgcc gcc)) (format #t "environment variable `CPLUS_INCLUDE_PATH' \ changed to ~a~%" - (getenv "CPLUS_INCLUDE_PATH"))))) - ;; Without a working multilib build, the resulting GCC lacks - ;; support for nearly every AVR chip. - (add-after 'unpack 'fix-genmultilib - (lambda _ - ;; patch-shebang doesn't work here because there are - ;; actually several scripts inside this script, each with - ;; a #!/bin/sh that needs patching. - (substitute* "gcc/genmultilib" - (("#!/bin/sh") (string-append "#!" (which "sh")))))))) - ((#:configure-flags flags) - #~(delete "--disable-multilib" #$flags)))) + (getenv "CPLUS_INCLUDE_PATH"))))))))) (native-search-paths (list (search-path-specification (variable "CROSS_C_INCLUDE_PATH") diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 6de1306279..777b5d8761 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -197,12 +197,19 @@ (define (cross-gcc-arguments target xgcc libc) #~((string-append "--with-toolexeclibdir=" (assoc-ref %outputs "lib") "/" #$target "/lib")) + #~()) + + #$@(if (target-avr? target) + #~("--enable-multilib") #~())) - #$(if libc - flags - #~(remove (cut string-match "--enable-languages.*" <>) - #$flags)))) + (remove + (lambda (flag) + (or (and #$libc + (string-prefix? "--enable-languages" flag)) + (and #$(target-avr? target) + (string=? flag "--disable-multilib")))) + #$flags))) ((#:make-flags flags) (if libc #~(let ((libc (assoc-ref %build-inputs "libc"))) -- cgit v1.2.3 From c7d2faf1788a1f40defc9d4b875d19b912b6ef01 Mon Sep 17 00:00:00 2001 From: Jean-Pierre De Jesus DIAZ Date: Tue, 28 Nov 2023 12:34:54 +0100 Subject: gnu: cross-toolchain: Add set-cross-path for AVR. * gnu/build/cross-toolchain.scm (set-cross-path/avr): New procedure. (cross-gcc-build-phases) [string-prefix? "avr"]: Return set-cross-path/avr procedure. Signed-off-by: Jean-Pierre De Jesus DIAZ Change-Id: I00bd39236ac2e31fef02164a7fffc8b56a166f0d Signed-off-by: Efraim Flashner --- gnu/build/cross-toolchain.scm | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'gnu/build') diff --git a/gnu/build/cross-toolchain.scm b/gnu/build/cross-toolchain.scm index 1933b3e49a..da9016488f 100644 --- a/gnu/build/cross-toolchain.scm +++ b/gnu/build/cross-toolchain.scm @@ -168,6 +168,31 @@ (define (unpacked-mingw-dir) (cons "LIBRARY_PATH" %gcc-include-paths)) #t)) +(define* (set-cross-path/avr #:key inputs #:allow-other-keys) + (match (assoc-ref inputs "libc") + ((? string? libc) + (define (cross? x) + ;; Return #t if X is a cross-libc. + (string-prefix? libc x)) + + (let ((cpath (string-append libc "/avr/include"))) + (for-each (cut setenv <> cpath) + %gcc-cross-include-paths)) + + (setenv "CROSS_LIBRARY_PATH" + (string-append libc "/avr/lib")) + + (for-each (lambda (var) + (and=> (getenv var) + (lambda (value) + (let* ((path (search-path-as-string->list value)) + (native-path (list->search-path-as-string + (remove cross? path) ":"))) + (setenv var native-path))))) + (cons "LIBRARY_PATH" %gcc-include-paths))) + ;; AVR sans-libc cross-compiler. + (else #t))) + (define (install-strip . _) "Install a stripped GCC." ;; Unlike our 'strip' phase, this will do the right thing for @@ -186,9 +211,11 @@ (define* (cross-gcc-build-phases target ;; in (guix utils), but (guix utils) is too large too copy over to the ;; build side entirely and for now we have no way to select variables to ;; copy over. See (gnu packages cross-base) for more details. - (if (string-suffix? "-mingw32" target) - (cut set-cross-path/mingw #:target target <...>) - set-cross-path)) + (cond + ((string-suffix? "-mingw32" target) + (cut set-cross-path/mingw #:target target <...>)) + ((string-prefix? "avr" target) set-cross-path/avr) + (#t set-cross-path))) (add-after 'install 'make-cross-binutils-visible (cut make-cross-binutils-visible #:target target <...>)) (replace 'install install-strip))) -- cgit v1.2.3 From ca813173894360edef35a5d98878a3135e99e62a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 14 Nov 2023 11:49:56 +0100 Subject: shepherd: Remove ‘make-forkexec-constructor/container’. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was superseded by ‘least-authority-wrapper’. * gnu/build/shepherd.scm (read-pid-file/container) (make-forkexec-constructor/container): Remove. Change-Id: I6acccdff2609a35807608f865a4d381146113a88 --- gnu/build/shepherd.scm | 90 -------------------------------------------------- 1 file changed, 90 deletions(-) (limited to 'gnu/build') diff --git a/gnu/build/shepherd.scm b/gnu/build/shepherd.scm index 9d9bfcfbc0..4ead27be0b 100644 --- a/gnu/build/shepherd.scm +++ b/gnu/build/shepherd.scm @@ -33,7 +33,6 @@ (define-module (gnu build shepherd) %precious-signals) #:autoload (shepherd system) (unblock-signals) #:export (default-mounts - make-forkexec-constructor/container fork+exec-command/container)) ;;; Commentary: @@ -101,27 +100,6 @@ (define accounts (file-exists? (file-system-mapping-source mapping))) mappings))))) -(define* (read-pid-file/container pid pid-file #:key (max-delay 5)) - "Read PID-FILE in the container namespaces of PID, which exists in a -separate mount and PID name space. Return the \"outer\" PID. " - (match (container-excursion* pid - (lambda () - ;; XXX: Trick for Shepherd 0.9: prevent 'read-pid-file' from - ;; using (@ (fibers) sleep), which would try to suspend the - ;; current task, which doesn't work in this extra process. - (with-continuation-barrier - (lambda () - (read-pid-file pid-file - #:max-delay max-delay))))) - (#f - ;; Send SIGTERM to the whole process group. - (catch-system-error (kill (- pid) SIGTERM)) - #f) - ((? integer? container-pid) - ;; XXX: When COMMAND is started in a separate PID namespace, its - ;; PID is always 1, but that's not what Shepherd needs to know. - pid))) - (define* (exec-command* command #:key user group log-file pid-file (supplementary-groups '()) (directory "/") (environment-variables (environ))) @@ -144,74 +122,6 @@ (define* (exec-command* command #:key user group log-file pid-file #:directory directory #:environment-variables environment-variables)) -(define* (make-forkexec-constructor/container command - #:key - (namespaces - (default-namespaces args)) - (mappings '()) - (user #f) - (group #f) - (supplementary-groups '()) - (log-file #f) - pid-file - (pid-file-timeout 5) - (directory "/") - (environment-variables - (environ)) - #:rest args) - "This is a variant of 'make-forkexec-constructor' that starts COMMAND in -NAMESPACES, a list of Linux namespaces such as '(mnt ipc). MAPPINGS is the -list of to make in the case of a separate mount -namespace, in addition to essential bind-mounts such /proc." - (define container-directory - (match command - ((program _ ...) - (string-append "/var/run/containers/" (basename program))))) - - (define auto-mappings - `(,@(if log-file - (list (file-system-mapping - (source log-file) - (target source) - (writable? #t))) - '()))) - - (define mounts - (append (map file-system-mapping->bind-mount - (append auto-mappings mappings)) - (default-mounts #:namespaces namespaces))) - - (lambda args - (mkdir-p container-directory) - - (when log-file - ;; Create LOG-FILE so we can map it in the container. - (unless (file-exists? log-file) - (close (open log-file (logior O_CREAT O_APPEND O_CLOEXEC) #o640)) - (when user - (let ((pw (getpwnam user))) - (chown log-file (passwd:uid pw) (passwd:gid pw)))))) - - (let ((pid (run-container container-directory - mounts namespaces 1 - (lambda () - (exec-command* command - #:user user - #:group group - #:supplementary-groups - supplementary-groups - #:pid-file pid-file - #:log-file log-file - #:directory directory - #:environment-variables - environment-variables))))) - (if pid-file - (if (or (memq 'mnt namespaces) (memq 'pid namespaces)) - (read-pid-file/container pid pid-file - #:max-delay pid-file-timeout) - (read-pid-file pid-file #:max-delay pid-file-timeout)) - pid)))) - (define* (fork+exec-command/container command #:key pid #:allow-other-keys -- cgit v1.2.3 From 93ac4c20bf4b46b2bb9d0d2b9bec0b728b34de87 Mon Sep 17 00:00:00 2001 From: Josselin Poiret Date: Wed, 27 Dec 2023 17:18:52 +0100 Subject: chromium-extension: Compute json at argument evaluation time. * gnu/build/chromium-extension.scm (make-chromium-extension): Make use of the make-signing-key procedure inside the argument field, making sure that it is not evaluated at file-load time. This would otherwise try to resolve gnutls when we can't guarantee it's defined because of dependency cycles. Change-Id: Ia7b13acfbca475c2df073e9a88fc8bb9264dd968 --- gnu/build/chromium-extension.scm | 43 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'gnu/build') diff --git a/gnu/build/chromium-extension.scm b/gnu/build/chromium-extension.scm index 28449a1e1d..8171c72734 100644 --- a/gnu/build/chromium-extension.scm +++ b/gnu/build/chromium-extension.scm @@ -120,12 +120,7 @@ (define* (make-chromium-extension pkg #:optional (pkg-output "out")) when installed, will make the extension contained in PKG available as a Chromium browser extension. PKG-OUTPUT specifies which output of PKG to use." (let* ((name (package-name pkg)) - (version (package-version pkg)) - (private-key (make-signing-key name)) - (public-key (signing-key->public-der private-key)) - (checksum (file-sha256sum public-key)) - (crx (make-crx private-key pkg pkg-output)) - (json (crx->chromium-json crx version))) + (version (package-version pkg))) (package (inherit pkg) (name (string-append name "-chromium")) @@ -138,18 +133,24 @@ (define* (make-chromium-extension pkg #:optional (pkg-output "out")) (arguments (list #:modules '((guix build utils)) #:builder - #~(begin - (use-modules (guix build utils)) - (define (base16-char->chromium-base16 char) - ;; Translate CHAR, a hexadecimal character, to a Chromium-style - ;; representation using the letters a-p (where a=0, p=15). - (string-ref "abcdefghijklmnop" - (string-index "0123456789abcdef" char))) - (let ((file-name (string-map base16-char->chromium-base16 - (string-take #$checksum 32))) - (extension-directory - (string-append #$output - "/share/chromium/extensions"))) - (mkdir-p extension-directory) - (symlink #$json (string-append extension-directory "/" - file-name ".json"))))))))) + (let* + ((private-key (make-signing-key name)) + (public-key (signing-key->public-der private-key)) + (checksum (file-sha256sum public-key)) + (crx (make-crx private-key pkg pkg-output)) + (json (crx->chromium-json crx version))) + #~(begin + (use-modules (guix build utils)) + (define (base16-char->chromium-base16 char) + ;; Translate CHAR, a hexadecimal character, to a Chromium-style + ;; representation using the letters a-p (where a=0, p=15). + (string-ref "abcdefghijklmnop" + (string-index "0123456789abcdef" char))) + (let ((file-name (string-map base16-char->chromium-base16 + (string-take #$checksum 32))) + (extension-directory + (string-append #$output + "/share/chromium/extensions"))) + (mkdir-p extension-directory) + (symlink #$json (string-append extension-directory "/" + file-name ".json")))))))))) -- cgit v1.2.3