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