projects/guix·blob java-team · refs

119 lines · 5.3 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <[email protected]>
3;;; Copyright © 2018 Tobias Geerinckx-Rice <[email protected]>
4;;; Copyright © 2023 Simon South <[email protected]>
5;;;
6;;; This file is part of GNU Guix.
7;;;
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21(define-module (gnu packages libftdi)
22 #:use-module (guix build utils)
23 #:use-module (guix build-system cmake)
24 #:use-module (guix download)
25 #:use-module (guix gexp)
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (guix packages)
28 #:use-module (guix utils)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages boost)
31 #:use-module (gnu packages documentation)
32 #:use-module (gnu packages graphviz)
33 #:use-module (gnu packages libusb)
34 #:use-module (gnu packages pkg-config)
35 #:use-module (gnu packages python)
36 #:use-module (gnu packages python-build)
37 #:use-module (gnu packages swig)
38 #:use-module (gnu packages textutils))
39
40(define-public libftdi
41 (package
42 (name "libftdi")
43 (version "1.5")
44 (source (origin
45 (method url-fetch)
46 (uri (string-append
47 "https://www.intra2net.com/en/developer/libftdi/download/"
48 "libftdi1-" version ".tar.bz2"))
49 (sha256
50 (base32
51 "0jdh5r499wbz83vmpskczq5m3cfc1mcv8xqisj5i95k1r3lr2w3w"))
52 (patches
53 (search-patches "libftdi-fix-paths-when-FTDIPP-set.patch"))))
54 (build-system cmake-build-system)
55 (outputs '("out" "doc" "python"))
56 (arguments
57 (list
58 #:configure-flags
59 #~(list (string-append "-DCMAKE_INSTALL_DOCDIR="
60 #$output "/share/doc/" #$name "-" #$version)
61 "-DDOCUMENTATION=ON"
62 "-DEXAMPLES=OFF"
63 "-DFTDIPP=ON"
64 "-DLIB_SUFFIX=''" ; place libraries in /lib, not /lib64
65 "-DPYTHON_BINDINGS=ON")
66 #:phases
67 #~(modify-phases %standard-phases
68 (add-after 'install 'install-python-binding
69 (lambda _
70 (let* ((python-version
71 #$(version-major+minor (package-version python)))
72 (python-lib-path
73 (string-append "/lib/python" python-version)))
74 (mkdir-p (string-append #$output:python "/lib"))
75 (mkdir-p (string-append #$output:python "/share/libftdi"))
76 (rename-file (string-append #$output python-lib-path)
77 (string-append #$output:python python-lib-path))
78 (rename-file (string-append #$output
79 "/share/libftdi/examples")
80 (string-append #$output:python
81 "/share/libftdi/examples")))))
82 (add-after 'install-python-binding 'install-udev-rules
83 (lambda _
84 (install-file
85 (string-append
86 "../libftdi1-" #$version "/packages/99-libftdi.rules")
87 (string-append #$output "/lib/udev/rules.d/"))))
88 (add-after 'install-python-binding 'install-documentation
89 (lambda _
90 (let ((share (string-append #$output:doc "/share")))
91 (copy-recursively "doc/man"
92 (string-append share "/man"))
93 (copy-recursively "doc/html"
94 (string-append share "/doc/"
95 #$name "-" #$version
96 "/html"))))))
97 #:tests? #f)) ; tests fail without access to USB
98 (native-inputs
99 (list doxygen graphviz pkg-config python python-setuptools swig-4.0))
100 (inputs
101 (list boost libconfuse))
102 (propagated-inputs
103 (list libusb)) ; required by libftdi1.pc
104 (home-page "https://www.intra2net.com/en/developer/libftdi/")
105 (synopsis "FTDI USB driver with bitbang mode")
106 (description
107 "libFTDI is a library to talk to FTDI chips: FT232BM, FT245BM, FT2232C,
108FT2232D, FT245R and FT232H including the popular bitbangmode.
109To use @code{libftdi} without root privileges it is necessary to install the
110necessary udev rules. This can be done by extending @code{udev-service-type}
111in the @code{operating-system} configuration file with this package, as in:
112@lisp
113(udev-rules-service 'libftdi libftdi #:groups '(\"plugdev\")
114@end lisp
115Additionally, the @samp{plugdev} group should be registered in the
116@code{supplementary-groups} field of your @code{user-account}
117declaration. Refer to @samp{info \"(guix) Base Services\"} for examples.")
118 (license (list license:gpl2 ; ftdi_eeprom, C++ bindings
119 license:lgpl2.1)))) ; main library