unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#27537] [PATCH 0/6] Axoloti
@ 2017-06-30 12:04 Ricardo Wurmus
  2017-06-30 12:25 ` [bug#27537] [PATCH 1/6] gnu: Add java-classpathx-servletapi Ricardo Wurmus
  0 siblings, 1 reply; 12+ messages in thread
From: Ricardo Wurmus @ 2017-06-30 12:04 UTC (permalink / raw)
  To: 27537; +Cc: Ricardo Wurmus

Hi Guix,

this patch set adds a package for the Axoloti patcher.  The Axoloti is a very
cool audio development board with a free hardware design.  It comes with a
patcher application that looks a lot like what Pd provides.  That application
is written in Java, so it took me a long time to get it packaged.

Here it is!

I'm not sure about "java-slf4j-api", because I get an error not only when
running the tests but also when using the patcher application.  It's troubling
but seems not to represent a big problem.  Still, I think we should fix it.

"java-classpathx-servletapi" is an implementation of the servlet API.  I'm
very happy that this package exists, because the only alternative would have
been to package Apache Tomcat (and that's really hard).

Thanks in advance for taking the time to review this!

~~ Ricardo

Ricardo Wurmus (6):
  gnu: Add java-classpathx-servletapi
  gnu: Add java-javaewah.
  gnu: Add java-slf4j-api.
  gnu: Add java-jgit.
  gnu: Add java-jgit-4.2.
  gnu: Add Axoloti.

 gnu/local.mk                                  |   2 +
 gnu/packages/axoloti.scm                      | 322 ++++++++++++++++++++++++++
 gnu/packages/java.scm                         | 102 ++++++++
 gnu/packages/patches/libusb-for-axoloti.patch |  14 ++
 gnu/packages/version-control.scm              |  68 +++++-
 5 files changed, 507 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/axoloti.scm
 create mode 100644 gnu/packages/patches/libusb-for-axoloti.patch

-- 
2.12.2

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

* [bug#27537] [PATCH 1/6] gnu: Add java-classpathx-servletapi
  2017-06-30 12:04 [bug#27537] [PATCH 0/6] Axoloti Ricardo Wurmus
@ 2017-06-30 12:25 ` Ricardo Wurmus
  2017-06-30 12:25   ` [bug#27537] [PATCH 2/6] gnu: Add java-javaewah Ricardo Wurmus
                     ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Ricardo Wurmus @ 2017-06-30 12:25 UTC (permalink / raw)
  To: 27537; +Cc: Ricardo Wurmus

* gnu/packages/java.scm (java-classpathx-servletapi): New variable.
---
 gnu/packages/java.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index e074dab46..572a22767 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1868,6 +1868,41 @@ designs.")
                      license:asl2.0
                      license:cpl1.0)))))
 
+(define-public java-classpathx-servletapi
+  (package
+    (name "java-classpathx-servletapi")
+    (version "3.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://gnu/classpathx/servletapi/"
+                                  "servletapi-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0y9489pk4as9q6x300sk3ycc0psqfxcd4b0xvbmf3rhgli8q1kx3"))))
+    (build-system ant-build-system)
+    (arguments
+     `(#:tests? #f ; there is no test target
+       #:build-target "compile"
+       ;; NOTE: This package does not build with Java 8 because of a type
+       ;; mismatch in
+       ;; "source/javax/servlet/jsp/el/ImplicitObjectELResolver.java".  It
+       ;; defines the return value of ScopeMap's "remove" method to be of type
+       ;; "Object", whereas Map's "remove" method returns boolean.
+       #:make-flags
+       (list "-Dbuild.compiler=javac1.7"
+             (string-append "-Ddist=" (assoc-ref %outputs "out")))
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'install
+           (lambda* (#:key make-flags #:allow-other-keys)
+             (zero? (apply system* `("ant" "dist" ,@make-flags))))))))
+    (home-page "https://www.gnu.org/software/classpathx/")
+    (synopsis "Java servlet API implementation")
+    (description "This is the GNU servlet API distribution, part of the
+ClasspathX project.  It provides implementations of version 3.0 of the servlet
+API and version 2.1 of the Java ServerPages API.")
+    (license license:gpl3+)))
+
 (define-public java-swt
   (package
     (name "java-swt")
-- 
2.12.2

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

* [bug#27537] [PATCH 2/6] gnu: Add java-javaewah.
  2017-06-30 12:25 ` [bug#27537] [PATCH 1/6] gnu: Add java-classpathx-servletapi Ricardo Wurmus
@ 2017-06-30 12:25   ` Ricardo Wurmus
  2017-07-31 15:30     ` Ludovic Courtès
  2017-06-30 12:25   ` [bug#27537] [PATCH 3/6] gnu: Add java-slf4j-api Ricardo Wurmus
                     ` (4 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Ricardo Wurmus @ 2017-06-30 12:25 UTC (permalink / raw)
  To: 27537; +Cc: Ricardo Wurmus

* gnu/packages/java.scm (java-javaewah): New variable.
---
 gnu/packages/java.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 572a22767..d8f5eacc1 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -4121,6 +4121,36 @@ for your architecture which is provided by the jsvc package.
 This is a part of the Apache Commons Project.")
     (license license:asl2.0)))
 
+(define-public java-javaewah
+  (package
+    (name "java-javaewah")
+    (version "1.1.6")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/lemire/javaewah/"
+                                  "archive/JavaEWAH-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1n7j1r1h24wlhwv9zdcj6yqjrhma2ixwyzm15l5vrv6yqjs6753b"))))
+    (build-system ant-build-system)
+    (arguments `(#:jar-name "javaewah.jar"))
+    (inputs
+     `(("java-junit" ,java-junit)
+       ("java-hamcrest-core" ,java-hamcrest-core)))
+    (home-page "https://github.com/lemire/javaewah")
+    (synopsis "Compressed alternative to the Java @code{BitSet} class")
+    (description "This is a word-aligned compressed variant of the Java
+@code{Bitset} class.  It provides both a 64-bit and a 32-bit RLE-like
+compression scheme.  It can be used to implement bitmap indexes.
+
+The goal of word-aligned compression is not to achieve the best compression,
+but rather to improve query processing time. Hence, JavaEWAH tries to save CPU
+cycles, maybe at the expense of storage.  However, the EWAH scheme is always
+more efficient storage-wise than an uncompressed bitmap (as implemented in the
+@code{BitSet} class by Sun).")
+    ;; GPL2.0 derivates are explicitly allowed.
+    (license license:asl2.0)))
+
 (define-public antlr2
   (package
     (name "antlr2")
-- 
2.12.2

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

* [bug#27537] [PATCH 3/6] gnu: Add java-slf4j-api.
  2017-06-30 12:25 ` [bug#27537] [PATCH 1/6] gnu: Add java-classpathx-servletapi Ricardo Wurmus
  2017-06-30 12:25   ` [bug#27537] [PATCH 2/6] gnu: Add java-javaewah Ricardo Wurmus
@ 2017-06-30 12:25   ` Ricardo Wurmus
  2017-06-30 12:25   ` [bug#27537] [PATCH 4/6] gnu: Add java-jgit Ricardo Wurmus
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Ricardo Wurmus @ 2017-06-30 12:25 UTC (permalink / raw)
  To: 27537; +Cc: Ricardo Wurmus

* gnu/packages/java.scm (java-slf4j-api): New variable.
---
 gnu/packages/java.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index d8f5eacc1..f23138050 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -4151,6 +4151,43 @@ more efficient storage-wise than an uncompressed bitmap (as implemented in the
     ;; GPL2.0 derivates are explicitly allowed.
     (license license:asl2.0)))
 
+(define-public java-slf4j-api
+  (package
+    (name "java-slf4j-api")
+    (version "1.7.25")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://www.slf4j.org/dist/slf4j-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "13j51sgzmhhdrfa74gkal5zpip7r1440dh7zsi2c8bpb2zs1v8kb"))
+              (modules '((guix build utils)))
+              ;; Delete bundled jars.
+              (snippet
+               '(begin
+                  (for-each delete-file (find-files "." "\\.jar$"))
+                  #t))))
+    (build-system ant-build-system)
+    (arguments
+     ;; FIXME: org.slf4j.NoBindingTest fails with the ominous "This code
+     ;; should have never made it into slf4j-api.jar".
+     `(#:tests? #f
+       #:jar-name "slf4j-api.jar"
+       #:source-dir "slf4j-api/src/main"
+       #:test-dir "slf4j-api/src/test"))
+    (inputs
+     `(("java-junit" ,java-junit)
+       ("java-hamcrest-core" ,java-hamcrest-core)))
+    (home-page "https://www.slf4j.org/")
+    (synopsis "Simple logging facade for Java")
+    (description "The Simple Logging Facade for Java (SLF4J) serves as a
+simple facade or abstraction for various logging
+frameworks (e.g. @code{java.util.logging}, @code{logback}, @code{log4j})
+allowing the end user to plug in the desired logging framework at deployment
+time.")
+    (license license:expat)))
+
 (define-public antlr2
   (package
     (name "antlr2")
-- 
2.12.2

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

* [bug#27537] [PATCH 4/6] gnu: Add java-jgit.
  2017-06-30 12:25 ` [bug#27537] [PATCH 1/6] gnu: Add java-classpathx-servletapi Ricardo Wurmus
  2017-06-30 12:25   ` [bug#27537] [PATCH 2/6] gnu: Add java-javaewah Ricardo Wurmus
  2017-06-30 12:25   ` [bug#27537] [PATCH 3/6] gnu: Add java-slf4j-api Ricardo Wurmus
@ 2017-06-30 12:25   ` Ricardo Wurmus
  2017-06-30 12:25   ` [bug#27537] [PATCH 5/6] gnu: Add java-jgit-4.2 Ricardo Wurmus
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Ricardo Wurmus @ 2017-06-30 12:25 UTC (permalink / raw)
  To: 27537; +Cc: Ricardo Wurmus

* gnu/packages/version-control.scm (java-jgit): New variable.
---
 gnu/packages/version-control.scm | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index fd73f8f34..7cbee01a8 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -8,7 +8,7 @@
 ;;; Copyright © 2014, 2016 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2015, 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2015 Kyle Meyer <kyle@kyleam.com>
-;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2016, 2017 ng0 <contact.ng0@cryptolab.net>
 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
@@ -37,6 +37,7 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix build-system ant)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system haskell)
@@ -56,6 +57,7 @@
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages groff)
   #:use-module (gnu packages haskell)
+  #:use-module (gnu packages java)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages nano)
   #:use-module (gnu packages ncurses)
@@ -1476,3 +1478,36 @@ patches.
 unique algebra of patches called @url{http://darcs.net/Theory,Patchtheory}.
 @end enumerate")
     (license license:gpl2)))
+
+(define-public java-jgit
+  (package
+    (name "java-jgit")
+    (version "4.7.0.201704051617-r")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://repo1.maven.org/maven2/"
+                                  "org/eclipse/jgit/org.eclipse.jgit/"
+                                  version "/org.eclipse.jgit-"
+                                  version "-sources.jar"))
+              (sha256
+               (base32
+                "13ii4jn02ynzq6i7gsyi21k2i94jpc85wf6bcm31q4cyvzv0mk4k"))))
+    (build-system ant-build-system)
+    (arguments
+     `(#:tests? #f                      ; There are no tests to run.
+       #:jar-name "jgit.jar"
+       ;; JGit must be built with a JDK supporting Java 8.
+       #:jdk ,icedtea-8
+       ;; Target our older default JDK.
+       #:make-flags (list "-Dtarget=1.7")))
+    (inputs
+     `(("java-classpathx-servletapi" ,java-classpathx-servletapi)
+       ("java-javaewah" ,java-javaewah)
+       ("java-jsch" ,java-jsch)
+       ("java-slf4j-api" ,java-slf4j-api)))
+    (home-page "https://eclipse.org/jgit/")
+    (synopsis "Java library implementing the Git version control system")
+    (description "JGit is a lightweight, pure Java library implementing the
+Git version control system, providing repository access routines, support for
+network protocols, and core version control algorithms.")
+    (license license:edl1.0)))
-- 
2.12.2

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

* [bug#27537] [PATCH 5/6] gnu: Add java-jgit-4.2.
  2017-06-30 12:25 ` [bug#27537] [PATCH 1/6] gnu: Add java-classpathx-servletapi Ricardo Wurmus
                     ` (2 preceding siblings ...)
  2017-06-30 12:25   ` [bug#27537] [PATCH 4/6] gnu: Add java-jgit Ricardo Wurmus
@ 2017-06-30 12:25   ` Ricardo Wurmus
  2017-06-30 12:25   ` [bug#27537] [PATCH 6/6] gnu: Add Axoloti Ricardo Wurmus
  2017-07-31 15:29   ` [bug#27537] [PATCH 1/6] gnu: Add java-classpathx-servletapi Ludovic Courtès
  5 siblings, 0 replies; 12+ messages in thread
From: Ricardo Wurmus @ 2017-06-30 12:25 UTC (permalink / raw)
  To: 27537; +Cc: Ricardo Wurmus

* gnu/packages/version-control.scm (java-jgit-4.2): New variable.
---
 gnu/packages/version-control.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 7cbee01a8..465cdc997 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -1511,3 +1511,34 @@ unique algebra of patches called @url{http://darcs.net/Theory,Patchtheory}.
 Git version control system, providing repository access routines, support for
 network protocols, and core version control algorithms.")
     (license license:edl1.0)))
+
+;; For axoloti.  This package can still be built with icedtea-7, which is
+;; currently used as the default JDK.
+(define-public java-jgit-4.2
+  (package (inherit java-jgit)
+    (version "4.2.0.201601211800-r")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://repo1.maven.org/maven2/"
+                                  "org/eclipse/jgit/org.eclipse.jgit/"
+                                  version "/org.eclipse.jgit-"
+                                  version "-sources.jar"))
+              (sha256
+               (base32
+                "15gm537iivhnzlkjym4x3wn5jqdjdragsw9pdpzqqg21nrc817mm"))))
+    (build-system ant-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'use-latest-javaewah-API
+           (lambda _
+             (substitute* "src/org/eclipse/jgit/internal/storage/file/BitmapIndexImpl.java"
+               (("wordinbits") "WORD_IN_BITS"))
+             #t)))
+       ;; Build for default JDK.
+       ,@(substitute-keyword-arguments (package-arguments java-jgit)
+           ((#:jdk _) icedtea-7))))
+    (inputs
+     `(("java-javaewah" ,java-javaewah)
+       ("java-jsch" ,java-jsch)
+       ("java-slf4j-api" ,java-slf4j-api)))))
-- 
2.12.2

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

* [bug#27537] [PATCH 6/6] gnu: Add Axoloti.
  2017-06-30 12:25 ` [bug#27537] [PATCH 1/6] gnu: Add java-classpathx-servletapi Ricardo Wurmus
                     ` (3 preceding siblings ...)
  2017-06-30 12:25   ` [bug#27537] [PATCH 5/6] gnu: Add java-jgit-4.2 Ricardo Wurmus
@ 2017-06-30 12:25   ` Ricardo Wurmus
  2017-06-30 21:08     ` Ricardo Wurmus
  2017-07-31 15:29   ` [bug#27537] [PATCH 1/6] gnu: Add java-classpathx-servletapi Ludovic Courtès
  5 siblings, 1 reply; 12+ messages in thread
From: Ricardo Wurmus @ 2017-06-30 12:25 UTC (permalink / raw)
  To: 27537; +Cc: Ricardo Wurmus

* gnu/packages/axoloti.scm: New file.
* gnu/packages/patches/libusb-for-axoloti.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add patch.
(GNU_SYSTEM_MODULES): Add module.
---
 gnu/local.mk                                  |   2 +
 gnu/packages/axoloti.scm                      | 322 ++++++++++++++++++++++++++
 gnu/packages/patches/libusb-for-axoloti.patch |  14 ++
 3 files changed, 338 insertions(+)
 create mode 100644 gnu/packages/axoloti.scm
 create mode 100644 gnu/packages/patches/libusb-for-axoloti.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 83b019605..456b5dce7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -65,6 +65,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/autotools.scm			\
   %D%/packages/avahi.scm			\
   %D%/packages/avr.scm				\
+  %D%/packages/axoloti.scm			\
   %D%/packages/backup.scm			\
   %D%/packages/base.scm				\
   %D%/packages/bash.scm				\
@@ -780,6 +781,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/libtorrent-rasterbar-boost-compat.patch	\
   %D%/packages/patches/libtool-skip-tests2.patch		\
   %D%/packages/patches/libunwind-CVE-2015-3239.patch		\
+  %D%/packages/patches/libusb-for-axoloti.patch			\
   %D%/packages/patches/libvpx-CVE-2016-2818.patch		\
   %D%/packages/patches/libxcb-python-3.5-compat.patch		\
   %D%/packages/patches/libxml2-CVE-2016-4658.patch		\
diff --git a/gnu/packages/axoloti.scm b/gnu/packages/axoloti.scm
new file mode 100644
index 000000000..79a2150cf
--- /dev/null
+++ b/gnu/packages/axoloti.scm
@@ -0,0 +1,322 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
+;;;
+;;; 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 axoloti)
+  #:use-module (guix utils)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system ant)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages cross-base)
+  #:use-module (gnu packages embedded)
+  #:use-module (gnu packages flashing-tools)
+  #:use-module (gnu packages java)
+  #:use-module (gnu packages libusb)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages textutils)
+  #:use-module (gnu packages version-control)
+  #:use-module (gnu packages xml)
+  #:use-module (gnu packages zip))
+
+(define libusb-for-axoloti
+  (package (inherit libusb)
+    (name "axoloti-libusb")
+    (version (package-version libusb))
+    (source
+     (origin
+       (inherit (package-source libusb))
+       (patches (list (search-patch "libusb-for-axoloti.patch")))))))
+
+(define dfu-util-for-axoloti
+  (package (inherit dfu-util)
+    (name "axoloti-dfu-util")
+    (version "0.8")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://dfu-util.sourceforge.net/releases/"
+                           "dfu-util-" version ".tar.gz"))
+       (sha256
+        (base32
+         "0n7h08avlzin04j93m6hkq9id6hxjiiix7ff9gc2n89aw6dxxjsm"))))
+    (inputs
+     `(("libusb" ,libusb-for-axoloti)))))
+
+(define-public axoloti
+  (package
+    (name "axoloti")
+    (version "1.0.12")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/axoloti/axoloti/"
+                                  "archive/" version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1dynk6h0nixp4zihpirpqa4vi8fq1lhm443jsmvhk135ykhf364p"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; Remove pre-built Java binaries.
+                  (delete-file-recursively "lib/")
+                  #t))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; no check target
+       #:modules ((guix build gnu-build-system)
+                  ((guix build ant-build-system) #:prefix ant:)
+                  (guix build utils)
+                  (srfi srfi-1)
+                  (srfi srfi-26)
+                  (ice-9 match)
+                  (ice-9 regex)
+                  (sxml simple)
+                  (sxml xpath)
+                  (sxml transform))
+       #:imported-modules ((guix build ant-build-system)
+                           (guix build syscalls)
+                           ,@%gnu-build-system-modules)
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-paths
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; prepare ChibiOS
+             (and (zero? (system* "unzip" "-o" (assoc-ref inputs "chibios")))
+                  (zero? (system* "mv" "ChibiOS_2.6.9" "chibios"))
+                  (with-directory-excursion "chibios/ext"
+                    (zero? (system* "unzip" "-o" "fatfs-0.9-patched.zip"))))
+
+             ;; Remove source of non-determinism in ChibiOS
+             (substitute* "chibios/os/various/shell.c"
+               (("#ifdef __DATE__") "#if 0"))
+
+             ;; Patch shell paths
+             (substitute* '("src/main/java/qcmds/QCmdCompileFirmware.java"
+                            "src/main/java/qcmds/QCmdCompilePatch.java"
+                            "src/main/java/qcmds/QCmdFlashDFU.java")
+               (("/bin/sh") (which "sh")))
+
+             ;; Override cross compiler base name
+             (substitute* "firmware/Makefile.patch"
+               (("arm-none-eabi-(gcc|g\\+\\+|objcopy|objdump)" tool)
+                (which tool)))
+
+             ;; Hardcode full path to compiler tools
+             (substitute* '("firmware/Makefile"
+                            "firmware/flasher/Makefile"
+                            "firmware/mounter/Makefile")
+               (("TRGT =.*")
+                (string-append "TRGT = "
+                               (assoc-ref inputs "cross-toolchain")
+                               "/bin/arm-none-eabi-\n")))
+
+             ;; Hardcode path to "make"
+             (substitute* '("firmware/compile_firmware_linux.sh"
+                            "firmware/compile_patch_linux.sh")
+               (("make") (which "make")))
+
+             ;; Hardcode path to "dfu-util"
+             (substitute* "platform_linux/upload_fw_dfu.sh"
+               (("-f \"\\$\\{platformdir\\}/bin/dfu-util\"") "-z \"\"")
+               (("\\./dfu-util") (which "dfu-util")))
+             #t))
+         (delete 'configure)
+         (replace 'build
+           ;; Build Axoloti firmware with cross-compiler
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let* ((toolchain (assoc-ref inputs "cross-toolchain"))
+                    (headers   (string-append
+                                toolchain
+                                "/arm-none-eabi/include:"
+                                toolchain
+                                "/arm-none-eabi/include/arm-none-eabi/armv7e-m")))
+               (setenv "CROSS_CPATH" headers)
+               (setenv "CROSS_CPLUS_INCLUDE_PATH" headers)
+               (setenv "CROSS_LIBRARY_PATH"
+                       (string-append toolchain
+                                      "/arm-none-eabi/lib")))
+             (with-directory-excursion "platform_linux"
+               (zero? (system* "sh" "compile_firmware.sh")))))
+         (add-after 'build 'build-java-application
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "JAVA_HOME" (assoc-ref inputs "icedtea"))
+             ;; We want to use our own jar files instead of the pre-built
+             ;; stuff in lib.  So we replace the zipfileset tags in the
+             ;; build.xml with new ones that reference our jars.
+             (let* ((build.xml (with-input-from-file "build.xml"
+                                 (lambda _
+                                   (xml->sxml #:trim-whitespace? #t))))
+                    (jars      (append-map (match-lambda
+                                             (((? (cut string-prefix? "java-" <>)
+                                                  label) . directory)
+                                              (find-files directory "\\.jar$"))
+                                             (_ '()))
+                                           inputs))
+                    (classpath (string-join jars ":"))
+                    (fileset   (map (lambda (jar)
+                                      `(zipfileset (@ (excludes "META-INF/*.SF")
+                                                      (src ,jar))))
+                                    jars)))
+               (call-with-output-file "build.xml"
+                 (lambda (port)
+                   (sxml->xml
+                    (pre-post-order
+                     build.xml
+                     `(;; Remove all zipfileset tags from the "jar" tree and
+                       ;; inject our own tags.
+                       (jar . ,(lambda (tag . kids)
+                                 `(jar ,@(append-map
+                                          (filter (lambda (e)
+                                                    (not (eq? 'zipfileset (car e)))))
+                                          kids)
+                                       ,@fileset)))
+                       ;; Skip the "bundle" target (and the "-post-jar" target
+                       ;; that depends on it), because we don't need it and it
+                       ;; confuses sxml->xml.
+                       (target . ,(lambda (tag . kids)
+                                    (let ((name ((sxpath '(name *text*))
+                                                 (car kids))))
+                                      (if (or (member "bundle" name)
+                                              (member "-post-jar" name))
+                                          '() ; skip
+                                          `(,tag ,@kids)))))
+                       (*default*  . ,(lambda (tag . kids) `(,tag ,@kids)))
+                       (*text*     . ,(lambda (_ txt)
+                                        (match txt
+                                          ;; Remove timestamp.
+                                          ("${TODAY}" "(unknown)")
+                                          (_ txt))))))
+                    port)))
+
+               ;; Build it!
+               (zero? (system* "ant"
+                               (string-append "-Djavac.classpath=" classpath)
+                               "-Dbuild.runtime=true"
+                               "-Dbuild.time=01/01/1970 00:00:00"
+                               "-Djavac.source=1.7"
+                               "-Djavac.target=1.7"
+                               (string-append "-Dtag.short.version="
+                                              ,version))))))
+         (replace 'install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out   (assoc-ref outputs "out"))
+                    (share (string-append out "/share/axoloti/"))
+                    (doc   (string-append share "doc"))
+                    (dir   (getcwd))
+                    ;; These patterns were derived from the "bundle" target of
+                    ;; the build.xml.
+                    (pats  '("/doc/[^/]+$"
+                             "/patches/[^/]+/[^/]+$"
+                             "/objects/[^/]+/[^/]+$"
+                             "/firmware/[^/]+$"
+                             "/firmware/STM[^/]+/[^/]+/[^/]+$"
+                             "/firmware/samples/[^/]+$"
+                             "/firmware/build/[^/]+\\.(bin|elf)$"
+                             "/firmware/flasher/[^/]+$"
+                             "/firmware/flasher/flasher_build/[^/]+\\.(bin|elf)$"
+                             "/firmware/mounter/[^/]+$"
+                             "/firmware/mounter/mounter_build/[^/]+\\.(bin|elf)$"
+                             "/chibios/[^/]+$"
+                             "/chibios/boards/ST_STM32F4_DISCOVERY/[^/]+$"
+                             "/chibios/(ext|os|docs)/[^/]+/[^/]+$"
+                             "/CMSIS/[^/]+/[^/]+$"
+                             "/patch/[^/]+/[^/]+$"
+                             "/[^/]+\\.txt$"))
+                    (pattern (string-append
+                              "(" (string-join
+                                   (map (cut string-append dir <>)
+                                        pats)
+                                   "|") ")"))
+                    (files   (find-files dir
+                                         (lambda (file stat)
+                                           (and (eq? 'regular (stat:type stat))
+                                                (string-match pattern file))))))
+               (for-each (lambda (file)
+                           (install-file file
+                                         (string-append share (dirname file))))
+                         files)
+               (copy-recursively "dist/javadoc" doc)
+               (install-file "dist/Axoloti.jar" share)
+
+               ;; We do this to ensure that this package retains references to
+               ;; other Java packages' jar files.
+               (install-file "build.xml" share)
+
+               ;; Create a launcher script
+               (mkdir (string-append out "/bin"))
+               (let ((target (string-append out "/bin/Axoloti")))
+                 (with-output-to-file target
+                   (lambda ()
+                     (let* ((dir       (string-append (assoc-ref outputs "out")
+                                                      "/share/axoloti"))
+                            (toolchain (assoc-ref inputs "cross-toolchain"))
+                            (includes  (string-append
+                                        toolchain
+                                        "/arm-none-eabi/include:"
+                                        toolchain
+                                        "/arm-none-eabi/include/arm-none-eabi/armv7e-m")))
+                       (display
+                        (string-append "#!" (which "sh") "\n"
+                                       "export CROSS_CPATH=" includes "\n"
+                                       "export CROSS_CPLUS_INCLUDE_PATH=" includes "\n"
+                                       "export CROSS_LIBRARY_PATH="
+                                       toolchain "/arm-none-eabi/lib" "\n"
+                                       (which "java")
+                                       " -Daxoloti_release=" dir
+                                       " -Daxoloti_runtime=" dir
+                                       " -jar " dir "/Axoloti.jar")))))
+                 (chmod target #o555))
+               #t)))
+         (add-after 'install 'strip-jar-timestamps
+           (assoc-ref ant:%standard-phases 'strip-jar-timestamps)))))
+    (inputs
+     `(("icedtea" ,icedtea "jdk")
+       ("java-simple-xml" ,java-simple-xml)
+       ("java-rsyntaxtextarea" ,java-rsyntaxtextarea)
+       ("java-usb4java" ,java-usb4java)
+       ("java-jsch" ,java-jsch)
+       ("java-slf4j-api" ,java-slf4j-api)
+       ("java-jgit" ,java-jgit-4.2)
+       ;; for the firmware
+       ("chibios"
+        ,(origin
+           (method url-fetch)
+           (uri "mirror://sourceforge/chibios/ChibiOS_RT%20stable/Version%202.6.9/ChibiOS_2.6.9.zip")
+           (sha256
+            (base32
+             "0lb5s8pkj80mqhsy47mmq0lqk34s2a2m3xagzihalvabwd0frhlj"))))
+       ;; for compiling patches
+       ("make" ,gnu-make)
+       ;; for compiling firmware
+       ("cross-toolchain" ,arm-none-eabi-nano-toolchain-4.9)
+       ;; for uploading compiled patches and firmware
+       ("dfu-util" ,dfu-util-for-axoloti)))
+    (native-inputs
+     `(("ant" ,ant)
+       ("zip" ,zip) ; for repacking the jar
+       ("unzip" ,unzip)))
+    (home-page "http://axoloti.com")
+    (synopsis "Audio development environment for the Axoloti core board")
+    (description
+     "The Axoloti patcher offers a “patcher” environment similar to Pure Data
+for sketching digital audio algorithms.  The patches run on a standalone
+powerful microcontroller board: Axoloti Core.")
+    (license license:gpl3+)))
diff --git a/gnu/packages/patches/libusb-for-axoloti.patch b/gnu/packages/patches/libusb-for-axoloti.patch
new file mode 100644
index 000000000..2c07d767d
--- /dev/null
+++ b/gnu/packages/patches/libusb-for-axoloti.patch
@@ -0,0 +1,14 @@
+diff -rp -u4 libusb-1.0.19-orig/libusb/descriptor.c libusb-1.0.19/libusb/descriptor.c
+--- libusb-1.0.19-orig/libusb/descriptor.c	2015-05-12 00:15:19 +0200
++++ libusb-1.0.19/libusb/descriptor.c	2015-05-12 00:17:09 +0200
+@@ -1181,9 +1181,9 @@ int API_EXPORTED libusb_get_string_descr
+ 	if (tbuf[1] != LIBUSB_DT_STRING)
+ 		return LIBUSB_ERROR_IO;
+ 
+ 	if (tbuf[0] > r)
+-		return LIBUSB_ERROR_IO;
++            tbuf[0] = r;
+ 
+ 	for (di = 0, si = 2; si < tbuf[0]; si += 2) {
+ 		if (di >= (length - 1))
+ 			break;
-- 
2.12.2

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

* [bug#27537] [PATCH 6/6] gnu: Add Axoloti.
  2017-06-30 12:25   ` [bug#27537] [PATCH 6/6] gnu: Add Axoloti Ricardo Wurmus
@ 2017-06-30 21:08     ` Ricardo Wurmus
  2017-07-31 15:31       ` Ludovic Courtès
  2017-10-17 14:57       ` bug#27537: " Ricardo Wurmus
  0 siblings, 2 replies; 12+ messages in thread
From: Ricardo Wurmus @ 2017-06-30 21:08 UTC (permalink / raw)
  To: 27537


Ricardo Wurmus <rekado@elephly.net> writes:

> * gnu/packages/axoloti.scm: New file.
> * gnu/packages/patches/libusb-for-axoloti.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add patch.
> (GNU_SYSTEM_MODULES): Add module.

Annoyingly, this package appears to have a couple of problems, so I’ll
send an update version later.  The Java dependencies in this series
should be okay, though.

(One thing that bit me during testing is that “guix gc” is going to
remove some of the Java dependencies.  We really should install a file
with references to prevent garbage collection for Java packages.)

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net

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

* [bug#27537] [PATCH 1/6] gnu: Add java-classpathx-servletapi
  2017-06-30 12:25 ` [bug#27537] [PATCH 1/6] gnu: Add java-classpathx-servletapi Ricardo Wurmus
                     ` (4 preceding siblings ...)
  2017-06-30 12:25   ` [bug#27537] [PATCH 6/6] gnu: Add Axoloti Ricardo Wurmus
@ 2017-07-31 15:29   ` Ludovic Courtès
  5 siblings, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2017-07-31 15:29 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: 27537

Ricardo Wurmus <rekado@elephly.net> skribis:

> * gnu/packages/java.scm (java-classpathx-servletapi): New variable.

LGTM, thanks!

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

* [bug#27537] [PATCH 2/6] gnu: Add java-javaewah.
  2017-06-30 12:25   ` [bug#27537] [PATCH 2/6] gnu: Add java-javaewah Ricardo Wurmus
@ 2017-07-31 15:30     ` Ludovic Courtès
  0 siblings, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2017-07-31 15:30 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: 27537

Ricardo Wurmus <rekado@elephly.net> skribis:

> * gnu/packages/java.scm (java-javaewah): New variable.

LGTM!

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

* [bug#27537] [PATCH 6/6] gnu: Add Axoloti.
  2017-06-30 21:08     ` Ricardo Wurmus
@ 2017-07-31 15:31       ` Ludovic Courtès
  2017-10-17 14:57       ` bug#27537: " Ricardo Wurmus
  1 sibling, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2017-07-31 15:31 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: 27537

Ricardo Wurmus <rekado@elephly.net> skribis:

> Annoyingly, this package appears to have a couple of problems, so I’ll
> send an update version later.  The Java dependencies in this series
> should be okay, though.

Yes, and I just noticed that the Java dependencies were already in
master, which is good.

Thanks,
Ludo’.

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

* bug#27537: [PATCH 6/6] gnu: Add Axoloti.
  2017-06-30 21:08     ` Ricardo Wurmus
  2017-07-31 15:31       ` Ludovic Courtès
@ 2017-10-17 14:57       ` Ricardo Wurmus
  1 sibling, 0 replies; 12+ messages in thread
From: Ricardo Wurmus @ 2017-10-17 14:57 UTC (permalink / raw)
  To: 27537-done


Ricardo Wurmus <rekado@elephly.net> writes:

>> * gnu/packages/axoloti.scm: New file.
>> * gnu/packages/patches/libusb-for-axoloti.patch: New file.
>> * gnu/local.mk (dist_patch_DATA): Add patch.
>> (GNU_SYSTEM_MODULES): Add module.
>
> Annoyingly, this package appears to have a couple of problems, so I’ll
> send an update version later.  The Java dependencies in this series
> should be okay, though.

I fixed a problem in “java-jgit” and pushed an updated version of the
Axoloti patch with the “axoloti” package split into “axoloti-runtime”
and “axoloti-patcher”.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net

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

end of thread, other threads:[~2017-10-17 14:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-30 12:04 [bug#27537] [PATCH 0/6] Axoloti Ricardo Wurmus
2017-06-30 12:25 ` [bug#27537] [PATCH 1/6] gnu: Add java-classpathx-servletapi Ricardo Wurmus
2017-06-30 12:25   ` [bug#27537] [PATCH 2/6] gnu: Add java-javaewah Ricardo Wurmus
2017-07-31 15:30     ` Ludovic Courtès
2017-06-30 12:25   ` [bug#27537] [PATCH 3/6] gnu: Add java-slf4j-api Ricardo Wurmus
2017-06-30 12:25   ` [bug#27537] [PATCH 4/6] gnu: Add java-jgit Ricardo Wurmus
2017-06-30 12:25   ` [bug#27537] [PATCH 5/6] gnu: Add java-jgit-4.2 Ricardo Wurmus
2017-06-30 12:25   ` [bug#27537] [PATCH 6/6] gnu: Add Axoloti Ricardo Wurmus
2017-06-30 21:08     ` Ricardo Wurmus
2017-07-31 15:31       ` Ludovic Courtès
2017-10-17 14:57       ` bug#27537: " Ricardo Wurmus
2017-07-31 15:29   ` [bug#27537] [PATCH 1/6] gnu: Add java-classpathx-servletapi 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).