unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 0/5] gnu: Add Arduino tools
@ 2016-08-16 18:36 Danny Milosavljevic
  2016-08-16 18:36 ` [PATCH 1/5] gnu: Add "arduino" module Danny Milosavljevic
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Danny Milosavljevic @ 2016-08-16 18:36 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

gnu: Add Arduino tools.

Danny Milosavljevic (5):
  gnu: Add "arduino" module.
  gnu: arduino: Add "arduino-installer" helper.
  gnu: arduino: Add arduino-hardware
  gnu: arduino: Add arduino-libraries.
  gnu: Add arduino-makefile.

 gnu/packages/arduino.scm | 191 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 191 insertions(+)
 create mode 100644 gnu/packages/arduino.scm


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/5] gnu: Add "arduino" module.
  2016-08-16 18:36 [PATCH 0/5] gnu: Add Arduino tools Danny Milosavljevic
@ 2016-08-16 18:36 ` Danny Milosavljevic
  2016-08-16 22:40   ` Eric Bavier
  2016-08-16 18:36 ` [PATCH 2/5] gnu: arduino: Add "arduino-installer" helper Danny Milosavljevic
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Danny Milosavljevic @ 2016-08-16 18:36 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 193 bytes --]


* gnu/packages/arduino.scm: New file.
---
 gnu/packages/arduino.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 gnu/packages/arduino.scm


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-arduino-module.patch --]
[-- Type: text/x-patch; name="0001-gnu-Add-arduino-module.patch", Size: 1532 bytes --]

diff --git a/gnu/packages/arduino.scm b/gnu/packages/arduino.scm
new file mode 100644
index 0000000..fc9712c
--- /dev/null
+++ b/gnu/packages/arduino.scm
@@ -0,0 +1,31 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
+;;;
+;;; 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 (gnu packages arduino)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix utils)
+  #:use-module (guix download)
+  #:use-module (guix packages)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system python)
+  #:use-module (guix build-system ant)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages avr)
+  #:use-module (gnu packages flashing-tools)
+  #:use-module (gnu packages java)
+  #:use-module (gnu packages python))

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/5] gnu: arduino: Add "arduino-installer" helper.
  2016-08-16 18:36 [PATCH 0/5] gnu: Add Arduino tools Danny Milosavljevic
  2016-08-16 18:36 ` [PATCH 1/5] gnu: Add "arduino" module Danny Milosavljevic
@ 2016-08-16 18:36 ` Danny Milosavljevic
  2016-08-16 18:36 ` [PATCH 3/5] gnu: arduino: Add arduino-hardware Danny Milosavljevic
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Danny Milosavljevic @ 2016-08-16 18:36 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 148 bytes --]


* gnu/packages/arduino.scm (arduino-installer): New procedure.
---
 gnu/packages/arduino.scm | 9 +++++++++
 1 file changed, 9 insertions(+)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-arduino-Add-arduino-installer-helper.patch --]
[-- Type: text/x-patch; name="0002-gnu-arduino-Add-arduino-installer-helper.patch", Size: 658 bytes --]

diff --git a/gnu/packages/arduino.scm b/gnu/packages/arduino.scm
index fc9712c..b8d9aba 100644
--- a/gnu/packages/arduino.scm
+++ b/gnu/packages/arduino.scm
@@ -29,3 +29,12 @@
   #:use-module (gnu packages flashing-tools)
   #:use-module (gnu packages java)
   #:use-module (gnu packages python))
+
+(define (arduino-installer filename)
+  `(lambda* (#:key outputs #:allow-other-keys)
+    (let* ((out (assoc-ref outputs "out"))
+           (out-share (string-append out "/share/arduino"))
+           (out-share-part (string-append out-share "/" ,filename)))
+     (mkdir-p out-share)
+     (copy-recursively ,filename out-share-part))))
+

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/5] gnu: arduino: Add arduino-hardware
  2016-08-16 18:36 [PATCH 0/5] gnu: Add Arduino tools Danny Milosavljevic
  2016-08-16 18:36 ` [PATCH 1/5] gnu: Add "arduino" module Danny Milosavljevic
  2016-08-16 18:36 ` [PATCH 2/5] gnu: arduino: Add "arduino-installer" helper Danny Milosavljevic
