gnu: libusb-compat: Use the same home page as libusb.
[jackhill/guix/guix.git] / gnu / packages / libusb.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
3 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
5 ;;; Copyright © 2015, 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Theodoros Foradis <theodoros@foradis.org>
8 ;;; Copyright © 2017 Jonathan Brielmaier <jonathan.brielmaier@web.de>
9 ;;;
10 ;;; This file is part of GNU Guix.
11 ;;;
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
16 ;;;
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25 (define-module (gnu packages libusb)
26 #:use-module (gnu packages)
27 #:use-module (guix licenses)
28 #:use-module (guix packages)
29 #:use-module (guix utils)
30 #:use-module (guix download)
31 #:use-module (guix git-download)
32 #:use-module (guix build-system ant)
33 #:use-module (guix build-system cmake)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system glib-or-gtk)
36 #:use-module (guix build-system python)
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages gnupg)
39 #:use-module (gnu packages gtk)
40 #:use-module (gnu packages java)
41 #:use-module (gnu packages linux)
42 #:use-module (gnu packages mp3)
43 #:use-module (gnu packages pkg-config)
44 #:use-module (gnu packages python)
45 #:use-module (gnu packages xiph))
46
47 (define-public libusb
48 (package
49 (name "libusb")
50 (version "1.0.21")
51 (source
52 (origin
53 (method url-fetch)
54 (uri (string-append "mirror://sourceforge/libusb/libusb-1.0/"
55 "libusb-" version "/libusb-" version ".tar.bz2"))
56 (sha256
57 (base32
58 "0jw2n5kdnrqvp7zh792fd6mypzzfap6jp4gfcmq4n6c1kb79rkkx"))))
59 (build-system gnu-build-system)
60
61 ;; XXX: Enabling udev is now recommended, but eudev indirectly depends on
62 ;; libusb.
63 (arguments `(#:configure-flags '("--disable-udev")))
64 ;; (inputs `(("eudev" ,eudev)))
65
66 (home-page "http://libusb.info")
67 (synopsis "User-space USB library")
68 (description
69 "Libusb is a library that gives applications easy access to USB
70 devices on various operating systems.")
71 (license lgpl2.1+)))
72
73 (define-public libusb-compat
74 (package
75 (name "libusb-compat")
76 (version "0.1.5")
77 (source
78 (origin
79 (method url-fetch)
80 (uri (string-append "mirror://sourceforge/libusb/"
81 name "-" (version-major+minor version) "/"
82 name "-" version "/"
83 name "-" version ".tar.bz2"))
84 (sha256
85 (base32
86 "0nn5icrfm9lkhzw1xjvaks9bq3w6mjg86ggv3fn7kgi4nfvg8kj0"))))
87 (build-system gnu-build-system)
88 (native-inputs
89 `(("pkg-config" ,pkg-config)))
90 (inputs
91 `(("libusb" ,libusb)))
92 (home-page "http://libusb.info")
93 (synopsis "Compatibility shim for libusb")
94 (description
95 "Libusb-compat provides a shim allowing applications based on older
96 version of libusb to run with newer libusb.")
97 (license lgpl2.1+)))
98
99 ;; required by 0xffff, which compiles with libusb-compat, but executes only
100 ;; with libusb-0.1
101 (define-public libusb-0.1
102 (package (inherit libusb)
103 (version "0.1.12")
104 (source
105 (origin
106 (method url-fetch)
107 (uri (string-append "mirror://sourceforge/libusb/libusb-0.1 (LEGACY)/"
108 version "/libusb-" version ".tar.gz"))
109 (sha256
110 (base32
111 "0i4bacxkyr7xyqxbmb00ypkrv4swkgm0mghbzjsnw6blvvczgxip"))
112 (patches (search-patches "libusb-0.1-disable-tests.patch"))))))
113
114 (define-public libusb4java
115 ;; There is no public release so we take the latest version from git.
116 (let ((commit "396d642a57678a0d9663b062c980fe100cc0ea1e")
117 (revision "1"))
118 (package
119 (name "libusb4java")
120 (version (string-append "0-" revision "." (string-take commit 9)))
121 (source (origin
122 (method git-fetch)
123 (uri (git-reference
124 (url "https://github.com/usb4java/libusb4java.git")
125 (commit commit)))
126 (sha256
127 (base32
128 "0wqgapalhfh9v38ycbl6i2f5lh1wpr6fzwn5dwd0rdacypkd1gml"))))
129 (build-system cmake-build-system)
130 (arguments
131 `(#:tests? #f ; there are no tests
132 #:phases
133 (modify-phases %standard-phases
134 (add-before 'configure 'set-JAVA_HOME
135 (lambda* (#:key inputs #:allow-other-keys)
136 (setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
137 #t)))))
138 (inputs
139 `(("libusb" ,libusb)))
140 (native-inputs
141 `(("jdk" ,icedtea "jdk")))
142 (home-page "https://github.com/usb4java/libusb4java/")
143 (synopsis "JNI bindings to libusb")
144 (description
145 "This package provides Java JNI bindings to the libusb library for use
146 with usb4java.")
147 (license expat))))
148
149 (define-public java-usb4java
150 (package
151 (name "java-usb4java")
152 (version "1.2.0")
153 (source (origin
154 (method url-fetch)
155 (uri (string-append "https://github.com/usb4java/usb4java/"
156 "archive/usb4java-" version ".tar.gz"))
157 (sha256
158 (base32
159 "0gzpsnzwgsdyra3smq288yvxnwrgvdwxr6g8jbknnsk56kv6wc34"))))
160 (build-system ant-build-system)
161 (arguments
162 `(#:jar-name "usb4java.jar"
163 #:phases
164 (modify-phases %standard-phases
165 ;; Usually, native libusb4java libraries for all supported systems
166 ;; would be included in the jar and extracted at runtime. Since we
167 ;; build everything from source we cannot just bundle pre-built
168 ;; binaries for other systems. Instead, we patch the loader to
169 ;; directly return the appropriate library for this system. The
170 ;; downside is that the jar will only work on the same architecture
171 ;; that it was built on.
172 (add-after 'unpack 'copy-libusb4java
173 (lambda* (#:key inputs #:allow-other-keys)
174 (substitute* "src/main/java/org/usb4java/Loader.java"
175 (("private static String extractLibrary" line)
176 (string-append
177 line "(final String a, final String b) {"
178 "return \""
179 (assoc-ref inputs "libusb4java") "/lib/libusb4java.so"
180 "\"; }\n"
181 "private static String _extractLibrary")))
182 #t))
183 (add-after 'unpack 'disable-broken-tests
184 (lambda _
185 (with-directory-excursion "src/test/java/org/usb4java"
186 ;; These tests should only be run when USB devices are present.
187 (substitute* '("LibUsbGlobalTest.java"
188 "TransferTest.java")
189 (("this.context = new Context\\(\\);")
190 "this.context = null;")
191 (("LibUsb.init") "//"))
192 (substitute* "DeviceListIteratorTest.java"
193 (("this.iterator.remove" line)
194 (string-append "assumeUsbTestsEnabled();" line))))
195 #t)))))
196 (inputs
197 `(("libusb4java" ,libusb4java)
198 ("java-commons-lang3" ,java-commons-lang3)
199 ("java-junit" ,java-junit)
200 ("java-hamcrest-core" ,java-hamcrest-core)))
201 (home-page "http://usb4java.org/")
202 (synopsis "USB library for Java")
203 (description
204 "This package provides a USB library for Java based on libusb and
205 implementing @code{javax.usb} (JSR-80).")
206 (license expat)))
207
208 (define-public python-pyusb
209 (package
210 (name "python-pyusb")
211 (version "1.0.0")
212 (source
213 (origin
214 (method url-fetch)
215 (uri (pypi-uri "PyUSB" version))
216 (sha256
217 (base32
218 "0s2k4z06fapd5vp1gnrlf8a9sjpc03p9974lzw5k6ky39akzyd2v"))))
219 (build-system python-build-system)
220 (arguments
221 `(#:tests? #f ;no tests
222 #:modules ((srfi srfi-1)
223 (srfi srfi-26)
224 (guix build utils)
225 (guix build python-build-system))
226 #:phases
227 (modify-phases %standard-phases
228 (add-after 'unpack 'fix-libusb-reference
229 (lambda* (#:key inputs #:allow-other-keys)
230 (substitute* "usb/libloader.py"
231 (("lib = locate_library\\(candidates, find_library\\)")
232 (string-append
233 "lib = \""
234 (find (negate symbolic-link?)
235 (find-files (assoc-ref inputs "libusb")
236 "^libusb-.*\\.so\\..*"))
237 "\"")))
238 #t)))))
239 (inputs
240 `(("libusb" ,libusb)))
241 (home-page "http://walac.github.io/pyusb/")
242 (synopsis "Python bindings to the libusb library")
243 (description
244 "PyUSB aims to be an easy to use Python module to access USB devices.")
245 (license bsd-3)))
246
247 (define-public python2-pyusb
248 (package-with-python2 python-pyusb))
249
250 (define-public libmtp
251 (package
252 (name "libmtp")
253 (version "1.1.13")
254 (source (origin
255 (method url-fetch)
256 (uri (string-append "mirror://sourceforge/libmtp/libmtp/" version
257 "/libmtp-" version ".tar.gz"))
258 (sha256
259 (base32
260 "0h3dv9py5mmvxhfxmkr8ky4s80hgq3d66cmrfnnnlcdwpwpy0kj9"))))
261 (build-system gnu-build-system)
262 (native-inputs
263 `(("pkg-config" ,pkg-config)))
264 (propagated-inputs
265 ;; libmtp.pc refers to all these.
266 `(("libgcrypt" ,libgcrypt)
267 ("libusb" ,libusb)))
268 (arguments
269 `(#:configure-flags
270 (list (string-append "--with-udev="
271 (assoc-ref %outputs "out")
272 "/lib/udev"))))
273 (home-page "http://libmtp.sourceforge.net/")
274 (synopsis "Library implementing the Media Transfer Protocol")
275 (description "Libmtp implements an MTP (Media Transfer Protocol)
276 initiator, which means that it initiates MTP sessions with devices. The
277 devices responding are known as MTP responders. Libmtp runs on devices
278 with a USB host controller interface. It implements MTP Basic, which was
279 proposed for standardization.")
280 ;; COPYING contains lgpl2.1, while files headers give
281 ;; "GNU Lesser General Public License as published by the Free Software
282 ;; Foundation; either version 2 of the License, or (at your option) any
283 ;; later version."
284 (license lgpl2.1+)))
285
286 (define-public gmtp
287 (package
288 (name "gmtp")
289 (version "1.3.10")
290 (source (origin
291 (method url-fetch)
292 (uri (string-append "mirror://sourceforge/gmtp/gMTP-" version
293 "/gmtp-" version ".tar.gz"))
294 (sha256
295 (base32
296 "0fyi3pdl2g57vr0p46ip2wwzyap3l0by7iqaqygv0yxfcs79l6xj"))))
297 (build-system glib-or-gtk-build-system)
298 (arguments
299 '(#:configure-flags
300 (let ((libid3tag (assoc-ref %build-inputs "libid3tag")))
301 (list
302 ;; libid3tag provides no .pc file, so pkg-config fails to find them.
303 (string-append "ID3TAG_CFLAGS=-I" libid3tag "/include")
304 (string-append "ID3TAG_LIBS=-L" libid3tag "/lib -lid3tag -lz")))))
305 (inputs
306 `(("gtk+" ,gtk+)
307 ("flac" ,flac)
308 ("libvorbis" ,libvorbis)
309 ("libid3tag" ,libid3tag)
310 ("libmtp" ,libmtp)))
311 (native-inputs
312 `(("pkg-config" ,pkg-config)))
313 (home-page "http://gmtp.sourceforge.net/")
314 (synopsis "Simple graphical MTP client")
315 (description "gMTP is a simple graphical client for the Media Transfer Protocol
316 (MTP), which allows media files to be transferred to and from many portable
317 devices.")
318 (license bsd-3)))
319
320 (define-public hidapi
321 (package
322 (name "hidapi")
323 (version "0.8.0-rc1")
324 (source (origin
325 (method url-fetch)
326 (uri (string-append "https://github.com/signal11/hidapi/archive/hidapi-"
327 version ".tar.gz"))
328 (sha256
329 (base32
330 "0qdgyj9rgb7n0nk3ghfswrhzzknxqn4ibn3wj8g4r828pw07451w"))))
331 (build-system gnu-build-system)
332 (arguments
333 '(#:phases
334 (modify-phases %standard-phases
335 (add-after 'unpack 'bootstrap
336 (lambda _
337 (zero? (system* "autoreconf" "-vfi")))))))
338 (inputs
339 `(("libusb" ,libusb)
340 ("udev" ,eudev)))
341 (native-inputs
342 `(("autoconf" ,autoconf)
343 ("automake" ,automake)
344 ("libtool" ,libtool)
345 ("pkg-config" ,pkg-config)))
346 (home-page "http://www.signal11.us/oss/hidapi/")
347 (synopsis "HID API library")
348 (description
349 "HIDAPI is a library which allows an application to interface with USB and Bluetooth
350 HID-Class devices.")
351 ;; HIDAPI can be used under one of three licenses.
352 (license (list gpl3
353 bsd-3
354 (non-copyleft "file://LICENSE-orig.txt")))))