gnu: Add python-pyusb.
[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 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages libusb)
24 #:use-module (gnu packages)
25 #:use-module (guix licenses)
26 #:use-module (guix packages)
27 #:use-module (guix utils)
28 #:use-module (guix download)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system glib-or-gtk)
31 #:use-module (guix build-system python)
32 #:use-module (gnu packages gnupg)
33 #:use-module (gnu packages gtk)
34 #:use-module (gnu packages linux)
35 #:use-module (gnu packages mp3)
36 #:use-module (gnu packages pkg-config)
37 #:use-module (gnu packages python)
38 #:use-module (gnu packages xiph))
39
40 (define-public libusb
41 (package
42 (name "libusb")
43 (version "1.0.19")
44 (source
45 (origin
46 (method url-fetch)
47 (uri (string-append "mirror://sourceforge/libusb/libusb-1.0/"
48 "libusb-" version "/libusb-" version ".tar.bz2"))
49 (sha256
50 (base32
51 "0h38p9rxfpg9vkrbyb120i1diq57qcln82h5fr7hvy82c20jql3c"))))
52 (build-system gnu-build-system)
53
54 ;; XXX: Enabling udev is now recommended, but eudev indirectly depends on
55 ;; libusb.
56 (arguments `(#:configure-flags '("--disable-udev")))
57 ;; (inputs `(("eudev" ,eudev)))
58
59 (home-page "http://www.libusb.org")
60 (synopsis "User-space USB library")
61 (description
62 "Libusb is a library that gives applications easy access to USB
63 devices on various operating systems.")
64 (license lgpl2.1+)))
65
66 (define-public libusb-compat
67 (package
68 (name "libusb-compat")
69 (version "0.1.5")
70 (source
71 (origin
72 (method url-fetch)
73 (uri (string-append "mirror://sourceforge/libusb/"
74 name "-" (version-major+minor version) "/"
75 name "-" version "/"
76 name "-" version ".tar.bz2"))
77 (sha256
78 (base32
79 "0nn5icrfm9lkhzw1xjvaks9bq3w6mjg86ggv3fn7kgi4nfvg8kj0"))))
80 (build-system gnu-build-system)
81 (native-inputs
82 `(("pkg-config" ,pkg-config)))
83 (inputs
84 `(("libusb" ,libusb)))
85 (home-page "http://www.libusb.org")
86 (synopsis "Compatibility shim for libusb")
87 (description
88 "Libusb-compat provides a shim allowing applications based on older
89 version of libusb to run with newer libusb.")
90 (license lgpl2.1+)))
91
92 (define-public python-pyusb
93 (package
94 (name "python-pyusb")
95 (version "1.0.0rc1")
96 (source
97 (origin
98 (method url-fetch)
99 (uri (pypi-uri "pyusb" version))
100 (sha256
101 (base32
102 "07cjq11qhngzjd746k7688s6y2x7lpj669fxqfsiy985rg0jsn7j"))))
103 (build-system python-build-system)
104 (arguments
105 `(#:tests? #f ;no tests
106 #:modules ((srfi srfi-26)
107 (guix build utils)
108 (guix build python-build-system))
109 #:phases
110 (modify-phases %standard-phases
111 (add-after 'unpack 'fix-libusb-reference
112 (lambda* (#:key inputs #:allow-other-keys)
113 (substitute* "usb/libloader.py"
114 (("lib = locate_library\\(candidates, find_library\\)")
115 (string-append
116 "lib = \""
117 (car (find-files (assoc-ref inputs "libusb")
118 (lambda (file stat)
119 (and ((file-name-predicate
120 "^libusb-.*\\.so\\..*") file stat)
121 (not (symbolic-link? file))))))
122 "\"")))
123 #t)))))
124 (inputs
125 `(("libusb" ,libusb)))
126 (home-page "http://walac.github.io/pyusb/")
127 (synopsis "Python bindings to the libusb library")
128 (description
129 "PyUSB aims to be an easy to use Python module to access USB devices.")
130 (license bsd-3)))
131
132 (define-public python2-pyusb
133 (package-with-python2 python-pyusb))
134
135 (define-public libmtp
136 (package
137 (name "libmtp")
138 (version "1.1.9")
139 (source (origin
140 (method url-fetch)
141 (uri (string-append "mirror://sourceforge/libmtp/" version
142 "/libmtp-" version ".tar.gz"))
143 (sha256
144 (base32
145 "12dinqic0ljnhrwx3rc61jc7q24ybr0mckc2ya5kh1s1np0d7w93"))
146 (patches (search-patches "libmtp-devices.patch"))))
147 (build-system gnu-build-system)
148 (native-inputs
149 `(("pkg-config" ,pkg-config)))
150 (propagated-inputs
151 ;; libmtp.pc refers to all these.
152 `(("libgcrypt" ,libgcrypt)
153 ("libusb" ,libusb)))
154 (arguments
155 `(#:configure-flags
156 (list (string-append "--with-udev="
157 (assoc-ref %outputs "out")
158 "/lib/udev"))))
159 (home-page "http://libmtp.sourceforge.net/")
160 (synopsis "Library implementing the Media Transfer Protocol")
161 (description "Libmtp implements an MTP (Media Transfer Protocol)
162 initiator, which means that it initiates MTP sessions with devices. The
163 devices responding are known as MTP responders. Libmtp runs on devices
164 with a USB host controller interface. It implements MTP Basic, which was
165 proposed for standardization.")
166 ;; COPYING contains lgpl2.1, while files headers give
167 ;; "GNU Lesser General Public License as published by the Free Software
168 ;; Foundation; either version 2 of the License, or (at your option) any
169 ;; later version."
170 (license lgpl2.1+)))
171
172 (define-public gmtp
173 (package
174 (name "gmtp")
175 (version "1.3.10")
176 (source (origin
177 (method url-fetch)
178 (uri (string-append "mirror://sourceforge/gmtp/" version
179 "/gmtp-" version ".tar.gz"))
180 (sha256
181 (base32
182 "0fyi3pdl2g57vr0p46ip2wwzyap3l0by7iqaqygv0yxfcs79l6xj"))))
183 (build-system glib-or-gtk-build-system)
184 (arguments
185 '(#:configure-flags
186 (let ((libid3tag (assoc-ref %build-inputs "libid3tag")))
187 (list
188 ;; libid3tag provides no .pc file, so pkg-config fails to find them.
189 (string-append "ID3TAG_CFLAGS=-I" libid3tag "/include")
190 (string-append "ID3TAG_LIBS=-L" libid3tag "/lib -lid3tag -lz")))))
191 (inputs
192 `(("gtk+" ,gtk+)
193 ("flac" ,flac)
194 ("libvorbis" ,libvorbis)
195 ("libid3tag" ,libid3tag)
196 ("libmtp" ,libmtp)))
197 (native-inputs
198 `(("pkg-config" ,pkg-config)))
199 (home-page "http://gmtp.sourceforge.net/")
200 (synopsis "Simple graphical MTP client")
201 (description "gMTP is a simple graphical client for the Media Transfer Protocol
202 (MTP), which allows media files to be transferred to and from many portable
203 devices.")
204 (license bsd-3)))