gnu: emacs-consult: Fix grammar.
[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>
abc21422 9;;; Copyright © 2018, 2020 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")
4b88e27c 56 (version "1.0.24")
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
4b88e27c 64 (base32 "0amilbi5qncdnrds3ji21vbiz1wvdm1fwp5qrxnk49xkyy2jdzby"))))
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")
8729c8be 354 (version "2.2.0")
f64d79e8
TGR
355 (source
356 (origin
8729c8be
KK
357 (method url-fetch)
358 (uri (string-append "https://github.com/libimobiledevice"
359 "/libplist/releases/download/" version
360 "/libplist-" version ".tar.bz2"))
f64d79e8 361 (sha256
8729c8be 362 (base32 "16mxdwaw01x9a3adf0yj3bqjc7afpf2vm1n5hkgj3i3y6zjifmaa"))))
1b955337 363 (build-system gnu-build-system)
e4b2866c 364 (arguments
778d6b52 365 `(;; Tests fail randomly when run in parallel because several of them write
f64d79e8
TGR
366 ;; and read to/from the same file--e.g., "4.plist" is accessed by
367 ;; 'large.test' and 'largecmp.test'.
368 #:parallel-tests? #f))
1b955337
RW
369 (inputs
370 `(("python" ,python)))
371 (native-inputs
f64d79e8
TGR
372 `(("autoconf" ,autoconf)
373 ("automake" ,automake)
374 ("libtool" ,libtool)
375 ("pkg-config" ,pkg-config)
376 ("python-cython" ,python-cython))) ; to build Python bindings
8729c8be 377 (home-page "https://libimobiledevice.org/")
1b955337
RW
378 (synopsis "C library to handle Apple Property List files")
379 (description "This package provides a small portable C library to handle
380Apple Property List files in binary or XML.")
381 (license license:lgpl2.1+)))
382
dddf975f
RW
383(define-public libusbmuxd
384 (package
385 (name "libusbmuxd")
bea887c8 386 (version "2.0.2")
dddf975f
RW
387 (source (origin
388 (method url-fetch)
bea887c8
KK
389 (uri (string-append "https://github.com/libimobiledevice"
390 "/libusbmuxd/releases/download/" version
391 "/libusbmuxd-" version ".tar.bz2"))
dddf975f
RW
392 (sha256
393 (base32
bea887c8 394 "084vg570g1qb506jd7axg6c080mfsmbf52v3lngzlknsaf2q0snc"))))
dddf975f
RW
395 (build-system gnu-build-system)
396 (native-inputs
397 `(("pkg-config" ,pkg-config)
398 ("libplist" ,libplist)))
bea887c8 399 (home-page "https://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
0c90d4ad
RW
406(define-public libimobiledevice
407 (package
408 (name "libimobiledevice")
83503258 409 (version "1.3.0")
0c90d4ad
RW
410 (source (origin
411 (method url-fetch)
83503258
KK
412 (uri (string-append "https://github.com/libimobiledevice"
413 "/libimobiledevice/releases/download/"
414 version "/libimobiledevice-" version
415 ".tar.bz2"))
0c90d4ad
RW
416 (sha256
417 (base32
83503258 418 "1xmhfnypg6j7shl73wfkrrn4mj9dh8qzaj3258q9zkb5cc669wjk"))))
0c90d4ad
RW
419 (build-system gnu-build-system)
420 (arguments
83503258 421 '(#:configure-flags '("PYTHON_VERSION=3")))
0c90d4ad 422 (propagated-inputs
83503258 423 `(("openssl" ,openssl)
bc4e8d3e 424 ("libplist" ,libplist)
0c90d4ad
RW
425 ("libusbmuxd" ,libusbmuxd)))
426 (inputs
6d0b50f6 427 `(("python" ,python)))
0c90d4ad
RW
428 (native-inputs
429 `(("pkg-config" ,pkg-config)
83503258
KK
430 ("python-cython" ,python-cython)))
431 (home-page "https://libimobiledevice.org/")
0c90d4ad
RW
432 (synopsis "Protocol library and tools to communicate with Apple devices")
433 (description "libimobiledevice is a software library that talks the
434protocols to support Apple devices. It allows other software to easily access
ddfd529c 435the device's file system, retrieve information about the device and its
0c90d4ad 436internals, backup/restore the device, manage installed applications, retrieve
ddfd529c 437address books, calendars, notes, and bookmarks, and (using libgpod) synchronize
0c90d4ad
RW
438music and video to the device.")
439 (license license:lgpl2.1+)))
440
bc4e8d3e
DM
441(define-public ifuse
442 (package
443 (name "ifuse")
c0d0688e 444 (version "1.1.4")
bc4e8d3e
DM
445 (source (origin
446 (method url-fetch)
c0d0688e
KK
447 (uri (string-append "https://github.com/libimobiledevice"
448 "/ifuse/releases/download/" version
449 "/ifuse-" version ".tar.bz2"))
bc4e8d3e
DM
450 (sha256
451 (base32
c0d0688e 452 "11wdv44qwia77sh38n36809ysaib52rwd4fvqwb5ybsbz4p70l1m"))))
bc4e8d3e
DM
453 (inputs
454 `(("fuse" ,fuse)
455 ("libimobiledevice" ,libimobiledevice)))
456 (native-inputs
457 `(("pkg-config" ,pkg-config)))
458 (build-system gnu-build-system)
c0d0688e 459 (home-page "https://libimobiledevice.org/")
bc4e8d3e
DM
460 (synopsis "Mount iOS devices")
461 (description "This package provides @command{ifuse}, a command to mount
462iOS devices and access their contents.")
463 (license license:lgpl2.1+)))
464
fc80f54e
DM
465(define-public usbmuxd
466 (package
467 (name "usbmuxd")
4de6f4d7 468 (version "1.1.1")
fc80f54e
DM
469 (source (origin
470 (method url-fetch)
4de6f4d7
KK
471 (uri (string-append "https://github.com/libimobiledevice"
472 "/usbmuxd/releases/download/" version
473 "/usbmuxd-" version ".tar.bz2"))
fc80f54e
DM
474 (sha256
475 (base32
4de6f4d7 476 "17idzpxrvkbff0jpynf35df95lh7wsm8vndynp63bxib2w09gv60"))))
fc80f54e
DM
477 (inputs
478 `(("libplist" ,libplist)
479 ("libusb" ,libusb)
480 ("libimobiledevice" ,libimobiledevice)))
481 (native-inputs
482 `(("pkg-config" ,pkg-config)))
483 (build-system gnu-build-system)
4de6f4d7 484 (home-page "https://libimobiledevice.org/")
fc80f54e
DM
485 (synopsis "Multiplex connections over USB to an iOS device")
486 (description "This package provides the @code{usbmuxd} daemon
487which multiplexes connections over USB to an iOS device. To
488users, it means you can sync your music, contacts, photos, etc.
489over USB.")
490 (license license:gpl2+)))
491
75be6b7c
AE
492(define-public libmtp
493 (package
494 (name "libmtp")
abc21422 495 (version "1.1.18")
75be6b7c
AE
496 (source (origin
497 (method url-fetch)
de67e922 498 (uri (string-append "mirror://sourceforge/libmtp/libmtp/" version
75be6b7c
AE
499 "/libmtp-" version ".tar.gz"))
500 (sha256
0e6ee10c 501 (base32
abc21422 502 "1w41l93yi0dmw218daiw36rylkc8rammxx37csh1ij24q18gx03j"))))
75be6b7c
AE
503 (build-system gnu-build-system)
504 (native-inputs
505 `(("pkg-config" ,pkg-config)))
fa72d189
MB
506 (inputs
507 `(("libgcrypt" ,libgcrypt)))
cff77d48
SB
508 (propagated-inputs
509 ;; libmtp.pc refers to all these.
fa72d189 510 `(("libusb" ,libusb)))
75be6b7c
AE
511 (arguments
512 `(#:configure-flags
34a3566f
MB
513 (list "--disable-static"
514 (string-append "--with-udev="
75be6b7c
AE
515 (assoc-ref %outputs "out")
516 "/lib/udev"))))
517 (home-page "http://libmtp.sourceforge.net/")
518 (synopsis "Library implementing the Media Transfer Protocol")
519 (description "Libmtp implements an MTP (Media Transfer Protocol)
520initiator, which means that it initiates MTP sessions with devices. The
521devices responding are known as MTP responders. Libmtp runs on devices
522with a USB host controller interface. It implements MTP Basic, which was
523proposed for standardization.")
524 ;; COPYING contains lgpl2.1, while files headers give
525 ;; "GNU Lesser General Public License as published by the Free Software
526 ;; Foundation; either version 2 of the License, or (at your option) any
527 ;; later version."
3ecb1d05 528 (license license:lgpl2.1+)))
3d3caf1f
RW
529
530(define-public gmtp
531 (package
532 (name "gmtp")
f62dcba4 533 (version "1.3.11")
3d3caf1f
RW
534 (source (origin
535 (method url-fetch)
de67e922 536 (uri (string-append "mirror://sourceforge/gmtp/gMTP-" version
3d3caf1f
RW
537 "/gmtp-" version ".tar.gz"))
538 (sha256
539 (base32
f62dcba4 540 "04q6byyq002fhzkc2rkkahwh5b6272xakaj4m3vwm8la8jf0r0ss"))))
3d3caf1f
RW
541 (build-system glib-or-gtk-build-system)
542 (arguments
543 '(#:configure-flags
544 (let ((libid3tag (assoc-ref %build-inputs "libid3tag")))
545 (list
546 ;; libid3tag provides no .pc file, so pkg-config fails to find them.
547 (string-append "ID3TAG_CFLAGS=-I" libid3tag "/include")
548 (string-append "ID3TAG_LIBS=-L" libid3tag "/lib -lid3tag -lz")))))
549 (inputs
550 `(("gtk+" ,gtk+)
551 ("flac" ,flac)
552 ("libvorbis" ,libvorbis)
553 ("libid3tag" ,libid3tag)
554 ("libmtp" ,libmtp)))
555 (native-inputs
556 `(("pkg-config" ,pkg-config)))
557 (home-page "http://gmtp.sourceforge.net/")
558 (synopsis "Simple graphical MTP client")
559 (description "gMTP is a simple graphical client for the Media Transfer Protocol
560 (MTP), which allows media files to be transferred to and from many portable
561devices.")
3ecb1d05 562 (license license:bsd-3)))
3d74f12e
TF
563
564(define-public hidapi
565 (package
566 (name "hidapi")
4f78d8ee 567 (version "0.10.1")
b7dfc5a7
TGR
568 (source
569 (origin
570 (method git-fetch)
571 (uri (git-reference
b0e7b699 572 (url "https://github.com/libusb/hidapi")
b7dfc5a7 573 (commit (string-append "hidapi-" version))))
a6b937b3 574 (file-name (git-file-name name version))
b7dfc5a7 575 (sha256
4f78d8ee 576 (base32 "1nr4z4b10vpbh3ss525r7spz4i43zim2ba5qzfl15dgdxshxxivb"))))
3d74f12e 577 (build-system gnu-build-system)
3d74f12e
TF
578 (inputs
579 `(("libusb" ,libusb)
580 ("udev" ,eudev)))
581 (native-inputs
582 `(("autoconf" ,autoconf)
583 ("automake" ,automake)
584 ("libtool" ,libtool)
585 ("pkg-config" ,pkg-config)))
7f6592c4 586 (home-page "https://github.com/libusb/hidapi")
3d74f12e
TF
587 (synopsis "HID API library")
588 (description
589 "HIDAPI is a library which allows an application to interface with USB and Bluetooth
590HID-Class devices.")
591 ;; HIDAPI can be used under one of three licenses.
3ecb1d05
RW
592 (license (list license:gpl3
593 license:bsd-3
594 (license:non-copyleft "file://LICENSE-orig.txt")))))
93e5c93e
DM
595
596(define-public python-hidapi
597 (package
598 (name "python-hidapi")
599 (version "0.7.99.post21")
600 (source
601 (origin
602 (method url-fetch)
603 (uri (pypi-uri "hidapi" version))
604 (sha256
605 (base32
606 "15ws59zdrxahf3k7z5rcrwc4jgv1307anif8ixm2cyb9ask1mgp0"))
607 (modules '((guix build utils)))
608 (snippet
609 ;; Remove bundled libraries.
610 '(begin
611 (delete-file-recursively "hidapi")
612 #t))))
613 (build-system python-build-system)
614 (arguments
615 `(#:phases
616 (modify-phases %standard-phases
617 (add-after 'unpack 'patch-configuration
618 (lambda* (#:key inputs #:allow-other-keys)
619 (substitute* "setup.py"
620 (("'/usr/include/libusb-1.0'")
621 (string-append "'" (assoc-ref inputs "libusb")
622 "/include/libusb-1.0'"))
623 (("'/usr/include/hidapi'")
624 (string-append "'" (assoc-ref inputs "hidapi")
625 "/include/hidapi'")))
626 #t))
627 ;; XXX Necessary because python-build-system drops the arguments.
628 (replace 'build
629 (lambda _
630 (invoke "python" "setup.py" "build" "--with-system-hidapi")))
631 (replace 'check
632 (lambda _
633 (invoke "python" "setup.py" "test" "--with-system-hidapi")))
634 (replace 'install
635 (lambda* (#:key outputs #:allow-other-keys)
636 (invoke "python" "setup.py" "install" "--with-system-hidapi"
637 (string-append "--prefix=" (assoc-ref outputs "out"))
638 "--single-version-externally-managed" "--root=/"))))))
639 (inputs
640 `(("hidapi" ,hidapi)
641 ("libusb" ,libusb)
642 ("eudev" ,eudev)))
643 (native-inputs
644 `(("python-cython" ,python-cython)))
645 (home-page "https://github.com/trezor/cython-hidapi")
646 (synopsis "Cython interface to hidapi")
647 (description "This package provides a Cython interface to @code{hidapi}.")
648 ;; The library can be used under either of these licenses.
3ecb1d05
RW
649 (license (list license:gpl3
650 license:bsd-3
651 (license:non-copyleft
93e5c93e
DM
652 "https://github.com/trezor/cython-hidapi/blob/master/LICENSE-orig.txt"
653 "You are free to use cython-hidapi code for any purpose.")))))
654
655(define-public python2-hidapi
656 (package-with-python2 python-hidapi))