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