gnu: git-annex: Update to 8.20200330.
[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>
0c90d4ad 5;;; Copyright © 2015, 2016, 2017, 2018, 2019 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>
7abe3826 10;;; Copyright © 2018 Vagrant Cascadian <vagrant@debian.org>
3b48f78c 11;;;
233e7676 12;;; This file is part of GNU Guix.
3b48f78c 13;;;
233e7676 14;;; GNU Guix is free software; you can redistribute it and/or modify it
3b48f78c
NK
15;;; under the terms of the GNU General Public License as published by
16;;; the Free Software Foundation; either version 3 of the License, or (at
17;;; your option) any later version.
18;;;
233e7676 19;;; GNU Guix is distributed in the hope that it will be useful, but
3b48f78c
NK
20;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;;; GNU General Public License for more details.
23;;;
24;;; You should have received a copy of the GNU General Public License
233e7676 25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
3b48f78c 26
1ffa7090 27(define-module (gnu packages libusb)
59a43334 28 #:use-module (gnu packages)
3ecb1d05 29 #:use-module ((guix licenses) #:prefix license:)
3b48f78c 30 #:use-module (guix packages)
e0477b73 31 #:use-module (guix utils)
3b48f78c 32 #:use-module (guix download)
18fe5ef1 33 #:use-module (guix git-download)
423b6840 34 #:use-module (guix build-system ant)
18fe5ef1 35 #:use-module (guix build-system cmake)
75be6b7c 36 #:use-module (guix build-system gnu)
3d3caf1f 37 #:use-module (guix build-system glib-or-gtk)
fac34dfe 38 #:use-module (guix build-system python)
3d74f12e 39 #:use-module (gnu packages autotools)
75be6b7c 40 #:use-module (gnu packages gnupg)
3d3caf1f 41 #:use-module (gnu packages gtk)
18fe5ef1 42 #:use-module (gnu packages java)
034e0d50 43 #:use-module (gnu packages linux)
3d3caf1f
RW
44 #:use-module (gnu packages mp3)
45 #:use-module (gnu packages pkg-config)
fac34dfe 46 #:use-module (gnu packages python)
44d10b1f 47 #:use-module (gnu packages python-xyz)
0c90d4ad 48 #:use-module (gnu packages tls)
3d3caf1f 49 #:use-module (gnu packages xiph))
3b48f78c
NK
50
51(define-public libusb
52 (package
53 (name "libusb")
8280e086 54 (version "1.0.23")
3b48f78c
NK
55 (source
56 (origin
57 (method url-fetch)
8280e086
TGR
58 (uri (string-append "https://github.com/libusb/libusb/"
59 "releases/download/v" version
60 "/libusb-" version ".tar.bz2"))
3b48f78c 61 (sha256
8280e086 62 (base32 "13dd2a9x290d1q8nb1lqiaf36grcvns5ripk5k2xm0lajmpc04fv"))))
3b48f78c 63 (build-system gnu-build-system)
034e0d50
LC
64
65 ;; XXX: Enabling udev is now recommended, but eudev indirectly depends on
66 ;; libusb.
67 (arguments `(#:configure-flags '("--disable-udev")))
68 ;; (inputs `(("eudev" ,eudev)))
69
f8ac2039 70 (home-page "https://libusb.info")
35b9e423 71 (synopsis "User-space USB library")
3b48f78c
NK
72 (description
73 "Libusb is a library that gives applications easy access to USB
74devices on various operating systems.")
3ecb1d05 75 (license license:lgpl2.1+)))
75be6b7c 76
e0477b73
AW
77(define-public libusb-compat
78 (package
79 (name "libusb-compat")
80 (version "0.1.5")
81 (source
82 (origin
83 (method url-fetch)
84 (uri (string-append "mirror://sourceforge/libusb/"
c9e37fe3
TGR
85 "libusb-compat-" (version-major+minor version) "/"
86 "libusb-compat-" version "/"
87 "libusb-compat-" version ".tar.bz2"))
e0477b73
AW
88 (sha256
89 (base32
90 "0nn5icrfm9lkhzw1xjvaks9bq3w6mjg86ggv3fn7kgi4nfvg8kj0"))))
91 (build-system gnu-build-system)
92 (native-inputs
93 `(("pkg-config" ,pkg-config)))
94 (inputs
95 `(("libusb" ,libusb)))
f8ac2039 96 (home-page "https://libusb.info")
e0477b73
AW
97 (synopsis "Compatibility shim for libusb")
98 (description
99 "Libusb-compat provides a shim allowing applications based on older
100version of libusb to run with newer libusb.")
3ecb1d05 101 (license license:lgpl2.1+)))
e0477b73 102
05c88516
JB
103;; required by 0xffff, which compiles with libusb-compat, but executes only
104;; with libusb-0.1
105(define-public libusb-0.1
106 (package (inherit libusb)
107 (version "0.1.12")
108 (source
109 (origin
110 (method url-fetch)
111 (uri (string-append "mirror://sourceforge/libusb/libusb-0.1 (LEGACY)/"
112 version "/libusb-" version ".tar.gz"))
113 (sha256
114 (base32
115 "0i4bacxkyr7xyqxbmb00ypkrv4swkgm0mghbzjsnw6blvvczgxip"))
116 (patches (search-patches "libusb-0.1-disable-tests.patch"))))))
117
18fe5ef1
RW
118(define-public libusb4java
119 ;; There is no public release so we take the latest version from git.
120 (let ((commit "396d642a57678a0d9663b062c980fe100cc0ea1e")
121 (revision "1"))
122 (package
123 (name "libusb4java")
124 (version (string-append "0-" revision "." (string-take commit 9)))
125 (source (origin
126 (method git-fetch)
127 (uri (git-reference
128 (url "https://github.com/usb4java/libusb4java.git")
129 (commit commit)))
8cf57bc1 130 (file-name (git-file-name name version))
18fe5ef1
RW
131 (sha256
132 (base32
133 "0wqgapalhfh9v38ycbl6i2f5lh1wpr6fzwn5dwd0rdacypkd1gml"))))
134 (build-system cmake-build-system)
135 (arguments
136 `(#:tests? #f ; there are no tests
137 #:phases
138 (modify-phases %standard-phases
017bffc1
RW
139 ;; FIXME: libusb 1.0.22 deprecated libusb_set_debug, so the build
140 ;; fails because libusb4java uses a deprecated procedure.
141 (add-after 'unpack 'disable-Werror
142 (lambda _
143 (substitute* "CMakeLists.txt"
144 (("-Werror") ""))
145 #t))
18fe5ef1
RW
146 (add-before 'configure 'set-JAVA_HOME
147 (lambda* (#:key inputs #:allow-other-keys)
148 (setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
149 #t)))))
150 (inputs
151 `(("libusb" ,libusb)))
152 (native-inputs
153 `(("jdk" ,icedtea "jdk")))
154 (home-page "https://github.com/usb4java/libusb4java/")
155 (synopsis "JNI bindings to libusb")
156 (description
157 "This package provides Java JNI bindings to the libusb library for use
158with usb4java.")
3ecb1d05 159 (license license:expat))))
18fe5ef1 160
423b6840
RW
161(define-public java-usb4java
162 (package
163 (name "java-usb4java")
164 (version "1.2.0")
165 (source (origin
166 (method url-fetch)
167 (uri (string-append "https://github.com/usb4java/usb4java/"
168 "archive/usb4java-" version ".tar.gz"))
169 (sha256
170 (base32
171 "0gzpsnzwgsdyra3smq288yvxnwrgvdwxr6g8jbknnsk56kv6wc34"))))
172 (build-system ant-build-system)
173 (arguments
174 `(#:jar-name "usb4java.jar"
175 #:phases
176 (modify-phases %standard-phases
177 ;; Usually, native libusb4java libraries for all supported systems
178 ;; would be included in the jar and extracted at runtime. Since we
179 ;; build everything from source we cannot just bundle pre-built
180 ;; binaries for other systems. Instead, we patch the loader to
181 ;; directly return the appropriate library for this system. The
182 ;; downside is that the jar will only work on the same architecture
183 ;; that it was built on.
184 (add-after 'unpack 'copy-libusb4java
185 (lambda* (#:key inputs #:allow-other-keys)
186 (substitute* "src/main/java/org/usb4java/Loader.java"
187 (("private static String extractLibrary" line)
188 (string-append
189 line "(final String a, final String b) {"
190 "return \""
191 (assoc-ref inputs "libusb4java") "/lib/libusb4java.so"
192 "\"; }\n"
193 "private static String _extractLibrary")))
194 #t))
195 (add-after 'unpack 'disable-broken-tests
196 (lambda _
197 (with-directory-excursion "src/test/java/org/usb4java"
198 ;; These tests should only be run when USB devices are present.
199 (substitute* '("LibUsbGlobalTest.java"
200 "TransferTest.java")
201 (("this.context = new Context\\(\\);")
202 "this.context = null;")
203 (("LibUsb.init") "//"))
204 (substitute* "DeviceListIteratorTest.java"
205 (("this.iterator.remove" line)
206 (string-append "assumeUsbTestsEnabled();" line))))
207 #t)))))
208 (inputs
209 `(("libusb4java" ,libusb4java)
210 ("java-commons-lang3" ,java-commons-lang3)
211 ("java-junit" ,java-junit)
212 ("java-hamcrest-core" ,java-hamcrest-core)))
213 (home-page "http://usb4java.org/")
214 (synopsis "USB library for Java")
215 (description
216 "This package provides a USB library for Java based on libusb and
217implementing @code{javax.usb} (JSR-80).")
3ecb1d05 218 (license license:expat)))
423b6840 219
7abe3826
VC
220(define-public python-libusb1
221 (package
222 (name "python-libusb1")
223 (version "1.6.4")
224 (source
225 (origin
226 (method url-fetch)
227 (uri (pypi-uri "libusb1" version))
228 (sha256
229 (base32
230 "03b7xrz8vqg8w0za5r503jhcmbd1ls5610jcja1rqz833nf0v4wc"))))
231 (build-system python-build-system)
232 (arguments
233 `(#:modules ((srfi srfi-1)
234 (guix build utils)
235 (guix build python-build-system))
236 #:phases
237 (modify-phases %standard-phases
238 (add-before 'install-license-files 'remove-incorrect-license
239 (lambda* (#:key out #:allow-other-keys)
240 ;; Was relicensed to LGPL 2.1+, but old COPYING file still left
241 ;; in source. Remove it so it does not get installed.
242 (delete-file "COPYING")
243 #t))
244 (add-after 'unpack 'fix-libusb-reference
245 (lambda* (#:key inputs #:allow-other-keys)
246 (substitute* "usb1/libusb1.py"
247 (("libusb_path = ctypes.util.find_library\\(base_name\\)")
248 (string-append
249 "libusb_path = \""
250 (find (negate symbolic-link?)
251 (find-files (assoc-ref inputs "libusb")
252 "^libusb.*\\.so\\..*"))
253 "\"")))
254 #t)))))
255 (inputs `(("libusb" ,libusb)))
256 (home-page "https://github.com/vpelletier/python-libusb1")
257 (synopsis "Pure-python wrapper for libusb-1.0")
258 (description "Libusb is a library that gives applications easy access to
259USB devices on various operating systems. This package provides a Python
260wrapper for accessing libusb-1.0.")
3ecb1d05 261 (license license:lgpl2.1+)))
7abe3826 262
fac34dfe
RW
263(define-public python-pyusb
264 (package
265 (name "python-pyusb")
3ef4b301 266 (version "1.0.2")
fac34dfe
RW
267 (source
268 (origin
269 (method url-fetch)
3ef4b301 270 (uri (pypi-uri "pyusb" version))
fac34dfe
RW
271 (sha256
272 (base32
3ef4b301 273 "0qkk2jn270jwwl1x26hmdhb14m9kkbrzzwzizdjcl1a29b6756sf"))))
fac34dfe
RW
274 (build-system python-build-system)
275 (arguments
3ef4b301 276 `(#:tests? #f ; no tests
67a3b2dd
RW
277 #:modules ((srfi srfi-1)
278 (srfi srfi-26)
fac34dfe
RW
279 (guix build utils)
280 (guix build python-build-system))
281 #:phases
282 (modify-phases %standard-phases
283 (add-after 'unpack 'fix-libusb-reference
284 (lambda* (#:key inputs #:allow-other-keys)
285 (substitute* "usb/libloader.py"
286 (("lib = locate_library\\(candidates, find_library\\)")
287 (string-append
288 "lib = \""
67a3b2dd
RW
289 (find (negate symbolic-link?)
290 (find-files (assoc-ref inputs "libusb")
291 "^libusb-.*\\.so\\..*"))
fac34dfe
RW
292 "\"")))
293 #t)))))
294 (inputs
295 `(("libusb" ,libusb)))
3ef4b301 296 (home-page "https://pyusb.github.io/pyusb/")
fac34dfe
RW
297 (synopsis "Python bindings to the libusb library")
298 (description
299 "PyUSB aims to be an easy to use Python module to access USB devices.")
3ecb1d05 300 (license license:bsd-3)))
fac34dfe
RW
301
302(define-public python2-pyusb
303 (package-with-python2 python-pyusb))
304
f08d654a
VC
305(define-public python-capablerobot-usbhub
306 (package
307 (name "python-capablerobot-usbhub")
308 (version "0.2.7")
309 (source
310 (origin
311 (method url-fetch)
312 (uri (pypi-uri "capablerobot_usbhub" version))
313 (sha256
314 (base32
315 "1priic4iq2vn1rc711kzxwhxrwa508rkxrr193qdz2lw26kdhvix"))))
316 (build-system python-build-system)
317 (arguments
318 `(#:phases
319 (modify-phases %standard-phases
320 (add-after 'install 'install-udev-rules
321 (lambda* (#:key outputs #:allow-other-keys)
322 (let ((out (assoc-ref outputs "out")))
323 (mkdir-p (string-append out "/lib/udev/rules.d"))
324 (copy-file "50-capablerobot-usbhub.rules"
325 (string-append out
326 "/lib/udev/rules.d/"
327 "50-capablerobot-usbhub.rules"))
328 #t))))))
329 (propagated-inputs
330 `(("python-click" ,python-click)
331 ("python-construct" ,python-construct)
332 ("python-pyusb" ,python-pyusb)
333 ("python-pyyaml" ,python-pyyaml)))
334 (home-page
335 "https://github.com/CapableRobot/CapableRobot_USBHub_Driver")
336 (synopsis
337 "Host side driver for the Capable Robot Programmable USB Hub")
338 (description
339 "This package provides access to the internal state of the Capable Robot
340USB Hub, allowing you to monitor and control the Hub from an upstream
341computer. It also creates a transparent CircuitPython Bridge, allowing
342unmodified CircuitPython code to run on the host computer and interact with
343I2C and SPI devices attached to the USB Hub.")
344 (license license:expat)))
345
1b955337
RW
346(define-public libplist
347 (package
348 (name "libplist")
f64d79e8
TGR
349 (version "2.1.0")
350 (source
351 (origin
352 (method git-fetch)
353 (uri (git-reference
354 (url "https://github.com/libimobiledevice/libplist.git")
355 (commit version)))
356 (file-name (git-file-name name version))
357 (sha256
358 (base32 "02vraf4j46bp746s0gz7vga2gv2dy3zd1v1bsy9x8algg9fpcb7n"))))
1b955337 359 (build-system gnu-build-system)
e4b2866c 360 (arguments
f64d79e8
TGR
361 `(#:phases
362 (modify-phases %standard-phases
363 (add-before 'bootstrap 'configure-later
364 ;; Don't run ./configure during bootstrap.
365 (lambda _
366 (setenv "NOCONFIGURE" "set")
367 #t)))
368 ;; Tests fail randomly when run in parallel because several of them write
369 ;; and read to/from the same file--e.g., "4.plist" is accessed by
370 ;; 'large.test' and 'largecmp.test'.
371 #:parallel-tests? #f))
1b955337
RW
372 (inputs
373 `(("python" ,python)))
374 (native-inputs
f64d79e8
TGR
375 `(("autoconf" ,autoconf)
376 ("automake" ,automake)
377 ("libtool" ,libtool)
378 ("pkg-config" ,pkg-config)
379 ("python-cython" ,python-cython))) ; to build Python bindings
ca497b43 380 (home-page "https://www.libimobiledevice.org/")
1b955337
RW
381 (synopsis "C library to handle Apple Property List files")
382 (description "This package provides a small portable C library to handle
383Apple Property List files in binary or XML.")
384 (license license:lgpl2.1+)))
385
dddf975f
RW
386(define-public libusbmuxd
387 (package
388 (name "libusbmuxd")
389 (version "1.0.10")
390 (source (origin
391 (method url-fetch)
ca497b43 392 (uri (string-append "https://www.libimobiledevice.org/downloads/"
dddf975f
RW
393 "libusbmuxd-" version ".tar.bz2"))
394 (sha256
395 (base32
396 "1wn9zq2224786mdr12c5hxad643d29wg4z6b7jn888jx4s8i78hs"))))
397 (build-system gnu-build-system)
398 (native-inputs
399 `(("pkg-config" ,pkg-config)
400 ("libplist" ,libplist)))
ca497b43 401 (home-page "https://www.libimobiledevice.org/")
dddf975f
RW
402 (synopsis "Library to multiplex connections from and to iOS devices")
403 (description "This package provides a client library to multiplex
404connections from and to iOS devices by connecting to a socket provided by a
405@code{usbmuxd} daemon.")
406 (license license:lgpl2.1+)))
407
0c90d4ad
RW
408(define-public libimobiledevice
409 (package
410 (name "libimobiledevice")
411 (version "1.2.0")
412 (source (origin
413 (method url-fetch)
ca497b43 414 (uri (string-append "https://www.libimobiledevice.org/downloads/"
0c90d4ad
RW
415 "libimobiledevice-" version ".tar.bz2"))
416 (sha256
417 (base32
418 "0dqhy4qwj30mw8pwckvjmgnj1qqrh6p8c6jknmhvylshhzh0ssvq"))))
419 (build-system gnu-build-system)
420 (arguments
421 `(#:configure-flags
422 (list (string-append "PYTHON_LDFLAGS=-L"
423 (assoc-ref %build-inputs "python")
424 "/lib -lpython"
425 ,(version-major+minor (package-version python))
426 "m"))))
427 (propagated-inputs
6b95bf0b 428 `(("openssl" ,openssl-1.0)
bc4e8d3e 429 ("libplist" ,libplist)
0c90d4ad
RW
430 ("libusbmuxd" ,libusbmuxd)))
431 (inputs
6d0b50f6 432 `(("python" ,python)))
0c90d4ad
RW
433 (native-inputs
434 `(("pkg-config" ,pkg-config)
435 ("python-cython" ,python-cython)
436 ("libtool" ,libtool)))
ca497b43 437 (home-page "https://www.libimobiledevice.org/")
0c90d4ad
RW
438 (synopsis "Protocol library and tools to communicate with Apple devices")
439 (description "libimobiledevice is a software library that talks the
440protocols to support Apple devices. It allows other software to easily access
ddfd529c 441the device's file system, retrieve information about the device and its
0c90d4ad 442internals, backup/restore the device, manage installed applications, retrieve
ddfd529c 443address books, calendars, notes, and bookmarks, and (using libgpod) synchronize
0c90d4ad
RW
444music and video to the device.")
445 (license license:lgpl2.1+)))
446
bc4e8d3e
DM
447(define-public ifuse
448 (package
449 (name "ifuse")
450 (version "1.1.3")
451 (source (origin
452 (method url-fetch)
ca497b43 453 (uri (string-append "https://www.libimobiledevice.org/downloads/"
bc4e8d3e
DM
454 "ifuse-" version ".tar.bz2"))
455 (sha256
456 (base32
457 "1p9a4n36jb194cnp6v57cz2bggwbywaz8pbpb95ch83pzdkdx257"))))
458 (inputs
459 `(("fuse" ,fuse)
460 ("libimobiledevice" ,libimobiledevice)))
461 (native-inputs
462 `(("pkg-config" ,pkg-config)))
463 (build-system gnu-build-system)
ca497b43 464 (home-page "https://www.libimobiledevice.org/")
bc4e8d3e
DM
465 (synopsis "Mount iOS devices")
466 (description "This package provides @command{ifuse}, a command to mount
467iOS devices and access their contents.")
468 (license license:lgpl2.1+)))
469
fc80f54e
DM
470(define-public usbmuxd
471 (package
472 (name "usbmuxd")
473 (version "1.1.0")
474 (source (origin
475 (method url-fetch)
ca497b43 476 (uri (string-append "https://www.libimobiledevice.org/downloads/"
fc80f54e
DM
477 "usbmuxd-" version ".tar.bz2"))
478 (sha256
479 (base32
480 "0bdlc7a8plvglqqx39qqampqm6y0hcdws76l9dffwl22zss4i29y"))))
481 (inputs
482 `(("libplist" ,libplist)
483 ("libusb" ,libusb)
484 ("libimobiledevice" ,libimobiledevice)))
485 (native-inputs
486 `(("pkg-config" ,pkg-config)))
487 (build-system gnu-build-system)
ca497b43 488 (home-page "https://www.libimobiledevice.org/")
fc80f54e
DM
489 (synopsis "Multiplex connections over USB to an iOS device")
490 (description "This package provides the @code{usbmuxd} daemon
491which multiplexes connections over USB to an iOS device. To
492users, it means you can sync your music, contacts, photos, etc.
493over USB.")
494 (license license:gpl2+)))
495
75be6b7c
AE
496(define-public libmtp
497 (package
498 (name "libmtp")
e71ef4c1 499 (version "1.1.17")
75be6b7c
AE
500 (source (origin
501 (method url-fetch)
de67e922 502 (uri (string-append "mirror://sourceforge/libmtp/libmtp/" version
75be6b7c
AE
503 "/libmtp-" version ".tar.gz"))
504 (sha256
0e6ee10c 505 (base32
e71ef4c1 506 "1p3r38nvdip40ab1h4scj3mzfjkx6kd14szjqyw9r6wz5pslr8zq"))))
75be6b7c
AE
507 (build-system gnu-build-system)
508 (native-inputs
509 `(("pkg-config" ,pkg-config)))
fa72d189
MB
510 (inputs
511 `(("libgcrypt" ,libgcrypt)))
cff77d48
SB
512 (propagated-inputs
513 ;; libmtp.pc refers to all these.
fa72d189 514 `(("libusb" ,libusb)))
75be6b7c
AE
515 (arguments
516 `(#:configure-flags
34a3566f
MB
517 (list "--disable-static"
518 (string-append "--with-udev="
75be6b7c
AE
519 (assoc-ref %outputs "out")
520 "/lib/udev"))))
521 (home-page "http://libmtp.sourceforge.net/")
522 (synopsis "Library implementing the Media Transfer Protocol")
523 (description "Libmtp implements an MTP (Media Transfer Protocol)
524initiator, which means that it initiates MTP sessions with devices. The
525devices responding are known as MTP responders. Libmtp runs on devices
526with a USB host controller interface. It implements MTP Basic, which was
527proposed for standardization.")
528 ;; COPYING contains lgpl2.1, while files headers give
529 ;; "GNU Lesser General Public License as published by the Free Software
530 ;; Foundation; either version 2 of the License, or (at your option) any
531 ;; later version."
3ecb1d05 532 (license license:lgpl2.1+)))
3d3caf1f
RW
533
534(define-public gmtp
535 (package
536 (name "gmtp")
f62dcba4 537 (version "1.3.11")
3d3caf1f
RW
538 (source (origin
539 (method url-fetch)
de67e922 540 (uri (string-append "mirror://sourceforge/gmtp/gMTP-" version
3d3caf1f
RW
541 "/gmtp-" version ".tar.gz"))
542 (sha256
543 (base32
f62dcba4 544 "04q6byyq002fhzkc2rkkahwh5b6272xakaj4m3vwm8la8jf0r0ss"))))
3d3caf1f
RW
545 (build-system glib-or-gtk-build-system)
546 (arguments
547 '(#:configure-flags
548 (let ((libid3tag (assoc-ref %build-inputs "libid3tag")))
549 (list
550 ;; libid3tag provides no .pc file, so pkg-config fails to find them.
551 (string-append "ID3TAG_CFLAGS=-I" libid3tag "/include")
552 (string-append "ID3TAG_LIBS=-L" libid3tag "/lib -lid3tag -lz")))))
553 (inputs
554 `(("gtk+" ,gtk+)
555 ("flac" ,flac)
556 ("libvorbis" ,libvorbis)
557 ("libid3tag" ,libid3tag)
558 ("libmtp" ,libmtp)))
559 (native-inputs
560 `(("pkg-config" ,pkg-config)))
561 (home-page "http://gmtp.sourceforge.net/")
562 (synopsis "Simple graphical MTP client")
563 (description "gMTP is a simple graphical client for the Media Transfer Protocol
564 (MTP), which allows media files to be transferred to and from many portable
565devices.")
3ecb1d05 566 (license license:bsd-3)))
3d74f12e
TF
567
568(define-public hidapi
569 (package
570 (name "hidapi")
7f6592c4 571 (version "0.9.0")
b7dfc5a7
TGR
572 (source
573 (origin
574 (method git-fetch)
575 (uri (git-reference
7f6592c4 576 (url "https://github.com/libusb/hidapi.git")
b7dfc5a7 577 (commit (string-append "hidapi-" version))))
a6b937b3 578 (file-name (git-file-name name version))
b7dfc5a7 579 (sha256
7f6592c4 580 (base32 "1p4g8lgwj4rki6lbn5l6rvwj0xlbn1xfh4d255bg5pvgczmwmc4i"))))
3d74f12e 581 (build-system gnu-build-system)
3d74f12e
TF
582 (inputs
583 `(("libusb" ,libusb)
584 ("udev" ,eudev)))
585 (native-inputs
586 `(("autoconf" ,autoconf)
587 ("automake" ,automake)
588 ("libtool" ,libtool)
589 ("pkg-config" ,pkg-config)))
7f6592c4 590 (home-page "https://github.com/libusb/hidapi")
3d74f12e
TF
591 (synopsis "HID API library")
592 (description
593 "HIDAPI is a library which allows an application to interface with USB and Bluetooth
594HID-Class devices.")
595 ;; HIDAPI can be used under one of three licenses.
3ecb1d05
RW
596 (license (list license:gpl3
597 license:bsd-3
598 (license:non-copyleft "file://LICENSE-orig.txt")))))
93e5c93e
DM
599
600(define-public python-hidapi
601 (package
602 (name "python-hidapi")
603 (version "0.7.99.post21")
604 (source
605 (origin
606 (method url-fetch)
607 (uri (pypi-uri "hidapi" version))
608 (sha256
609 (base32
610 "15ws59zdrxahf3k7z5rcrwc4jgv1307anif8ixm2cyb9ask1mgp0"))
611 (modules '((guix build utils)))
612 (snippet
613 ;; Remove bundled libraries.
614 '(begin
615 (delete-file-recursively "hidapi")
616 #t))))
617 (build-system python-build-system)
618 (arguments
619 `(#:phases
620 (modify-phases %standard-phases
621 (add-after 'unpack 'patch-configuration
622 (lambda* (#:key inputs #:allow-other-keys)
623 (substitute* "setup.py"
624 (("'/usr/include/libusb-1.0'")
625 (string-append "'" (assoc-ref inputs "libusb")
626 "/include/libusb-1.0'"))
627 (("'/usr/include/hidapi'")
628 (string-append "'" (assoc-ref inputs "hidapi")
629 "/include/hidapi'")))
630 #t))
631 ;; XXX Necessary because python-build-system drops the arguments.
632 (replace 'build
633 (lambda _
634 (invoke "python" "setup.py" "build" "--with-system-hidapi")))
635 (replace 'check
636 (lambda _
637 (invoke "python" "setup.py" "test" "--with-system-hidapi")))
638 (replace 'install
639 (lambda* (#:key outputs #:allow-other-keys)
640 (invoke "python" "setup.py" "install" "--with-system-hidapi"
641 (string-append "--prefix=" (assoc-ref outputs "out"))
642 "--single-version-externally-managed" "--root=/"))))))
643 (inputs
644 `(("hidapi" ,hidapi)
645 ("libusb" ,libusb)
646 ("eudev" ,eudev)))
647 (native-inputs
648 `(("python-cython" ,python-cython)))
649 (home-page "https://github.com/trezor/cython-hidapi")
650 (synopsis "Cython interface to hidapi")
651 (description "This package provides a Cython interface to @code{hidapi}.")
652 ;; The library can be used under either of these licenses.
3ecb1d05
RW
653 (license (list license:gpl3
654 license:bsd-3
655 (license:non-copyleft
93e5c93e
DM
656 "https://github.com/trezor/cython-hidapi/blob/master/LICENSE-orig.txt"
657 "You are free to use cython-hidapi code for any purpose.")))))
658
659(define-public python2-hidapi
660 (package-with-python2 python-hidapi))