@ 2016-08-16 18:36 ` Danny Milosavljevic
  2016-08-16 22:53   ` Eric Bavier
  2016-08-16 18:36 ` [PATCH 4/5] gnu: arduino: Add arduino-libraries Danny Milosavljevic
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Danny Milosavljevic @ 2016-08-16 18:36 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 187 bytes --]


* gnu/packages/arduino.scm (arduino-hardware): New variable.
---
 gnu/packages/arduino.scm | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-gnu-arduino-Add-arduino-hardware.patch --]
[-- Type: text/x-patch; name="0003-gnu-arduino-Add-arduino-hardware.patch", Size: 3031 bytes --]

diff --git a/gnu/packages/arduino.scm b/gnu/packages/arduino.scm
index b8d9aba..ae69c04 100644
--- a/gnu/packages/arduino.scm
+++ b/gnu/packages/arduino.scm
@@ -38,3 +38,56 @@
      (mkdir-p out-share)
      (copy-recursively ,filename out-share-part))))
 
+(define-public arduino-hardware
+  (package
+    (name "arduino-hardware")
+    (version "1.6.10")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/arduino/Arduino/archive/" version ".tar.gz"))
+              (sha256
+               (base32
+                "15gbg64i2ac6d0mlnbla567sn26494cvqwf5q53xzf4b5v2rb0jc"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (modules '((guix build utils)))
+              (snippet
+                 '(begin
+                    ;; Delete bundled jar archives.
+                    (for-each delete-file (find-files "." "\\.jar$"))
+                    #t))
+              (patches (search-patches "arduino-hardware-patch-out-__cxa_guard_acquire.patch"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; no tests exist
+       #: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 (lambda (input)
+                          (let* ((key (car input))
+                                 (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))
+          (add-before 'build 'chdir
+            (lambda _
+              (chdir "hardware")))
+          (replace 'install ,(arduino-installer "hardware")))))
+    (home-page "https://www.arduino.cc/")
+    (synopsis "Arduino Hardware Spec Files")
+    (description "arduino-hardware contains Arduino Hardware Spec Files (boards.txt etc).")
+    ;; GPL covers the main body ("app", "core"). LGPL covers the remainder.
+    (license license:lgpl2.1+))) ; FIXME check

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 4/5] gnu: arduino: Add arduino-libraries.
  2016-08-16 18:36 [PATCH 0/5] gnu: Add Arduino tools Danny Milosavljevic
                   ` (2 preceding siblings ...)
  2016-08-16 18:36 ` [PATCH 3/5] gnu: arduino: Add arduino-hardware Danny Milosavljevic
@ 2016-08-16 18:36 ` Danny Milosavljevic
  2016-08-16 22:56   ` Eric Bavier
  2016-08-16 18:36 ` [PATCH 5/5] gnu: Add arduino-makefile Danny Milosavljevic
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Danny Milosavljevic @ 2016-08-16 18:36 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 155 bytes --]


* gnu/packages/arduino.scm (arduino-libraries): New variable.
---
 gnu/packages/arduino.scm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0004-gnu-arduino-Add-arduino-libraries.patch --]
[-- Type: text/x-patch; name="0004-gnu-arduino-Add-arduino-libraries.patch", Size: 980 bytes --]

diff --git a/gnu/packages/arduino.scm b/gnu/packages/arduino.scm
index ae69c04..675df80 100644
--- a/gnu/packages/arduino.scm
+++ b/gnu/packages/arduino.scm
@@ -91,3 +91,18 @@
     (description "arduino-hardware contains Arduino Hardware Spec Files (boards.txt etc).")
     ;; GPL covers the main body ("app", "core"). LGPL covers the remainder.
     (license license:lgpl2.1+))) ; FIXME check
