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