From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8Chq-0001LS-Ty for guix-patches@gnu.org; Tue, 09 May 2017 17:30:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8Chp-0001Yy-2R for guix-patches@gnu.org; Tue, 09 May 2017 17:30:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:60215) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d8Cho-0001Yu-VX for guix-patches@gnu.org; Tue, 09 May 2017 17:30:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d8Cho-0008UJ-OR for guix-patches@gnu.org; Tue, 09 May 2017 17:30:04 -0400 Subject: bug#26861: [PATCH 02/31] gnu: Add java-usb4java. Resent-Message-ID: From: Ricardo Wurmus Date: Tue, 9 May 2017 23:28:19 +0200 Message-Id: <20170509212848.14688-2-rekado@elephly.net> In-Reply-To: <20170509212848.14688-1-rekado@elephly.net> References: <20170509212848.14688-1-rekado@elephly.net> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 26861@debbugs.gnu.org Cc: Ricardo Wurmus * gnu/packages/libusb.scm (java-usb4java): New variable. --- gnu/packages/libusb.scm | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm index 3932f1e66..ffbe5b1a8 100644 --- a/gnu/packages/libusb.scm +++ b/gnu/packages/libusb.scm @@ -28,6 +28,7 @@ #:use-module (guix utils) #: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 glib-or-gtk) @@ -129,6 +130,65 @@ version of libusb to run with newer libusb.") with usb4java.") (license expat)))) +(define-public java-usb4java + (package + (name "java-usb4java") + (version "1.2.0") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/usb4java/usb4java/" + "archive/usb4java-" version ".tar.gz")) + (sha256 + (base32 + "0gzpsnzwgsdyra3smq288yvxnwrgvdwxr6g8jbknnsk56kv6wc34")))) + (build-system ant-build-system) + (arguments + `(#:jar-name "usb4java.jar" + #:phases + (modify-phases %standard-phases + ;; Usually, native libusb4java libraries for all supported systems + ;; would be included in the jar and extracted at runtime. Since we + ;; build everything from source we cannot just bundle pre-built + ;; binaries for other systems. Instead, we patch the loader to + ;; directly return the appropriate library for this system. The + ;; downside is that the jar will only work on the same architecture + ;; that it was built on. + (add-after 'unpack 'copy-libusb4java + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "src/main/java/org/usb4java/Loader.java" + (("private static String extractLibrary" line) + (string-append + line "(final String a, final String b) {" + "return \"" + (assoc-ref inputs "libusb4java") "/lib/libusb4java.so" + "\"; }\n" + "private static String _extractLibrary"))) + #t)) + (add-after 'unpack 'disable-broken-tests + (lambda _ + (with-directory-excursion "src/test/java/org/usb4java" + ;; These tests should only be run when USB devices are present. + (substitute* '("LibUsbGlobalTest.java" + "TransferTest.java") + (("this.context = new Context\\(\\);") + "this.context = null;") + (("LibUsb.init") "//")) + (substitute* "DeviceListIteratorTest.java" + (("this.iterator.remove" line) + (string-append "assumeUsbTestsEnabled();" line)))) + #t))))) + (inputs + `(("libusb4java" ,libusb4java) + ("java-commons-lang3" ,java-commons-lang3) + ("java-junit" ,java-junit) + ("java-hamcrest-core" ,java-hamcrest-core))) + (home-page "http://usb4java.org/") + (synopsis "USB library for Java") + (description + "This package provides a USB library for Java based on libusb and +implementing @code{javax.usb} (JSR-80).") + (license expat))) + (define-public python-pyusb (package (name "python-pyusb") -- 2.12.2