+
+(define-public arduino-libraries
+  (package (inherit arduino-hardware)
+    (name "arduino-libraries")
+    (inputs `(("arduino-hardware" ,arduino-hardware)))
+    (arguments
+      (substitute-keyword-arguments
+        (package-arguments arduino-hardware)
+        ((#:phases phases)
+            `(modify-phases ,phases
+              (replace 'chdir
+                (lambda _
+                  (chdir "libraries")))
+              (replace 'install ,(arduino-installer "libraries"))))))
+    (license license:lgpl2.1))) ; FIXME check apache license etc

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 5/5] gnu: Add arduino-makefile.
  2016-08-16 18:36 [PATCH 0/5] gnu: Add Arduino tools Danny Milosavljevic
                   ` (3 preceding siblings ...)
  2016-08-16 18:36 ` [PATCH 4/5] gnu: arduino: Add arduino-libraries Danny Milosavljevic
@ 2016-08-16 18:36 ` Danny Milosavljevic
  2016-08-17  5:02   ` Eric Bavier
  2016-08-16 18:49 ` Maven Danny Milosavljevic
  2016-08-30  9:21 ` [PATCH 0/5] gnu: Add Arduino tools Ludovic Courtès
  6 siblings, 1 reply; 15+ messages in thread
From: Danny Milosavljevic @ 2016-08-16 18:36 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 187 bytes --]


* gnu/packages/arduino.scm (arduino-makefile): New variable.
---
 gnu/packages/arduino.scm | 83 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0005-gnu-Add-arduino-makefile.patch --]
[-- Type: text/x-patch; name="0005-gnu-Add-arduino-makefile.patch", Size: 4649 bytes --]

diff --git a/gnu/packages/arduino.scm b/gnu/packages/arduino.scm
index 675df80..34f0251 100644
--- a/gnu/packages/arduino.scm
+++ b/gnu/packages/arduino.scm
@@ -106,3 +106,86 @@
                   (chdir "libraries")))
               (replace 'install ,(arduino-installer "libraries"))))))
     (license license:lgpl2.1))) ; FIXME check apache license etc
