Commit | Line | Data |
---|---|---|
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> |
18fe5ef1 | 5 | ;;; Copyright © 2015, 2016, 2017 Ricardo Wurmus <rekado@elephly.net> |
50637966 | 6 | ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il> |
3d74f12e | 7 | ;;; Copyright © 2016 Theodoros Foradis <theodoros.for@openmailbox.org> |
3b48f78c | 8 | ;;; |
233e7676 | 9 | ;;; This file is part of GNU Guix. |
3b48f78c | 10 | ;;; |
233e7676 | 11 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
3b48f78c NK |
12 | ;;; under the terms of the GNU General Public License as published by |
13 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
14 | ;;; your option) any later version. | |
15 | ;;; | |
233e7676 | 16 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
3b48f78c NK |
17 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | ;;; GNU General Public License for more details. | |
20 | ;;; | |
21 | ;;; You should have received a copy of the GNU General Public License | |
233e7676 | 22 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
3b48f78c | 23 | |
1ffa7090 | 24 | (define-module (gnu packages libusb) |
59a43334 | 25 | #:use-module (gnu packages) |
3b48f78c NK |
26 | #:use-module (guix licenses) |
27 | #:use-module (guix packages) | |
e0477b73 | 28 | #:use-module (guix utils) |
3b48f78c | 29 | #:use-module (guix download) |
18fe5ef1 | 30 | #:use-module (guix git-download) |
423b6840 | 31 | #:use-module (guix build-system ant) |
18fe5ef1 | 32 | #:use-module (guix build-system cmake) |
75be6b7c | 33 | #:use-module (guix build-system gnu) |
3d3caf1f | 34 | #:use-module (guix build-system glib-or-gtk) |
fac34dfe | 35 | #:use-module (guix build-system python) |
3d74f12e | 36 | #:use-module (gnu packages autotools) |
75be6b7c | 37 | #:use-module (gnu packages gnupg) |
3d3caf1f | 38 | #:use-module (gnu packages gtk) |
18fe5ef1 | 39 | #:use-module (gnu packages java) |
034e0d50 | 40 | #:use-module (gnu packages linux) |
3d3caf1f RW |
41 | #:use-module (gnu packages mp3) |
42 | #:use-module (gnu packages pkg-config) | |
fac34dfe | 43 | #:use-module (gnu packages python) |
3d3caf1f | 44 | #:use-module (gnu packages xiph)) |
3b48f78c NK |
45 | |
46 | (define-public libusb | |
47 | (package | |
48 | (name "libusb") | |
2c273a82 | 49 | (version "1.0.21") |
3b48f78c NK |
50 | (source |
51 | (origin | |
52 | (method url-fetch) | |
53 | (uri (string-append "mirror://sourceforge/libusb/libusb-1.0/" | |
54 | "libusb-" version "/libusb-" version ".tar.bz2")) | |
55 | (sha256 | |
56 | (base32 | |
2c273a82 | 57 | "0jw2n5kdnrqvp7zh792fd6mypzzfap6jp4gfcmq4n6c1kb79rkkx")))) |
3b48f78c | 58 | (build-system gnu-build-system) |
034e0d50 LC |
59 | |
60 | ;; XXX: Enabling udev is now recommended, but eudev indirectly depends on | |
61 | ;; libusb. | |
62 | (arguments `(#:configure-flags '("--disable-udev"))) | |
63 | ;; (inputs `(("eudev" ,eudev))) | |
64 | ||
2c273a82 | 65 | (home-page "http://libusb.info") |
35b9e423 | 66 | (synopsis "User-space USB library") |
3b48f78c NK |
67 | (description |
68 | "Libusb is a library that gives applications easy access to USB | |
69 | devices on various operating systems.") | |
75be6b7c AE |
70 | (license lgpl2.1+))) |
71 | ||
e0477b73 AW |
72 | (define-public libusb-compat |
73 | (package | |
74 | (name "libusb-compat") | |
75 | (version "0.1.5") | |
76 | (source | |
77 | (origin | |
78 | (method url-fetch) | |
79 | (uri (string-append "mirror://sourceforge/libusb/" | |
80 | name "-" (version-major+minor version) "/" | |
81 | name "-" version "/" | |
82 | name "-" version ".tar.bz2")) | |
83 | (sha256 | |
84 | (base32 | |
85 | "0nn5icrfm9lkhzw1xjvaks9bq3w6mjg86ggv3fn7kgi4nfvg8kj0")))) | |
86 | (build-system gnu-build-system) | |
87 | (native-inputs | |
88 | `(("pkg-config" ,pkg-config))) | |
89 | (inputs | |
90 | `(("libusb" ,libusb))) | |
91 | (home-page "http://www.libusb.org") | |
92 | (synopsis "Compatibility shim for libusb") | |
93 | (description | |
94 | "Libusb-compat provides a shim allowing applications based on older | |
95 | version of libusb to run with newer libusb.") | |
96 | (license lgpl2.1+))) | |
97 | ||
18fe5ef1 RW |
98 | (define-public libusb4java |
99 | ;; There is no public release so we take the latest version from git. | |
100 | (let ((commit "396d642a57678a0d9663b062c980fe100cc0ea1e") | |
101 | (revision "1")) | |
102 | (package | |
103 | (name "libusb4java") | |
104 | (version (string-append "0-" revision "." (string-take commit 9))) | |
105 | (source (origin | |
106 | (method git-fetch) | |
107 | (uri (git-reference | |
108 | (url "https://github.com/usb4java/libusb4java.git") | |
109 | (commit commit))) | |
110 | (sha256 | |
111 | (base32 | |
112 | "0wqgapalhfh9v38ycbl6i2f5lh1wpr6fzwn5dwd0rdacypkd1gml")))) | |
113 | (build-system cmake-build-system) | |
114 | (arguments | |
115 | `(#:tests? #f ; there are no tests | |
116 | #:phases | |
117 | (modify-phases %standard-phases | |
118 | (add-before 'configure 'set-JAVA_HOME | |
119 | (lambda* (#:key inputs #:allow-other-keys) | |
120 | (setenv "JAVA_HOME" (assoc-ref inputs "jdk")) | |
121 | #t))))) | |
122 | (inputs | |
123 | `(("libusb" ,libusb))) | |
124 | (native-inputs | |
125 | `(("jdk" ,icedtea "jdk"))) | |
126 | (home-page "https://github.com/usb4java/libusb4java/") | |
127 | (synopsis "JNI bindings to libusb") | |
128 | (description | |
129 | "This package provides Java JNI bindings to the libusb library for use | |
130 | with usb4java.") | |
131 | (license expat)))) | |
132 | ||
423b6840 RW |
133 | (define-public java-usb4java |
134 | (package | |
135 | (name "java-usb4java") | |
136 | (version "1.2.0") | |
137 | (source (origin | |
138 | (method url-fetch) | |
139 | (uri (string-append "https://github.com/usb4java/usb4java/" | |
140 | "archive/usb4java-" version ".tar.gz")) | |
141 | (sha256 | |
142 | (base32 | |
143 | "0gzpsnzwgsdyra3smq288yvxnwrgvdwxr6g8jbknnsk56kv6wc34")))) | |
144 | (build-system ant-build-system) | |
145 | (arguments | |
146 | `(#:jar-name "usb4java.jar" | |
147 | #:phases | |
148 | (modify-phases %standard-phases | |
149 | ;; Usually, native libusb4java libraries for all supported systems | |
150 | ;; would be included in the jar and extracted at runtime. Since we | |
151 | ;; build everything from source we cannot just bundle pre-built | |
152 | ;; binaries for other systems. Instead, we patch the loader to | |
153 | ;; directly return the appropriate library for this system. The | |
154 | ;; downside is that the jar will only work on the same architecture | |
155 | ;; that it was built on. | |
156 | (add-after 'unpack 'copy-libusb4java | |
157 | (lambda* (#:key inputs #:allow-other-keys) | |
158 | (substitute* "src/main/java/org/usb4java/Loader.java" | |
159 | (("private static String extractLibrary" line) | |
160 | (string-append | |
161 | line "(final String a, final String b) {" | |
162 | "return \"" | |
163 | (assoc-ref inputs "libusb4java") "/lib/libusb4java.so" | |
164 | "\"; }\n" | |
165 | "private static String _extractLibrary"))) | |
166 | #t)) | |
167 | (add-after 'unpack 'disable-broken-tests | |
168 | (lambda _ | |
169 | (with-directory-excursion "src/test/java/org/usb4java" | |
170 | ;; These tests should only be run when USB devices are present. | |
171 | (substitute* '("LibUsbGlobalTest.java" | |
172 | "TransferTest.java") | |
173 | (("this.context = new Context\\(\\);") | |
174 | "this.context = null;") | |
175 | (("LibUsb.init") "//")) | |
176 | (substitute* "DeviceListIteratorTest.java" | |
177 | (("this.iterator.remove" line) | |
178 | (string-append "assumeUsbTestsEnabled();" line)))) | |
179 | #t))))) | |
180 | (inputs | |
181 | `(("libusb4java" ,libusb4java) | |
182 | ("java-commons-lang3" ,java-commons-lang3) | |
183 | ("java-junit" ,java-junit) | |
184 | ("java-hamcrest-core" ,java-hamcrest-core))) | |
185 | (home-page "http://usb4java.org/") | |
186 | (synopsis "USB library for Java") | |
187 | (description | |
188 | "This package provides a USB library for Java based on libusb and | |
189 | implementing @code{javax.usb} (JSR-80).") | |
190 | (license expat))) | |
191 | ||
fac34dfe RW |
192 | (define-public python-pyusb |
193 | (package | |
194 | (name "python-pyusb") | |
a0b15f5e | 195 | (version "1.0.0") |
fac34dfe RW |
196 | (source |
197 | (origin | |
198 | (method url-fetch) | |
a0b15f5e | 199 | (uri (pypi-uri "PyUSB" version)) |
fac34dfe RW |
200 | (sha256 |
201 | (base32 | |
a0b15f5e | 202 | "0s2k4z06fapd5vp1gnrlf8a9sjpc03p9974lzw5k6ky39akzyd2v")))) |
fac34dfe RW |
203 | (build-system python-build-system) |
204 | (arguments | |
205 | `(#:tests? #f ;no tests | |
67a3b2dd RW |
206 | #:modules ((srfi srfi-1) |
207 | (srfi srfi-26) | |
fac34dfe RW |
208 | (guix build utils) |
209 | (guix build python-build-system)) | |
210 | #:phases | |
211 | (modify-phases %standard-phases | |
212 | (add-after 'unpack 'fix-libusb-reference | |
213 | (lambda* (#:key inputs #:allow-other-keys) | |
214 | (substitute* "usb/libloader.py" | |
215 | (("lib = locate_library\\(candidates, find_library\\)") | |
216 | (string-append | |
217 | "lib = \"" | |
67a3b2dd RW |
218 | (find (negate symbolic-link?) |
219 | (find-files (assoc-ref inputs "libusb") | |
220 | "^libusb-.*\\.so\\..*")) | |
fac34dfe RW |
221 | "\""))) |
222 | #t))))) | |
223 | (inputs | |
224 | `(("libusb" ,libusb))) | |
225 | (home-page "http://walac.github.io/pyusb/") | |
226 | (synopsis "Python bindings to the libusb library") | |
227 | (description | |
228 | "PyUSB aims to be an easy to use Python module to access USB devices.") | |
229 | (license bsd-3))) | |
230 | ||
231 | (define-public python2-pyusb | |
232 | (package-with-python2 python-pyusb)) | |
233 | ||
75be6b7c AE |
234 | (define-public libmtp |
235 | (package | |
236 | (name "libmtp") | |
05b66266 | 237 | (version "1.1.13") |
75be6b7c AE |
238 | (source (origin |
239 | (method url-fetch) | |
de67e922 | 240 | (uri (string-append "mirror://sourceforge/libmtp/libmtp/" version |
75be6b7c AE |
241 | "/libmtp-" version ".tar.gz")) |
242 | (sha256 | |
0e6ee10c | 243 | (base32 |
05b66266 | 244 | "0h3dv9py5mmvxhfxmkr8ky4s80hgq3d66cmrfnnnlcdwpwpy0kj9")))) |
75be6b7c AE |
245 | (build-system gnu-build-system) |
246 | (native-inputs | |
247 | `(("pkg-config" ,pkg-config))) | |
cff77d48 SB |
248 | (propagated-inputs |
249 | ;; libmtp.pc refers to all these. | |
75be6b7c AE |
250 | `(("libgcrypt" ,libgcrypt) |
251 | ("libusb" ,libusb))) | |
252 | (arguments | |
253 | `(#:configure-flags | |
254 | (list (string-append "--with-udev=" | |
255 | (assoc-ref %outputs "out") | |
256 | "/lib/udev")))) | |
257 | (home-page "http://libmtp.sourceforge.net/") | |
258 | (synopsis "Library implementing the Media Transfer Protocol") | |
259 | (description "Libmtp implements an MTP (Media Transfer Protocol) | |
260 | initiator, which means that it initiates MTP sessions with devices. The | |
261 | devices responding are known as MTP responders. Libmtp runs on devices | |
262 | with a USB host controller interface. It implements MTP Basic, which was | |
263 | proposed for standardization.") | |
264 | ;; COPYING contains lgpl2.1, while files headers give | |
265 | ;; "GNU Lesser General Public License as published by the Free Software | |
266 | ;; Foundation; either version 2 of the License, or (at your option) any | |
267 | ;; later version." | |
268 | (license lgpl2.1+))) | |
3d3caf1f RW |
269 | |
270 | (define-public gmtp | |
271 | (package | |
272 | (name "gmtp") | |
50637966 | 273 | (version "1.3.10") |
3d3caf1f RW |
274 | (source (origin |
275 | (method url-fetch) | |
de67e922 | 276 | (uri (string-append "mirror://sourceforge/gmtp/gMTP-" version |
3d3caf1f RW |
277 | "/gmtp-" version ".tar.gz")) |
278 | (sha256 | |
279 | (base32 | |
50637966 | 280 | "0fyi3pdl2g57vr0p46ip2wwzyap3l0by7iqaqygv0yxfcs79l6xj")))) |
3d3caf1f RW |
281 | (build-system glib-or-gtk-build-system) |
282 | (arguments | |
283 | '(#:configure-flags | |
284 | (let ((libid3tag (assoc-ref %build-inputs "libid3tag"))) | |
285 | (list | |
286 | ;; libid3tag provides no .pc file, so pkg-config fails to find them. | |
287 | (string-append "ID3TAG_CFLAGS=-I" libid3tag "/include") | |
288 | (string-append "ID3TAG_LIBS=-L" libid3tag "/lib -lid3tag -lz"))))) | |
289 | (inputs | |
290 | `(("gtk+" ,gtk+) | |
291 | ("flac" ,flac) | |
292 | ("libvorbis" ,libvorbis) | |
293 | ("libid3tag" ,libid3tag) | |
294 | ("libmtp" ,libmtp))) | |
295 | (native-inputs | |
296 | `(("pkg-config" ,pkg-config))) | |
297 | (home-page "http://gmtp.sourceforge.net/") | |
298 | (synopsis "Simple graphical MTP client") | |
299 | (description "gMTP is a simple graphical client for the Media Transfer Protocol | |
300 | (MTP), which allows media files to be transferred to and from many portable | |
301 | devices.") | |
302 | (license bsd-3))) | |
3d74f12e TF |
303 | |
304 | (define-public hidapi | |
305 | (package | |
306 | (name "hidapi") | |
307 | (version "0.8.0-rc1") | |
308 | (source (origin | |
309 | (method url-fetch) | |
310 | (uri (string-append "https://github.com/signal11/hidapi/archive/hidapi-" | |
311 | version ".tar.gz")) | |
312 | (sha256 | |
313 | (base32 | |
314 | "0qdgyj9rgb7n0nk3ghfswrhzzknxqn4ibn3wj8g4r828pw07451w")))) | |
315 | (build-system gnu-build-system) | |
316 | (arguments | |
317 | '(#:phases | |
318 | (modify-phases %standard-phases | |
319 | (add-before 'configure 'bootstrap | |
320 | (lambda _ | |
321 | (zero? (system* "autoreconf" "-vfi"))))))) | |
322 | (inputs | |
323 | `(("libusb" ,libusb) | |
324 | ("udev" ,eudev))) | |
325 | (native-inputs | |
326 | `(("autoconf" ,autoconf) | |
327 | ("automake" ,automake) | |
328 | ("libtool" ,libtool) | |
329 | ("pkg-config" ,pkg-config))) | |
330 | (home-page "http://www.signal11.us/oss/hidapi/") | |
331 | (synopsis "HID API library") | |
332 | (description | |
333 | "HIDAPI is a library which allows an application to interface with USB and Bluetooth | |
334 | HID-Class devices.") | |
335 | ;; HIDAPI can be used under one of three licenses. | |
336 | (license (list gpl3 | |
337 | bsd-3 | |
28791c1c | 338 | (non-copyleft "file://LICENSE-orig.txt"))))) |