summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2017-05-07 21:40:59 +0200
committerRicardo Wurmus <rekado@elephly.net>2017-05-15 22:33:13 +0200
commit423b6840b3d7ada3b3c5fef7fdb64b8bbc1acb2b (patch)
tree67d39eeeffa7c27998be7e52d5fed5784d6d961b
parent18fe5ef1520ee085bf409ee983ed12baf20ea40e (diff)
gnu: Add java-usb4java.
* gnu/packages/libusb.scm (java-usb4java): New variable.
-rw-r--r--gnu/packages/libusb.scm60
1 files changed, 60 insertions, 0 deletions
diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index 3932f1e660d..ffbe5b1a881 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -28,6 +28,7 @@
28 #:use-module (guix utils) 28 #:use-module (guix utils)
29 #:use-module (guix download) 29 #:use-module (guix download)
30 #:use-module (guix git-download) 30 #:use-module (guix git-download)
31 #:use-module (guix build-system ant)
31 #:use-module (guix build-system cmake) 32 #:use-module (guix build-system cmake)
32 #:use-module (guix build-system gnu) 33 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system glib-or-gtk) 34 #:use-module (guix build-system glib-or-gtk)
@@ -129,6 +130,65 @@ version of libusb to run with newer libusb.")
129with usb4java.") 130with usb4java.")
130 (license expat)))) 131 (license expat))))
131 132
133(define-public java-usb4java
134 (package
135 (name "java-usb4java")
136 (version "1.2.0")
137 (source (origin
138 (method url-fetch)
139 (uri (string-append "https://github.com/usb4java/usb4java/"
140 "archive/usb4java-" version ".tar.gz"))
141 (sha256
142 (base32
143 "0gzpsnzwgsdyra3smq288yvxnwrgvdwxr6g8jbknnsk56kv6wc34"))))
144 (build-system ant-build-system)
145 (arguments
146 `(#:jar-name "usb4java.jar"
147 #:phases
148 (modify-phases %standard-phases
149 ;; Usually, native libusb4java libraries for all supported systems
150 ;; would be included in the jar and extracted at runtime. Since we
151 ;; build everything from source we cannot just bundle pre-built
152 ;; binaries for other systems. Instead, we patch the loader to
153 ;; directly return the appropriate library for this system. The
154 ;; downside is that the jar will only work on the same architecture
155 ;; that it was built on.
156 (add-after 'unpack 'copy-libusb4java
157 (lambda* (#:key inputs #:allow-other-keys)
158 (substitute* "src/main/java/org/usb4java/Loader.java"
159 (("private static String extractLibrary" line)
160 (string-append
161 line "(final String a, final String b) {"
162 "return \""
163 (assoc-ref inputs "libusb4java") "/lib/libusb4java.so"
164 "\"; }\n"
165 "private static String _extractLibrary")))
166 #t))
167 (add-after 'unpack 'disable-broken-tests
168 (lambda _
169 (with-directory-excursion "src/test/java/org/usb4java"
170 ;; These tests should only be run when USB devices are present.
171 (substitute* '("LibUsbGlobalTest.java"
172 "TransferTest.java")
173 (("this.context = new Context\\(\\);")
174 "this.context = null;")
175 (("LibUsb.init") "//"))
176 (substitute* "DeviceListIteratorTest.java"
177 (("this.iterator.remove" line)
178 (string-append "assumeUsbTestsEnabled();" line))))
179 #t)))))
180 (inputs
181 `(("libusb4java" ,libusb4java)
182 ("java-commons-lang3" ,java-commons-lang3)
183 ("java-junit" ,java-junit)
184 ("java-hamcrest-core" ,java-hamcrest-core)))
185 (home-page "http://usb4java.org/")
186 (synopsis "USB library for Java")
187 (description
188 "This package provides a USB library for Java based on libusb and
189implementing @code{javax.usb} (JSR-80).")
190 (license expat)))
191
132(define-public python-pyusb 192(define-public python-pyusb
133 (package 193 (package
134 (name "python-pyusb") 194 (name "python-pyusb")