+
+(define-public arduino-makefile ; really something like arduino-toolchain...
+  (package
+    (name "arduino-makefile")
+    (version "1.5.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/sudar/Arduino-Makefile/"
+                                  "archive/" version ".tar.gz"))
+              (sha256
+               (base32
+                "1gqmcg2jg62b915akbkivnqf8sx76gv719vx7azm47szd0w1i94i"))
+              (file-name (string-append name "-" version ".tar.gz"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #f ; no tests exist
+       #:phases
+        (modify-phases %standard-phases
+          (delete 'configure)
+          (add-after 'unpack 'patch-paths
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((avr-gcc (assoc-ref inputs "avr-toolchain-5")))
+              (substitute* "bin/ard-reset-arduino"
+                (("#!/usr/bin/env python") "#!/usr/bin/python3"))
+              (substitute* "Arduino.mk"
+                (("#    => ARDUINO_DIR.*")
+                   (string-append "ARDUINO_DIR = "
+                                  (assoc-ref %build-inputs "arduino-libraries")
+                                  "/share/arduino\n"))
+                ; ; defaults to "hardware/tools/avr"
+                (("#    => AVR_TOOLS_DIR.*")
+                   (string-append "AVR_TOOLS_DIR = "
+                                  (assoc-ref %build-inputs "avrdude")
+                                  "\n"))
+                (("#    => ARDMK_DIR.*")
+                   (string-append "ARDMK_DIR = "
+                                  (assoc-ref %outputs "out")
+                                  "/share/arduino\n"))
+                (("CC_NAME[ ]*=.*")
+                   (string-append "CC_NAME = " avr-gcc "/bin/avr-gcc\n"))
+                (("CXX_NAME[ ]*=.*")
+                   (string-append "CXX_NAME = " avr-gcc "/bin/avr-g++\n"))
+                (("OBJCOPY_NAME[ ]*=.*")
+                   (string-append "OBJCOPY_NAME = " avr-gcc "/bin/avr-objcopy\n"))
+                (("OBJDUMP_NAME[ ]*=.*")
+                   (string-append "OBJDUMP_NAME = " avr-gcc "/bin/avr-objdump\n"))
+                (("AR_NAME[ ]*=.*")
+                   (string-append "AR_NAME = " avr-gcc "/bin/avr-ar\n"))
+                (("SIZE_NAME[ ]*=.*")
+                   (string-append "SIZE_NAME = " avr-gcc "/bin/avr-size\n"))
+                (("NM_NAME[ ]*=.*")
+                   (string-append "NM_NAME = " avr-gcc "/bin/avr-nm\n"))))))
+          (delete 'build)
+          (replace 'install
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (out-mk (string-append out "/share/arduino"))
+                     (out-doc (string-append out "/share/doc"))
+                     (out-bin (string-append out "/bin"))
+                     (out-man (string-append out "/share/man/man1")))
+                    (mkdir-p out-mk)
+                    (for-each (lambda (name)
+                                (copy-file name (string-append out-mk "/" name)))
+                              '("Arduino.mk" "arduino-mk-vars.md" "chipKIT.mk" "Common.mk"))
+                    (mkdir-p out-doc)
+                    (copy-recursively "examples" out-doc)
+                    (mkdir-p out-bin)
+                    (copy-file "bin/ard-reset-arduino"
+                               (string-append out-bin "/ard-reset-arduino"))
+                    (mkdir-p out-man)
+                    (copy-file "ard-reset-arduino.1"
+                               (string-append out-man "/ard-reset-arduino.1"))))))))
+    (inputs
+     `(("python" ,python)
+       ("python-pyserial" ,python-pyserial)
+       ("arduino-libraries" ,arduino-libraries)
+       ("avrdude" ,avrdude)
+       ("avr-toolchain-5" ,avr-toolchain-5)))
+    (synopsis "Arduino Makefile Include Files")
+    (description "Allows you to build Arduino sketches using a very tiny Makefile")
+    (home-page "https://github.com/sudar/Arduino-Makefile")
+    ;(supported-systems '("avr"))
+    (license license:lgpl2.1)))

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Maven
  2016-08-16 18:36 [PATCH 0/5] gnu: Add Arduino tools Danny Milosavljevic
                   ` (4 preceding siblings ...)
  2016-08-16 18:36 ` [PATCH 5/5] gnu: Add arduino-makefile Danny Milosavljevic
@ 2016-08-16 18:49 ` Danny Milosavljevic
  2016-08-17  6:16   ` Maven Ricardo Wurmus
  2016-08-30  9:21 ` [PATCH 0/5] gnu: Add Arduino tools Ludovic Courtès
  6 siblings, 1 reply; 15+ messages in thread
From: Danny Milosavljevic @ 2016-08-16 18:49 UTC (permalink / raw)
  To: guix-devel

Hi,

I also tried to package the Arduino GUI - but it has lots of Apache Commons dependencies and those use the Maven repo system.

Has anyone already packaged Apache Commons libraries?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/5] gnu: Add "arduino" module.
  2016-08-16 18:36 ` [PATCH 1/5] gnu: Add "arduino" module Danny Milosavljevic
@ 2016-08-16 22:40   ` Eric Bavier
  0 siblings, 0 replies; 15+ messages in thread
From: Eric Bavier @ 2016-08-16 22:40 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

On Tue, 16 Aug 2016 20:36:28 +0200
Danny Milosavljevic <dannym@scratchpost.org> wrote:

> * gnu/packages/arduino.scm: New file.
> ---
>  gnu/packages/arduino.scm | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
>  create mode 100644 gnu/packages/arduino.scm

You can feel free to just create the module with the first package that
will reside in it.  See example of commits with "/gnu/package/*.scm: New
file"

`~Eric 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/5] gnu: arduino: Add arduino-hardware
  2016-08-16 18:36 ` [PATCH 3/5] gnu: arduino: Add arduino-hardware Danny Milosavljevic
