gnu: facter: Update to 4.0.33.
[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
b0e7b699 131 (url "https://github.com/usb4java/libusb4java")
18fe5ef1 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
2c9cb2f0
EF
169 (method git-fetch)
170 (uri (git-reference
171 (url "https://github.com/usb4java/usb4java")
172 (commit (string-append "usb4java-" version))))
173 (file-name (git-file-name name version))
423b6840
RW
174 (sha256
175 (base32
2c9cb2f0 176 "0aip6k24czz5g58qwb963mpick0b6ks774drfpdd8gcdvj9iv87j"))))
423b6840
RW
177 (build-system ant-build-system)
178 (arguments
179 `(#:jar-name "usb4java.jar"
180 #:phases
181 (modify-phases %standard-phases
182 ;; Usually, native libusb4java libraries for all supported systems
183 ;; would be included in the jar and extracted at runtime. Since we
184 ;; build everything from source we cannot just bundle pre-built
185 ;; binaries for other systems. Instead, we patch the loader to
186 ;; directly return the appropriate library for this system. The
187 ;; downside is that the jar will only work on the same architecture
188 ;; that it was built on.
189 (add-after 'unpack 'copy-libusb4java
190 (lambda* (#:key inputs #:allow-other-keys)
191 (substitute* "src/main/java/org/usb4java/Loader.java"
192 (("private static String extractLibrary" line)
193 (string-append
194 line "(final String a, final String b) {"
195 "return \""
196 (assoc-ref inputs "libusb4java") "/lib/libusb4java.so"
197 "\"; }\n"
198 "private static String _extractLibrary")))
199 #t))
200 (add-after 'unpack 'disable-broken-tests
201 (lambda _
202 (with-directory-excursion "src/test/java/org/usb4java"
203 ;; These tests should only be run when USB devices are present.
204 (substitute* '("LibUsbGlobalTest.java"
205 "TransferTest.java")
206 (("this.context = new Context\\(\\);")
207 "this.context = null;")
208 (("LibUsb.init") "//"))
209 (substitute* "DeviceListIteratorTest.java"
210 (("this.iterator.remove" line)
211 (string-append "assumeUsbTestsEnabled();" line))))
212 #t)))))
213 (inputs
214 `(("libusb4java" ,libusb4java)
215 ("java-commons-lang3" ,java-commons-lang3)
216 ("java-junit" ,java-junit)
217 ("java-hamcrest-core" ,java-hamcrest-core)))
218 (home-page "http://usb4java.org/")
219 (synopsis "USB library for Java")
220 (description
221 "This package provides a USB library for Java based on libusb and
222implementing @code{javax.usb} (JSR-80).")
3ecb1d05 223 (license license:expat)))
423b6840 224
7abe3826
VC
225(define-public python-libusb1
226 (package
227 (name "python-libusb1")
228 (version "1.6.4")
229 (source
230 (origin
231 (method url-fetch)
232 (uri (pypi-uri "libusb1" version))
233 (sha256
234 (base32
235 "03b7xrz8vqg8w0za5r503jhcmbd1ls5610jcja1rqz833nf0v4wc"))))
236 (build-system python-build-system)
237 (arguments
238 `(#:modules ((srfi srfi-1)
239 (guix build utils)
240 (guix build python-build-system))
241 #:phases
242 (modify-phases %standard-phases
243 (add-before 'install-license-files 'remove-incorrect-license
244 (lambda* (#:key out #:allow-other-keys)
245 ;; Was relicensed to LGPL 2.1+, but old COPYING file still left
246 ;; in source. Remove it so it does not get installed.
247 (delete-file "COPYING")
248 #t))
249 (add-after 'unpack 'fix-libusb-reference
250 (lambda* (#:key inputs #:allow-other-keys)
251 (substitute* "usb1/libusb1.py"
252 (("libusb_path = ctypes.util.find_library\\(base_name\\)")
253 (string-append
254 "libusb_path = \""
255 (find (negate symbolic-link?)
256 (find-files (assoc-ref inputs "libusb")
257 "^libusb.*\\.so\\..*"))
258 "\"")))
259 #t)))))
260 (inputs `(("libusb" ,libusb)))
261 (home-page "https://github.com/vpelletier/python-libusb1")
262 (synopsis "Pure-python wrapper for libusb-1.0")
263 (description "Libusb is a library that gives applications easy access to
264USB devices on various operating systems. This package provides a Python
265wrapper for accessing libusb-1.0.")
3ecb1d05 266 (license license:lgpl2.1+)))
7abe3826 267
fac34dfe
RW
268(define-public python-pyusb
269 (package
270 (name "python-pyusb")
3ef4b301 271 (version "1.0.2")
fac34dfe
RW
272 (source
273 (origin
274 (method url-fetch)
3ef4b301 275 (uri (pypi-uri "pyusb" version))
fac34dfe
RW
276 (sha256
277 (base32
3ef4b301 278 "0qkk2jn270jwwl1x26hmdhb14m9kkbrzzwzizdjcl1a29b6756sf"))))
fac34dfe
RW
279 (build-system python-build-system)
280 (arguments
3ef4b301 281 `(#:tests? #f ; no tests
67a3b2dd
RW
282 #:modules ((srfi srfi-1)
283 (srfi srfi-26)
fac34dfe
RW
284 (guix build utils)
285 (guix build python-build-system))
286 #:phases
287 (modify-phases %standard-phases
288 (add-after 'unpack 'fix-libusb-reference
289 (lambda* (#:key inputs #:allow-other-keys)
290 (substitute* "usb/libloader.py"
291 (("lib = locate_library\\(candidates, find_library\\)")
292 (string-append
293 "lib = \""
67a3b2dd
RW
294 (find (negate symbolic-link?)
295 (find-files (assoc-ref inputs "libusb")
296 "^libusb-.*\\.so\\..*"))
fac34dfe
RW
297 "\"")))
298 #t)))))
299 (inputs
300 `(("libusb" ,libusb)))
3ef4b301 301 (home-page "https://pyusb.github.io/pyusb/")
fac34dfe
RW
302 (synopsis "Python bindings to the libusb library")
303 (description
304 "PyUSB aims to be an easy to use Python module to access USB devices.")
3ecb1d05 305 (license license:bsd-3)))
fac34dfe
RW
306
307(define-public python2-pyusb
308 (package-with-python2 python-pyusb))
309
f08d654a
VC
310(define-public python-capablerobot-usbhub
311 (package
312 (name "python-capablerobot-usbhub")
313 (version "0.2.7")
314 (source
315 (origin
316 (method url-fetch)
317 (uri (pypi-uri "capablerobot_usbhub" version))
318 (sha256
319 (base32
320 "1priic4iq2vn1rc711kzxwhxrwa508rkxrr193qdz2lw26kdhvix"))))
321 (build-system python-build-system)
322 (arguments
323 `(#:phases
324 (modify-phases %standard-phases
325 (add-after 'install 'install-udev-rules
326 (lambda* (#:key outputs #:allow-other-keys)
327 (let ((out (assoc-ref outputs "out")))
328 (mkdir-p (string-append out "/lib/udev/rules.d"))
329 (copy-file "50-capablerobot-usbhub.rules"
330 (string-append out
331 "/lib/udev/rules.d/"
332 "50-capablerobot-usbhub.rules"))
333 #t))))))
334 (propagated-inputs
335 `(("python-click" ,python-click)
336 ("python-construct" ,python-construct)
337 ("python-pyusb" ,python-pyusb)
338 ("python-pyyaml" ,python-pyyaml)))
339 (home-page
340 "https://github.com/CapableRobot/CapableRobot_USBHub_Driver")
341 (synopsis
342 "Host side driver for the Capable Robot Programmable USB Hub")
343 (description
344 "This package provides access to the internal state of the Capable Robot
345USB Hub, allowing you to monitor and control the Hub from an upstream
346computer. It also creates a transparent CircuitPython Bridge, allowing
347unmodified CircuitPython code to run on the host computer and interact with
348I2C and SPI devices attached to the USB Hub.")
349 (license license:expat)))
350
1b955337
RW
351(define-public libplist
352 (package
353 (name "libplist")
f64d79e8
TGR
354 (version "2.1.0")
355 (source
356 (origin
357 (method git-fetch)
358 (uri (git-reference
b0e7b699 359 (url "https://github.com/libimobiledevice/libplist")
f64d79e8
TGR
360 (commit version)))
361 (file-name (git-file-name name version))
362 (sha256
363 (base32 "02vraf4j46bp746s0gz7vga2gv2dy3zd1v1bsy9x8algg9fpcb7n"))))
1b955337 364 (build-system gnu-build-system)
e4b2866c 365 (arguments
778d6b52 366 `(;; Tests fail randomly when run in parallel because several of them write
f64d79e8
TGR
367 ;; and read to/from the same file--e.g., "4.plist" is accessed by
368 ;; 'large.test' and 'largecmp.test'.
369 #:parallel-tests? #f))
1b955337
RW
370 (inputs
371 `(("python" ,python)))
372 (native-inputs
f64d79e8
TGR
373 `(("autoconf" ,autoconf)
374 ("automake" ,automake)
375 ("libtool" ,libtool)
376 ("pkg-config" ,pkg-config)
377 ("python-cython" ,python-cython))) ; to build Python bindings
ca497b43 378 (home-page "https://www.libimobiledevice.org/")
1b955337
RW
379 (synopsis "C library to handle Apple Property List files")
380 (description "This package provides a small portable C library to handle
381Apple Property List files in binary or XML.")
382 (license license:lgpl2.1+)))
383
dddf975f
RW
384(define-public libusbmuxd
385 (package
386 (name "libusbmuxd")
387 (version "1.0.10")
388 (source (origin
389 (method url-fetch)
ca497b43 390 (uri (string-append "https://www.libimobiledevice.org/downloads/"
dddf975f
RW
391 "libusbmuxd-" version ".tar.bz2"))
392 (sha256
393 (base32
394 "1wn9zq2224786mdr12c5hxad643d29wg4z6b7jn888jx4s8i78hs"))))
395 (build-system gnu-build-system)
396 (native-inputs
397 `(("pkg-config" ,pkg-config)
398 ("libplist" ,libplist)))
ca497b43 399 (home-page "https://www.libimobiledevice.org/")
dddf975f
RW
400 (synopsis "Library to multiplex connections from and to iOS devices")
401 (description "This package provides a client library to multiplex
402connections from and to iOS devices by connecting to a socket provided by a
403@code{usbmuxd} daemon.")
404 (license license:lgpl2.1+)))
405
403b533f
MB
406;; These patches are needed to build with Python 3.8.
407(define %libimobiledevice-patches
408 (list (origin
409 (method url-fetch)
410 (uri (string-append "https://github.com/libimobiledevice/libimobiledevice"
411 "/commit/1ff3448d2e27f1bac8d2f0af8b8e952854860278.patch"))
412 (file-name "libimobiledevice-python-config.patch")
413 (sha256
414 (base32
415 "1mkwhp8vvhajij29jk3w4rkgcfh8d8waf908drh3076k70hb6i8y")))
416 (origin
417 (method url-fetch)
418 (uri (string-append "https://github.com/libimobiledevice/libimobiledevice"
419 "/commit/eea4f1be9107c8ab621fd71460e47d0d38e55d71.patch"))
420 (file-name "libimobiledevice-python-3.8-compat.patch")
421 (sha256
422 (base32
423 "1zz8v7kgwyq5ck1qp03l29pcmljygnjwls9d6q28nv5pkwa6848w")))))
424
0c90d4ad
RW
425(define-public libimobiledevice
426 (package
427 (name "libimobiledevice")
428 (version "1.2.0")
429 (source (origin
430 (method url-fetch)
ca497b43 431 (uri (string-append "https://www.libimobiledevice.org/downloads/"
0c90d4ad 432 "libimobiledevice-" version ".tar.bz2"))
403b533f
MB
433 ;; Note: Remove the 'force-bootstrap' phase and the autoconf
434 ;; inputs below when removing these patches.
435 (patches %libimobiledevice-patches)
0c90d4ad
RW
436 (sha256
437 (base32
438 "0dqhy4qwj30mw8pwckvjmgnj1qqrh6p8c6jknmhvylshhzh0ssvq"))))
439 (build-system gnu-build-system)
440 (arguments
403b533f
MB
441 `(#:phases (modify-phases %standard-phases
442 (add-before 'bootstrap 'force-bootstrap
443 (lambda _
444 (delete-file "configure")
445 #t)))))
0c90d4ad 446 (propagated-inputs
6b95bf0b 447 `(("openssl" ,openssl-1.0)
bc4e8d3e 448 ("libplist" ,libplist)
0c90d4ad
RW
449 ("libusbmuxd" ,libusbmuxd)))
450 (inputs
6d0b50f6 451 `(("python" ,python)))
0c90d4ad
RW
452 (native-inputs
453 `(("pkg-config" ,pkg-config)
454 ("python-cython" ,python-cython)
403b533f
MB
455
456 ;; These are required because we patch and bootstrap the build system.
457 ("autoconf" ,autoconf)
458 ("automake" ,automake)
0c90d4ad 459 ("libtool" ,libtool)))
ca497b43 460 (home-page "https://www.libimobiledevice.org/")
0c90d4ad
RW
461 (synopsis "Protocol library and tools to communicate with Apple devices")
462 (description "libimobiledevice is a software library that talks the
463protocols to support Apple devices. It allows other software to easily access
ddfd529c 464the device's file system, retrieve information about the device and its
0c90d4ad 465internals, backup/restore the device, manage installed applications, retrieve
ddfd529c 466address books, calendars, notes, and bookmarks, and (using libgpod) synchronize
0c90d4ad
RW
467music and video to the device.")
468 (license license:lgpl2.1+)))
469
bc4e8d3e
DM
470(define-public ifuse
471 (package
472 (name "ifuse")
473 (version "1.1.3")
474 (source (origin
475 (method url-fetch)
ca497b43 476 (uri (string-append "https://www.libimobiledevice.org/downloads/"
bc4e8d3e
DM
477 "ifuse-" version ".tar.bz2"))
478 (sha256
479 (base32
480 "1p9a4n36jb194cnp6v57cz2bggwbywaz8pbpb95ch83pzdkdx257"))))
481 (inputs
482 `(("fuse" ,fuse)
483 ("libimobiledevice" ,libimobiledevice)))
484 (native-inputs
485 `(("pkg-config" ,pkg-config)))
486 (build-system gnu-build-system)
ca497b43 487 (home-page "https://www.libimobiledevice.org/")
bc4e8d3e
DM
488 (synopsis "Mount iOS devices")
489 (description "This package provides @command{ifuse}, a command to mount
490iOS devices and access their contents.")
491 (license license:lgpl2.1+)))
492
fc80f54e
DM
493(define-public usbmuxd
494 (package
495 (name "usbmuxd")
496 (version "1.1.0")
497 (source (origin
498 (method url-fetch)
ca497b43 499 (uri (string-append "https://www.libimobiledevice.org/downloads/"
fc80f54e
DM
500 "usbmuxd-" version ".tar.bz2"))
501 (sha256
502 (base32
503 "0bdlc7a8plvglqqx39qqampqm6y0hcdws76l9dffwl22zss4i29y"))))
504 (inputs
505 `(("libplist" ,libplist)
506 ("libusb" ,libusb)
507 ("libimobiledevice" ,libimobiledevice)))
508 (native-inputs
509 `(("pkg-config" ,pkg-config)))
510 (build-system gnu-build-system)
ca497b43 511 (home-page "https://www.libimobiledevice.org/")
fc80f54e
DM
512 (synopsis "Multiplex connections over USB to an iOS device")
513 (description "This package provides the @code{usbmuxd} daemon
514which multiplexes connections over USB to an iOS device. To
515users, it means you can sync your music, contacts, photos, etc.
516over USB.")
517 (license license:gpl2+)))
518
75be6b7c
AE
519(define-public libmtp
520 (package
521 (name "libmtp")
e71ef4c1 522 (version "1.1.17")
75be6b7c
AE
523 (source (origin
524 (method url-fetch)
de67e922 525 (uri (string-append "mirror://sourceforge/libmtp/libmtp/" version
75be6b7c
AE
526 "/libmtp-" version ".tar.gz"))
527 (sha256
0e6ee10c 528 (base32
e71ef4c1 529 "1p3r38nvdip40ab1h4scj3mzfjkx6kd14szjqyw9r6wz5pslr8zq"))))
75be6b7c
AE
530 (build-system gnu-build-system)
531 (native-inputs
532 `(("pkg-config" ,pkg-config)))
fa72d189
MB
533 (inputs
534 `(("libgcrypt" ,libgcrypt)))
cff77d48
SB
535 (propagated-inputs
536 ;; libmtp.pc refers to all these.
fa72d189 537 `(("libusb" ,libusb)))
75be6b7c
AE
538 (arguments
539 `(#:configure-flags
34a3566f
MB
540 (list "--disable-static"
541 (string-append "--with-udev="
75be6b7c
AE
542 (assoc-ref %outputs "out")
543 "/lib/udev"))))
544 (home-page "http://libmtp.sourceforge.net/")
545 (synopsis "Library implementing the Media Transfer Protocol")
546 (description "Libmtp implements an MTP (Media Transfer Protocol)
547initiator, which means that it initiates MTP sessions with devices. The
548devices responding are known as MTP responders. Libmtp runs on devices
549with a USB host controller interface. It implements MTP Basic, which was
550proposed for standardization.")
551 ;; COPYING contains lgpl2.1, while files headers give
552 ;; "GNU Lesser General Public License as published by the Free Software
553 ;; Foundation; either version 2 of the License, or (at your option) any
554 ;; later version."
3ecb1d05 555 (license license:lgpl2.1+)))
3d3caf1f
RW
556
557(define-public gmtp
558 (package
559 (name "gmtp")
f62dcba4 560 (version "1.3.11")
3d3caf1f
RW
561 (source (origin
562 (method url-fetch)
de67e922 563 (uri (string-append "mirror://sourceforge/gmtp/gMTP-" version
3d3caf1f
RW
564 "/gmtp-" version ".tar.gz"))
565 (sha256
566 (base32
f62dcba4 567 "04q6byyq002fhzkc2rkkahwh5b6272xakaj4m3vwm8la8jf0r0ss"))))
3d3caf1f
RW
568 (build-system glib-or-gtk-build-system)
569 (arguments
570 '(#:configure-flags
571 (let ((libid3tag (assoc-ref %build-inputs "libid3tag")))
572 (list
573 ;; libid3tag provides no .pc file, so pkg-config fails to find them.
574 (string-append "ID3TAG_CFLAGS=-I" libid3tag "/include")
575 (string-append "ID3TAG_LIBS=-L" libid3tag "/lib -lid3tag -lz")))))
576 (inputs
577 `(("gtk+" ,gtk+)
578 ("flac" ,flac)
579 ("libvorbis" ,libvorbis)
580 ("libid3tag" ,libid3tag)
581 ("libmtp" ,libmtp)))
582 (native-inputs
583 `(("pkg-config" ,pkg-config)))
584 (home-page "http://gmtp.sourceforge.net/")
585 (synopsis "Simple graphical MTP client")
586 (description "gMTP is a simple graphical client for the Media Transfer Protocol
587 (MTP), which allows media files to be transferred to and from many portable
588devices.")
3ecb1d05 589 (license license:bsd-3)))
3d74f12e
TF
590
591(define-public hidapi
592 (package
593 (name "hidapi")
7f6592c4 594 (version "0.9.0")
b7dfc5a7
TGR
595 (source
596 (origin
597 (method git-fetch)
598 (uri (git-reference
b0e7b699 599 (url "https://github.com/libusb/hidapi")
b7dfc5a7 600 (commit (string-append "hidapi-" version))))
a6b937b3 601 (file-name (git-file-name name version))
b7dfc5a7 602 (sha256
7f6592c4 603 (base32 "1p4g8lgwj4rki6lbn5l6rvwj0xlbn1xfh4d255bg5pvgczmwmc4i"))))
3d74f12e 604 (build-system gnu-build-system)
3d74f12e
TF
605 (inputs
606 `(("libusb" ,libusb)
607 ("udev" ,eudev)))
608 (native-inputs
609 `(("autoconf" ,autoconf)
610 ("automake" ,automake)
611 ("libtool" ,libtool)
612 ("pkg-config" ,pkg-config)))
7f6592c4 613 (home-page "https://github.com/libusb/hidapi")
3d74f12e
TF
614 (synopsis "HID API library")
615 (description
616 "HIDAPI is a library which allows an application to interface with USB and Bluetooth
617HID-Class devices.")
618 ;; HIDAPI can be used under one of three licenses.
3ecb1d05
RW
619 (license (list license:gpl3
620 license:bsd-3
621 (license:non-copyleft "file://LICENSE-orig.txt")))))
93e5c93e
DM
622
623(define-public python-hidapi
624 (package
625 (name "python-hidapi")
626 (version "0.7.99.post21")
627 (source
628 (origin
629 (method url-fetch)
630 (uri (pypi-uri "hidapi" version))
631 (sha256
632 (base32
633 "15ws59zdrxahf3k7z5rcrwc4jgv1307anif8ixm2cyb9ask1mgp0"))
634 (modules '((guix build utils)))
635 (snippet
636 ;; Remove bundled libraries.
637 '(begin
638 (delete-file-recursively "hidapi")
639 #t))))
640 (build-system python-build-system)
641 (arguments
642 `(#:phases
643 (modify-phases %standard-phases
644 (add-after 'unpack 'patch-configuration
645 (lambda* (#:key inputs #:allow-other-keys)
646 (substitute* "setup.py"
647 (("'/usr/include/libusb-1.0'")
648 (string-append "'" (assoc-ref inputs "libusb")
649 "/include/libusb-1.0'"))
650 (("'/usr/include/hidapi'")
651 (string-append "'" (assoc-ref inputs "hidapi")
652 "/include/hidapi'")))
653 #t))
654 ;; XXX Necessary because python-build-system drops the arguments.
655 (replace 'build
656 (lambda _
657 (invoke "python" "setup.py" "build" "--with-system-hidapi")))
658 (replace 'check
659 (lambda _
660 (invoke "python" "setup.py" "test" "--with-system-hidapi")))
661 (replace 'install
662 (lambda* (#:key outputs #:allow-other-keys)
663 (invoke "python" "setup.py" "install" "--with-system-hidapi"
664 (string-append "--prefix=" (assoc-ref outputs "out"))
665 "--single-version-externally-managed" "--root=/"))))))
666 (inputs
667 `(("hidapi" ,hidapi)
668 ("libusb" ,libusb)
669 ("eudev" ,eudev)))
670 (native-inputs
671 `(("python-cython" ,python-cython)))
672 (home-page "https://github.com/trezor/cython-hidapi")
673 (synopsis "Cython interface to hidapi")
674 (description "This package provides a Cython interface to @code{hidapi}.")
675 ;; The library can be used under either of these licenses.
3ecb1d05
RW
676 (license (list license:gpl3
677 license:bsd-3
678 (license:non-copyleft
93e5c93e
DM
679 "https://github.com/trezor/cython-hidapi/blob/master/LICENSE-orig.txt"
680 "You are free to use cython-hidapi code for any purpose.")))))
681
682(define-public python2-hidapi
683 (package-with-python2 python-hidapi))