Subject: Re: bug#32923: [PATCH 0/3] Add Arduino basics.

From: Maxim Cournoyer <[email-masked]>
Date: Fri, 01 Sep 2023 14:46:39 -0400

Hi Danny,

Danny Milosavljevic <[email-masked]> writes:

> * gnu/packages/arduino.scm (arduino-installer): New procedure.
> (arduino-hardware): New variable.
> ---
>  gnu/packages/arduino.scm | 106 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 106 insertions(+)
>  create mode 100644 gnu/packages/arduino.scm

[...]

> +(define-public arduino-hardware
> +  (package
> +    (name "arduino-hardware")
> +    (version "1.8.7")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/arduino/Arduino.git")
> +                    (commit version)))
> +              (sha256
> +               (base32
> +                "0cp502jf3xsrisadkrmxzylds48x60vparxm5lfcrzw27hw0qxgq"))
> +              (modules '((guix build utils)))
> +              (snippet
> +               '(begin
> +                  ;; Delete bundled jar archives.
> +                  (for-each delete-file (find-files "." "\\.jar$"))
> +                  #t))))
> +    (build-system gnu-build-system)
> +    (arguments
> +     `(#:tests? #f                      ; No tests exist
> +       #:modules ((guix build utils) (ice-9 match)
> +                  (guix build gnu-build-system))
> +       #:phases
> +       (modify-phases %standard-phases
> +         (delete 'configure)
> +         (delete 'build)
> +         (add-after 'unpack 'prepare-dependencies
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             ;; This is intended to just prepare arduino inputs where its
> +             ;; build system expects them.
> +             (for-each (match-lambda
> +                         ((key . value)
> +                          (let* ((out-dir (assoc-ref outputs "out"))
> +                                 (destination-dir
> +                                  (string-append out-dir "/share/arduino")))
> +                            (if (string-prefix? "arduino-" key)
> +                                (let* ((basename
> +                                        (string-drop key
> +                                                     (string-length "arduino-")))
> +                                       (target-outdir (assoc-ref inputs key))
> +                                       (target-dir
> +                                        (string-append target-outdir
> +                                                       "/share/arduino"))
> +                                       (target (string-append target-dir
> +                                                              "/" basename))
> +                                       (destination
> +                                        (string-append destination-dir "/"
> +                                                       basename)))
> +                                  (mkdir-p destination-dir)
> +                                  (symlink target destination)
> +                                  #t)))))
> +                       inputs)
> +             #t))

The prepare-dependecies phase appears to expect "arduino-" prefixed
input labels, but there are no inputs specified, so it seems it'd be
useful?  Am I missing something?

-- 
Thanks,
Maxim