@ 2016-08-16 22:53   ` Eric Bavier
  0 siblings, 0 replies; 15+ messages in thread
From: Eric Bavier @ 2016-08-16 22:53 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

On Tue, 16 Aug 2016 20:36:30 +0200
Danny Milosavljevic <dannym@scratchpost.org> wrote:

> * gnu/packages/arduino.scm (arduino-hardware): New variable.
> ---
>  gnu/packages/arduino.scm | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
> 

> diff --git a/gnu/packages/arduino.scm b/gnu/packages/arduino.scm
> index b8d9aba..ae69c04 100644
> --- a/gnu/packages/arduino.scm
> +++ b/gnu/packages/arduino.scm
> @@ -38,3 +38,56 @@
>       (mkdir-p out-share)
>       (copy-recursively ,filename out-share-part))))
>  
> +(define-public arduino-hardware
> +  (package
> +    (name "arduino-hardware")
> +    (version "1.6.10")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append "https://github.com/arduino/Arduino/archive/" version ".tar.gz"))

This line is certainly too long.

> +              (sha256
> +               (base32
> +                "15gbg64i2ac6d0mlnbla567sn26494cvqwf5q53xzf4b5v2rb0jc"))
> +              (file-name (string-append name "-" version ".tar.gz"))
> +              (modules '((guix build utils)))
> +              (snippet
> +                 '(begin
> +                    ;; Delete bundled jar archives.
> +                    (for-each delete-file (find-files "." "\\.jar$"))
> +                    #t))
> +              (patches (search-patches "arduino-hardware-patch-out-__cxa_guard_acquire.patch"))))

This file seems to be missing from this patch.

> +    (build-system gnu-build-system)
> +    (arguments
> +     `(#:tests? #f ; no tests exist
> +       #:phases
> +        (modify-phases %standard-phases
> +          (delete 'configure)
> +          (delete 'build)
> +          (add-after 'unpack 'prepare-dependencies

I'm a bit confused here.  This phase operates on inputs, but there are none declared?  NVM, I see its use '[PATCH 4/5] gnu: arduino: Add arduino-libraries.'

> +            (lambda* (#:key inputs outputs #:allow-other-keys)
> +              ;; this is intended to just prepare arduino inputs where its build system expects them
> +              (for-each (lambda (input)
> +                          (let* ((key (car input))

Prefer to use (ice-9 match)'s 'match' or 'match-lambda' instead of car, cdr, here.  E.g.:

(for each (match-lambda
           ((name (? package? package) . outputs)
             ...))
          inputs)

`~Eric

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 4/5] gnu: arduino: Add arduino-libraries.
  2016-08-16 18:36 ` [PATCH 4/5] gnu: arduino: Add arduino-libraries Danny Milosavljevic
@ 2016-08-16 22:56   ` Eric Bavier
  2016-08-16 23:23     ` Danny Milosavljevic
  0 siblings, 1 reply; 15+ messages in thread
From: Eric Bavier @ 2016-08-16 22:56 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

On Tue, 16 Aug 2016 20:36:31 +0200
Danny Milosavljevic <dannym@scratchpost.org> wrote:

> * gnu/packages/arduino.scm (arduino-libraries): New variable.
> ---
>  gnu/packages/arduino.scm | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 

> diff --git a/gnu/packages/arduino.scm b/gnu/packages/arduino.scm
> index ae69c04..675df80 100644
> --- a/gnu/packages/arduino.scm
> +++ b/gnu/packages/arduino.scm
> @@ -91,3 +91,18 @@
>      (description "arduino-hardware contains Arduino Hardware Spec Files (boards.txt etc).")
>      ;; GPL covers the main body ("app", "core"). LGPL covers the remainder.
>      (license license:lgpl2.1+))) ; FIXME check
> +
> +(define-public arduino-libraries
> +  (package (inherit arduino-hardware)

This seems like a false inheritence to me.  Do arduino-hardware and
arduino-libraries really need to be separate packages?  This are build
from the same source.  I don't know the package at all, but it seems
like you might be able to do away with the dependencies setup and the
arduino-installer procedure if the two are built together.  WDYT?

> +    (name "arduino-libraries")
> +    (inputs `(("arduino-hardware" ,arduino-hardware)))
> +    (arguments
> +      (substitute-keyword-arguments
> +        (package-arguments arduino-hardware)
> +        ((#:phases phases)
> +            `(modify-phases ,phases
> +              (replace 'chdir
> +                (lambda _
> +                  (chdir "libraries")))
> +              (replace 'install ,(arduino-installer "libraries"))))))
> +    (license license:lgpl2.1))) ; FIXME check apache license etc
                                     ^
This of course needs to be resolved before pushing.

`~Eric

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 4/5] gnu: arduino: Add arduino-libraries.
  2016-08-16 22:56   ` Eric Bavier
@ 2016-08-16 23:23     ` Danny Milosavljevic
  0 siblings, 0 replies; 15+ messages in thread
From: Danny Milosavljevic @ 2016-08-16 23:23 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel

> This seems like a false inheritence to me.  Do arduino-hardware and
> arduino-libraries really need to be separate packages? 

Not really.

>but it seems like you might be able to do away with the dependencies setup 

Right now maybe. But there is a huge Arduino Java IDE and I'd rather not depend on icedtea-1.8 and Apache Commons (A,B,C,D,E,F) etcetc to build a 50 line C program for an 8 bit system (which is what one does with Arduino).

>and the arduino-installer procedure if the two are built together.

The arduino-installer just installs files without any magic. There's no install target otherwise. So the code will always be there (also to install the IDE part).

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 5/5] gnu: Add arduino-makefile.
  2016-08-16 18:36 ` [PATCH 5/5] gnu: Add arduino-makefile Danny Milosavljevic
@ 2016-08-17  5:02   ` Eric Bavier
  2016-08-17  9:03     ` Danny Milosavljevic
  0 siblings, 1 reply; 15+ messages in thread
From: Eric Bavier @ 2016-08-17  5:02 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

On Tue, 16 Aug 2016 20:36:32 +0200
Danny Milosavljevic <dannym@scratchpost.org> wrote:

> * gnu/packages/arduino.scm (arduino-makefile): New variable.
> ---
>  gnu/packages/arduino.scm | 83 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 83 insertions(+)
> 

> diff --git a/gnu/packages/arduino.scm b/gnu/packages/arduino.scm
> index 675df80..34f0251 100644
> --- a/gnu/packages/arduino.scm
> +++ b/gnu/packages/arduino.scm
> @@ -106,3 +106,86 @@
>                    (chdir "libraries")))
>                (replace 'install ,(arduino-installer "libraries"))))))
>      (license license:lgpl2.1))) ; FIXME check apache license etc
> +
> +(define-public arduino-makefile ; really something like arduino-toolchain...
> +  (package
> +    (name "arduino-makefile")
> +    (version "1.5.1")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append "https://github.com/sudar/Arduino-Makefile/"
> +                                  "archive/" version ".tar.gz"))
> +              (sha256
> +               (base32
> +                "1gqmcg2jg62b915akbkivnqf8sx76gv719vx7azm47szd0w1i94i"))
> +              (file-name (string-append name "-" version ".tar.gz"))))
> +    (build-system python-build-system)
> +    (arguments
> +     `(#:tests? #f ; no tests exist
> +       #:phases
> +        (modify-phases %standard-phases
> +          (delete 'configure)
> +          (add-after 'unpack 'patch-paths
> +            (lambda* (#:key inputs outputs #:allow-other-keys)
> +             (let ((avr-gcc (assoc-ref inputs "avr-toolchain-5")))
> +              (substitute* "bin/ard-reset-arduino"
> +                (("#!/usr/bin/env python") "#!/usr/bin/python3"))

Should this not point to /gnu/store/...-python-3...?  If not, it could
probably be left alone, since any package built with it will presumably
have its shebangs patched.

> +              (substitute* "Arduino.mk"
> +                (("#    => ARDUINO_DIR.*")
> +                   (string-append "ARDUINO_DIR = "
> +                                  (assoc-ref %build-inputs "arduino-libraries")
> +                                  "/share/arduino\n"))
> +                ; ; defaults to "hardware/tools/avr"
> +                (("#    => AVR_TOOLS_DIR.*")
> +                   (string-append "AVR_TOOLS_DIR = "
> +                                  (assoc-ref %build-inputs "avrdude")
> +                                  "\n"))
> +                (("#    => ARDMK_DIR.*")
> +                   (string-append "ARDMK_DIR = "
> +                                  (assoc-ref %outputs "out")
> +                                  "/share/arduino\n"))
> +                (("CC_NAME[ ]*=.*")
> +                   (string-append "CC_NAME = " avr-gcc "/bin/avr-gcc\n"))
> +                (("CXX_NAME[ ]*=.*")
> +                   (string-append "CXX_NAME = " avr-gcc "/bin/avr-g++\n"))
> +                (("OBJCOPY_NAME[ ]*=.*")
> +                   (string-append "OBJCOPY_NAME = " avr-gcc "/bin/avr-objcopy\n"))
> +                (("OBJDUMP_NAME[ ]*=.*")
> +                   (string-append "OBJDUMP_NAME = " avr-gcc "/bin/avr-objdump\n"))
> +                (("AR_NAME[ ]*=.*")
> +                   (string-append "AR_NAME = " avr-gcc "/bin/avr-ar\n"))
> +                (("SIZE_NAME[ ]*=.*")
> +                   (string-append "SIZE_NAME = " avr-gcc "/bin/avr-size\n"))
> +                (("NM_NAME[ ]*=.*")
> +                   (string-append "NM_NAME = " avr-gcc "/bin/avr-nm\n"))))))
> +          (delete 'build)
> +          (replace 'install
> +            (lambda* (#:key outputs #:allow-other-keys)
> +              (let* ((out (assoc-ref outputs "out"))
> +                     (out-mk (string-append out "/share/arduino"))
> +                     (out-doc (string-append out "/share/doc"))
> +                     (out-bin (string-append out "/bin"))
> +                     (out-man (string-append out "/share/man/man1")))
> +                    (mkdir-p out-mk)
> +                    (for-each (lambda (name)
> +                                (copy-file name (string-append out-mk "/" name)))
> +                              '("Arduino.mk" "arduino-mk-vars.md" "chipKIT.mk" "Common.mk"))
> +                    (mkdir-p out-doc)
> +                    (copy-recursively "examples" out-doc)
> +                    (mkdir-p out-bin)
> +                    (copy-file "bin/ard-reset-arduino"
> +                               (string-append out-bin "/ard-reset-arduino"))
> +                    (mkdir-p out-man)
> +                    (copy-file "ard-reset-arduino.1"
> +                               (string-append out-man "/ard-reset-arduino.1"))))))))

You can use 'install-file' from (guix build utils) here to remove much
of the repitition.

> +    (inputs
> +     `(("python" ,python)
> +       ("python-pyserial" ,python-pyserial)
> +       ("arduino-libraries" ,arduino-libraries)
> +       ("avrdude" ,avrdude)
> +       ("avr-toolchain-5" ,avr-toolchain-5)))
> +    (synopsis "Arduino Makefile Include Files")
> +    (description "Allows you to build Arduino sketches using a very tiny Makefile")

Please rewrite the description as a full sentence.

> +    (home-page "https://github.com/sudar/Arduino-Makefile")
> +    ;(supported-systems '("avr"))

You can remove this comment.

I don't have an arduino to test this package on.  Can anyone else help
with this?

`~Eric

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Maven
  2016-08-16 18:49 ` Maven Danny Milosavljevic
@ 2016-08-17  6:16   ` Ricardo Wurmus
  0 siblings, 0 replies; 15+ messages in thread
From: Ricardo Wurmus @ 2016-08-17  6:16 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel


Danny Milosavljevic <dannym@scratchpost.org> writes:

> I also tried to package the Arduino GUI - but it has lots of Apache
> Commons dependencies and those use the Maven repo system.
>
> Has anyone already packaged Apache Commons libraries?

I have not, but the few Java packages I contributed were added because
they are needed to bootstrap dependencies that eventually lead to Maven.
You may find that to package the Apache Commons libraries you need to
dig deeper and package seemingly unrelated libraries first.

Many Java packages bundle dependencies or depend at build time on
binaries that are not easy to build from source.  I’d be happy if we had
more people looking at how to package more of Java.

~~ Ricardo

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 5/5] gnu: Add arduino-makefile.
  2016-08-17  5:02   ` Eric Bavier
@ 2016-08-17  9:03     ` Danny Milosavljevic
  0 siblings, 0 replies; 15+ messages in thread
From: Danny Milosavljevic @ 2016-08-17  9:03 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel

> Should this not point to /gnu/store/...-python-3...?  If not, it could
> probably be left alone, since any package built with it will presumably
> have its shebangs patched.

It's just that Python 3 is incompatible with Python 2 but the source code has no marker in the file - so patch-shebang would have to use a crystal ball, tea leaves or whatever to find out it is indeed Python 3. I expect that patch-shebang will then see python3 and correct it - and it does.

> You can use 'install-file' from (guix build utils) here to remove much
> of the repitition.

Ah, nice!

> > +    ;(supported-systems '("avr"))  
> 
> You can remove this comment.

I wouldn't. It's nice to see that it's for AVR even if we don't use the whole target machinery (I tried invoking "guix build --target=avr" before and it rebuilt half the universe - not sure why. There are not many non-native inputs and the native inputs are... native).

> I don't have an arduino to test this package on.  Can anyone else help
> with this?

You can still test the compilation and linkage.

My Makefile to test this looks like this:

ARCHITECTURE = avr
BOARD_TAG    = uno

# shouldn't be necessary but is
CPPFLAGS += -I${HOME}/.guix-profile/avr/include

# shouldn't be necessary but is. The "-L" flag order matters.
LDFLAGS += -L${HOME}/.guix-profile/avr/lib/avr5 -L${HOME}/.guix-profile/avr/lib -B${HOME}/.guix-profile/avr/lib

include /gnu/store/k21m6b7c8bmzxk5x73zqm0qaz769lx2d-arduino-makefile-1.5.1/share/arduino/Arduino.mk

Then create a file Blink.ino in the same directory which contains:

void setup() {
}

void loop() {
}

Then run

$ make

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 0/5] gnu: Add Arduino tools
  2016-08-16 18:36 [PATCH 0/5] gnu: Add Arduino tools Danny Milosavljevic
                   ` (5 preceding siblings ...)
  2016-08-16 18:49 ` Maven Danny Milosavljevic
@ 2016-08-30  9:21 ` Ludovic Courtès
  6 siblings, 0 replies; 15+ messages in thread
From: Ludovic Courtès @ 2016-08-30  9:21 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

Hello,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> gnu: Add Arduino tools.
>
> Danny Milosavljevic (5):
>   gnu: Add "arduino" module.
>   gnu: arduino: Add "arduino-installer" helper.
>   gnu: arduino: Add arduino-hardware
>   gnu: arduino: Add arduino-libraries.
>   gnu: Add arduino-makefile.

Exciting stuff!

There were a few minor nits that Eric pointed out.  Could you send an
updated patch taking them into account?

Thank you for taking care of this!

Ludo’.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-08-30  9:21 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-16 18:36 [PATCH 0/5] gnu: Add Arduino tools Danny Milosavljevic
2016-08-16 18:36 ` [PATCH 1/5] gnu: Add "arduino" module Danny Milosavljevic
2016-08-16 22:40   ` Eric Bavier
2016-08-16 18:36 ` [PATCH 2/5] gnu: arduino: Add "arduino-installer" helper Danny Milosavljevic
2016-08-16 18:36 ` [PATCH 3/5] gnu: arduino: Add arduino-hardware Danny Milosavljevic
2016-08-16 22:53   ` Eric Bavier
2016-08-16 18:36 ` [PATCH 4/5] gnu: arduino: Add arduino-libraries Danny Milosavljevic
2016-08-16 22:56   ` Eric Bavier
2016-08-16 23:23     ` Danny Milosavljevic
2016-08-16 18:36 ` [PATCH 5/5] gnu: Add arduino-makefile Danny Milosavljevic
2016-08-17  5:02   ` Eric Bavier
2016-08-17  9:03     ` Danny Milosavljevic
2016-08-16 18:49 ` Maven Danny Milosavljevic
2016-08-17  6:16   ` Maven Ricardo Wurmus
2016-08-30  9:21 ` [PATCH 0/5] gnu: Add Arduino tools Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).