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