From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Bavier Subject: Re: [PATCH 5/5] gnu: Add arduino-makefile. Date: Wed, 17 Aug 2016 00:02:28 -0500 Message-ID: <20160817000228.116a0d10@openmailbox.org> References: <20160816183632.30820-1-dannym@scratchpost.org> <20160816183632.30820-6-dannym@scratchpost.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZszv-0002YG-W0 for guix-devel@gnu.org; Wed, 17 Aug 2016 01:02:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZszs-0004NA-Qo for guix-devel@gnu.org; Wed, 17 Aug 2016 01:02:39 -0400 Received: from mail2.openmailbox.org ([62.4.1.33]:34872) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZszs-0004N6-E9 for guix-devel@gnu.org; Wed, 17 Aug 2016 01:02:36 -0400 In-Reply-To: <20160816183632.30820-6-dannym@scratchpost.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Danny Milosavljevic Cc: guix-devel@gnu.org On Tue, 16 Aug 2016 20:36:32 +0200 Danny Milosavljevic 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