libusb.scm 25 KB

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