| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 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=''" |
| 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)) |
| 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)) |
| 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,
|
| 108 | FT2232D, FT245R and FT232H including the popular bitbangmode.
|
| 109 | To use @code{libftdi} without root privileges it is necessary to install the
|
| 110 | necessary udev rules. This can be done by extending @code{udev-service-type}
|
| 111 | in the @code{operating-system} configuration file with this package, as in:
|
| 112 | @lisp
|
| 113 | (udev-rules-service 'libftdi libftdi #:groups '(\"plugdev\")
|
| 114 | @end lisp
|
| 115 | Additionally, the @samp{plugdev} group should be registered in the
|
| 116 | @code{supplementary-groups} field of your @code{user-account}
|
| 117 | declaration. Refer to @samp{info \"(guix) Base Services\"} for examples.")
|
| 118 | (license (list license:gpl2 |
| 119 | license:lgpl2.1)))) |