diff options
Diffstat (limited to 'guix')
-rw-r--r-- | guix/build-system/gnu.scm | 7 | ||||
-rw-r--r-- | guix/build-system/meson.scm | 14 | ||||
-rw-r--r-- | guix/platform.scm | 3 | ||||
-rw-r--r-- | guix/platforms/arm.scm | 2 | ||||
-rw-r--r-- | guix/platforms/avr.scm | 28 | ||||
-rw-r--r-- | guix/platforms/mips.scm | 1 | ||||
-rw-r--r-- | guix/platforms/powerpc.scm | 3 | ||||
-rw-r--r-- | guix/platforms/riscv.scm | 1 | ||||
-rw-r--r-- | guix/platforms/x86.scm | 5 | ||||
-rw-r--r-- | guix/scripts/challenge.scm | 11 | ||||
-rw-r--r-- | guix/scripts/weather.scm | 61 | ||||
-rw-r--r-- | guix/store.scm | 18 | ||||
-rw-r--r-- | guix/utils.scm | 6 |
13 files changed, 148 insertions, 12 deletions
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index c1aa187c42..cdbb547773 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -460,10 +460,13 @@ is one of `host' or `target'." `(("cross-gcc" ,(gcc target #:xbinutils (binutils target) #:libc libc)) - ("cross-libc" ,libc) + ;; Some targets don't have a libc. (e.g. *-elf targets). + ,@(if libc + `(("cross-libc" ,libc)) + '()) ;; MinGW's libc doesn't have a "static" output. - ,@(if (member "static" (package-outputs libc)) + ,@(if (and libc (member "static" (package-outputs libc))) `(("cross-libc:static" ,libc "static")) '())))))))) diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm index 2d14016b94..bf9ca15ecc 100644 --- a/guix/build-system/meson.scm +++ b/guix/build-system/meson.scm @@ -49,11 +49,13 @@ for TRIPLET." `((system . ,(cond ((target-hurd? triplet) "gnu") ((target-linux? triplet) "linux") ((target-mingw? triplet) "windows") + ((target-avr? triplet) "none") (#t (error "meson: unknown operating system")))) (cpu_family . ,(cond ((target-x86-32? triplet) "x86") ((target-x86-64? triplet) "x86_64") ((target-arm32? triplet) "arm") ((target-aarch64? triplet) "aarch64") + ((target-avr? triplet) "avr") ((target-mips64el? triplet) "mips64") ((target-powerpc? triplet) (if (target-64bit? triplet) @@ -66,6 +68,7 @@ for TRIPLET." ((target-x86-64? triplet) "x86_64") ((target-aarch64? triplet) "armv8-a") ((target-arm32? triplet) "armv7") + ((target-avr? triplet) "avr") ;; According to #mesonbuild on OFTC, there does not appear ;; to be an official-ish list of CPU types recognised by ;; Meson, the "cpu" field is not used by Meson itself and @@ -89,6 +92,13 @@ TRIPLET." (ld . ,(string-append triplet "-ld")) (strip . ,(string-append triplet "-strip")))) +(define (make-built-in-options-alist triplet) + (if (target-avr? triplet) + `((b_pie . #f) + (b_staticpic . #f) + (default_library . "static")) + '())) + (define (make-cross-file triplet) (computed-file "cross-file" (with-imported-modules '((guix build meson-configuration)) @@ -99,7 +109,9 @@ TRIPLET." (write-section-header port "host_machine") (write-assignments port '#$(make-machine-alist triplet)) (write-section-header port "binaries") - (write-assignments port '#$(make-binaries-alist triplet)))))))) + (write-assignments port '#$(make-binaries-alist triplet)) + (write-section-header port "built-in options") + (write-assignments port '#$(make-built-in-options-alist triplet)))))))) (define %meson-build-system-modules ;; Build-side modules imported by default. diff --git a/guix/platform.scm b/guix/platform.scm index 55917ca308..994563ab26 100644 --- a/guix/platform.scm +++ b/guix/platform.scm @@ -29,6 +29,7 @@ platform-target platform-system platform-linux-architecture + platform-rust-target platform-glibc-dynamic-linker &platform-not-found-error @@ -74,6 +75,8 @@ (system platform-system) (linux-architecture platform-linux-architecture (default #false)) + (rust-target platform-rust-target + (default #false)) (glibc-dynamic-linker platform-glibc-dynamic-linker)) diff --git a/guix/platforms/arm.scm b/guix/platforms/arm.scm index 32c0fbc032..b0c76efc73 100644 --- a/guix/platforms/arm.scm +++ b/guix/platforms/arm.scm @@ -27,6 +27,7 @@ (target "arm-linux-gnueabihf") (system "armhf-linux") (linux-architecture "arm") + (rust-target "armv7-unknown-linux-gnueabihf") (glibc-dynamic-linker "/lib/ld-linux-armhf.so.3"))) (define aarch64-linux @@ -34,4 +35,5 @@ (target "aarch64-linux-gnu") (system "aarch64-linux") (linux-architecture "arm64") + (rust-target "aarch64-unknown-linux-gnu") (glibc-dynamic-linker "/lib/ld-linux-aarch64.so.1"))) diff --git a/guix/platforms/avr.scm b/guix/platforms/avr.scm new file mode 100644 index 0000000000..ba178db6ea --- /dev/null +++ b/guix/platforms/avr.scm @@ -0,0 +1,28 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com> +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix 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 General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. + +(define-module (guix platforms avr) + #:use-module (guix platform) + #:use-module (guix records) + #:export (avr)) + +(define avr + (platform + (target "avr") + (system #f) + (glibc-dynamic-linker #f))) diff --git a/guix/platforms/mips.scm b/guix/platforms/mips.scm index e6fa9eb292..17b6958f48 100644 --- a/guix/platforms/mips.scm +++ b/guix/platforms/mips.scm @@ -26,4 +26,5 @@ (target "mips64el-linux-gnu") (system "mips64el-linux") (linux-architecture "mips") + (rust-target "mips64el-unknown-linux-gnuabi64") (glibc-dynamic-linker "/lib/ld.so.1"))) diff --git a/guix/platforms/powerpc.scm b/guix/platforms/powerpc.scm index 1c7141ab42..c55301768d 100644 --- a/guix/platforms/powerpc.scm +++ b/guix/platforms/powerpc.scm @@ -28,6 +28,7 @@ (target "powerpc-linux-gnu") (system "powerpc-linux") (linux-architecture "powerpc") + (rust-target "powerpc-unknown-linux-gnu") (glibc-dynamic-linker "/lib/ld.so.1"))) (define powerpc64-linux @@ -35,6 +36,7 @@ (target "powerpc64-linux-gnu") (system #f) ;not supported (linux-architecture "powerpc") + (rust-target "powerpc64-unknown-linux-gnu") (glibc-dynamic-linker "/lib/ld64.so.1"))) (define powerpc64le-linux @@ -42,4 +44,5 @@ (target "powerpc64le-linux-gnu") (system "powerpc64le-linux") (linux-architecture "powerpc") + (rust-target "powerpc64le-unknown-linux-gnu") (glibc-dynamic-linker "/lib/ld64.so.2"))) diff --git a/guix/platforms/riscv.scm b/guix/platforms/riscv.scm index c716c12c12..1b34e82b36 100644 --- a/guix/platforms/riscv.scm +++ b/guix/platforms/riscv.scm @@ -26,4 +26,5 @@ (target "riscv64-linux-gnu") (system "riscv64-linux") (linux-architecture "riscv") + (rust-target "riscv64gc-unknown-linux-gnu") (glibc-dynamic-linker "/lib/ld-linux-riscv64-lp64d.so.1"))) diff --git a/guix/platforms/x86.scm b/guix/platforms/x86.scm index 6f547dd770..4ed5638c14 100644 --- a/guix/platforms/x86.scm +++ b/guix/platforms/x86.scm @@ -30,6 +30,7 @@ (target "i686-linux-gnu") (system "i686-linux") (linux-architecture "i386") + (rust-target "i686-unknown-linux-gnu") (glibc-dynamic-linker "/lib/ld-linux.so.2"))) (define x86_64-linux @@ -37,22 +38,26 @@ (target "x86_64-linux-gnu") (system "x86_64-linux") (linux-architecture "x86_64") + (rust-target "x86_64-unknown-linux-gnu") (glibc-dynamic-linker "/lib/ld-linux-x86-64.so.2"))) (define i686-mingw (platform (target "i686-w64-mingw32") (system #f) + (rust-target "i686-pc-windows-gnu") (glibc-dynamic-linker #f))) (define x86_64-mingw (platform (target "x86_64-w64-mingw32") (system #f) + (rust-target "x86_64-pc-windows-gnu") (glibc-dynamic-linker #f))) (define i586-gnu (platform (target "i586-pc-gnu") (system "i586-gnu") + (rust-target "i686-unknown-hurd-gnu") (glibc-dynamic-linker "/lib/ld.so.1"))) diff --git a/guix/scripts/challenge.scm b/guix/scripts/challenge.scm index 01e2f9a2b2..d38171b868 100644 --- a/guix/scripts/challenge.scm +++ b/guix/scripts/challenge.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015-2017, 2019-2022 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2015-2017, 2019-2023 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -504,7 +504,6 @@ Challenge the substitutes for PACKAGE... provided by one or more servers.\n")) (define %default-options `((system . ,(%current-system)) - (substitute-urls . ,%default-substitute-urls) (difference-report . ,report-differing-files))) @@ -539,7 +538,13 @@ Challenge the substitutes for PACKAGE... provided by one or more servers.\n")) (G_ "no arguments specified, nothing to do~%")) (exit 0)) (x - files)))) + files))) + (urls (or urls + (substitute-urls store) + (begin + (warning (G_ "could not determine current \ +substitute URLs; using defaults~%")) + %default-substitute-urls)))) (set-build-options store #:use-substitutes? #f) diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm index 140df3435f..2f8985593d 100644 --- a/guix/scripts/weather.scm +++ b/guix/scripts/weather.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2017-2022 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2017-2023 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2018 Kyle Meyer <kyle@kyleam.com> ;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com> @@ -35,6 +35,8 @@ #:use-module ((guix build utils) #:select (every*)) #:use-module (guix substitutes) #:use-module (guix narinfo) + #:use-module (guix pki) + #:autoload (gcrypt pk-crypto) (canonical-sexp->string) #:use-module (guix http-client) #:use-module (guix ci) #:use-module (guix sets) @@ -185,6 +187,44 @@ or #f if it could not be determined." (() #f))) +(define (check-narinfo-authorization narinfo) + "Print a warning when NARINFO is not signed by an authorized key." + (define acl + (catch 'system-error + (lambda () + (current-acl)) + (lambda args + (warning (G_ "could not read '~a': ~a~%") + %acl-file (strerror (system-error-errno args))) + (warning (G_ "'~a' is unreadable, cannot determine whether \ +substitutes are authorized~%") + %acl-file) + #f))) + + (unless (or (not acl) (valid-narinfo? narinfo acl)) + (warning (G_ "substitutes from '~a' are unauthorized~%") + (narinfo-uri-base narinfo)) + ;; The "all substitutes" below reflects the fact that, in reality, it *is* + ;; possible to download "unauthorized" substitutes, as long as they match + ;; authorized substitutes. + (display-hint (G_ "To authorize all substitutes from @uref{~a} to be +downloaded, the following command needs to be run as root: + +@example +guix archive --authorize <<EOF +~a +EOF +@end example + +Alternatively, on Guix System, you can add the signing key above to the +@code{authorized-keys} field of @code{guix-configuration}. + +See \"Getting Substitutes from Other Servers\" in the manual for more +information.") + (narinfo-uri-base narinfo) + (canonical-sexp->string + (signature-subject (narinfo-signature narinfo)))))) + (define* (report-server-coverage server items #:key display-missing?) "Report the subset of ITEMS available as substitutes on SERVER. @@ -204,6 +244,12 @@ In case ITEMS is an empty list, return 1 instead." #:make-progress-reporter (lambda* (total #:key url #:allow-other-keys) (progress-reporter/bar total))))) + (match narinfos + (() #f) + ((narinfo . _) + ;; Help diagnose missing substitute authorizations. + (check-narinfo-authorization narinfo))) + (let ((obtained (length narinfos)) (requested (length items)) (missing (lset-difference string=? @@ -391,7 +437,7 @@ Report the availability of substitutes.\n")) %standard-native-build-options)) (define %default-options - `((substitute-urls . ,%default-substitute-urls))) + '()) (define (load-manifest file) "Load the manifest from FILE and return the list of packages it refers to." @@ -582,7 +628,16 @@ SERVER. Display information for packages with at least THRESHOLD dependents." (let* ((opts (parse-command-line args %options (list %default-options) #:build-options? #f)) - (urls (assoc-ref opts 'substitute-urls)) + (urls (or (assoc-ref opts 'substitute-urls) + (with-store store + (substitute-urls store)) + (begin + ;; Could not determine the daemon's current + ;; substitute URLs, presumably because it's too + ;; old. + (warning (G_ "using default \ +substitute URLs~%")) + %default-substitute-urls))) (systems (match (filter-map (match-lambda (('system . system) system) (_ #f)) diff --git a/guix/store.scm b/guix/store.scm index f8e77b2cd9..97c4f32a5b 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012-2022 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2012-2023 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2018 Jan Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2019, 2020 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de> @@ -145,6 +145,7 @@ path-info-nar-size built-in-builders + substitute-urls references references/cached references* @@ -199,7 +200,7 @@ derivation-log-file log-file)) -(define %protocol-version #x163) +(define %protocol-version #x164) (define %worker-magic-1 #x6e697863) ; "nixc" (define %worker-magic-2 #x6478696f) ; "dxio" @@ -253,7 +254,8 @@ (query-valid-derivers 33) (optimize-store 34) (verify-store 35) - (built-in-builders 80)) + (built-in-builders 80) + (substitute-urls 81)) (define-enumerate-type hash-algo ;; hash.hh @@ -1780,6 +1782,16 @@ The result is always the empty list unless the daemon was started with This makes sense only when the daemon was started with '--cache-failures'." boolean) +(define substitute-urls + (let ((urls (operation (substitute-urls) + #f + string-list))) + (lambda (store) + "Return the list of currently configured substitutes URLs for STORE, or +#f if the daemon is too old and does not implement this RPC." + (and (>= (store-connection-version store) #x164) + (urls store))))) + ;;; ;;; Per-connection caches. diff --git a/guix/utils.scm b/guix/utils.scm index 7a42b49df2..8e71f97e1c 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -19,6 +19,7 @@ ;;; Copyright © 2023 Philip McGrath <philip@philipmcgrath.com> ;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2023 Zheng Junjie <873216071@qq.com> +;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -99,6 +100,7 @@ target-arm32? target-aarch64? target-arm? + target-avr? target-ppc32? target-ppc64le? target-powerpc? @@ -724,6 +726,10 @@ architecture (x86_64)?" (%current-system)))) (or (target-arm32? target) (target-aarch64? target))) +(define* (target-avr? #:optional (target (%current-target-system))) + "Is the architecture of TARGET a variant of Microchip's AVR architecture?" + (or (string=? target "avr") (string-prefix? "avr-" target))) + (define* (target-ppc32? #:optional (target (or (%current-target-system) (%current-system)))) (string-prefix? "powerpc-" target)) |