git.iko.soy/typeable/nixpkgs
on master help sign in
libftdi1: 1.4 -> 1.5, refactor
commit06c6ec1c9938133107971cd04bb343aaadd0efed authorOPNA2608 <christoph.neidahl@gmail.com> dateTue 23 Mar 2021, 11:10 (6 years ago) parentbef62e8
1 file changed+51−25
pkgs/development/libraries/libftdi/1.x.nix+51−25
pkgs/development/libraries/libftdi/1.x.nix+51−25
@@ -1,47 +1,73 @@
1−{ lib, stdenv, fetchurl, cmake, pkg-config, libusb1, libconfuse
2−, cppSupport ? true, boost ? null
3−, pythonSupport ? true, python3 ? null, swig ? null
4−, docSupport ? true, doxygen ? null
1+{ lib
2+, stdenv
3+, fetchgit
4+, cmake
5+, pkg-config
6+, libusb1
7+, libconfuse
8+, cppSupport ? true
9+, boost
10+, pythonSupport ? true
11+, python3
12+, swig
13+, docSupport ? true
14+, doxygen
15+, graphviz
516}:
617
7−assert cppSupport -> boost != null;
8−assert pythonSupport -> python3 != null && swig != null;
9−assert docSupport -> doxygen != null;
10−
18+let
19+ inherit (lib) optionals optionalString;
20+ onOff = a: if a then "ON" else "OFF";
21+in
1122stdenv.mkDerivation rec {
12− name = "libftdi1-1.4";
23+ pname = "libftdi";
24+ version = "1.5";
1325
14− src = fetchurl {
15− url = "https://www.intra2net.com/en/developer/libftdi/download/${name}.tar.bz2";
16− sha256 = "0x0vncf6i92slgrn0h7ghkskqbglbs534220qa84d0qg114zndpc";
26+ src = fetchgit {
27+ url = "git://developer.intra2net.com/libftdi";
28+ rev = "v${version}";
29+ sha256 = "0vipg3y0kbbzjhxky6hfyxy42mpqhvwn1r010zr5givcfp8ghq26";
1730 };
1831
19− nativeBuildInputs = [ cmake pkg-config ];
20− buildInputs = with lib; [ libconfuse ]
32+ nativeBuildInputs = [ cmake pkg-config ]
33+ ++ optionals docSupport [ doxygen graphviz ]
34+ ++ optionals pythonSupport [ swig ];
35+
36+ buildInputs = [ libconfuse ]
2137 ++ optionals cppSupport [ boost ]
22− ++ optionals pythonSupport [ python3 swig ]
23− ++ optionals docSupport [ doxygen ];
38+ ++ optionals pythonSupport [ python3 ];
2439
25− preBuild = lib.optionalString docSupport ''
26− make doc_i
27− '';
40+ cmakeFlags = [
41+ "-DFTDIPP=${onOff cppSupport}"
42+ "-DBUILD_TESTS=${onOff cppSupport}"
43+ "-DLINK_PYTHON_LIBRARY=${onOff pythonSupport}"
44+ "-DPYTHON_BINDINGS=${onOff pythonSupport}"
45+ "-DDOCUMENTATION=${onOff docSupport}"
46+ ];
2847
2948 propagatedBuildInputs = [ libusb1 ];
3049
3150 postInstall = ''
3251 mkdir -p "$out/etc/udev/rules.d/"
3352 cp ../packages/99-libftdi.rules "$out/etc/udev/rules.d/"
53+ '' + optionalString docSupport ''
3454 cp -r doc/man "$out/share/"
35− '' + lib.optionalString docSupport ''
36− mkdir -p "$out/share/libftdi/doc/"
37− cp -r doc/html "$out/share/libftdi/doc/"
55+ cp -r doc/html "$out/share/doc/libftdi1/"
56+ '';
57+
58+ postFixup = optionalString cppSupport ''
59+ # This gets misassigned to the C++ version's path for some reason
60+ for fileToFix in $out/{bin/libftdi1-config,lib/pkgconfig/libftdi1.pc}; do
61+ substituteInPlace $fileToFix \
62+ --replace "$out/include/libftdipp1" "$out/include/libftdi1"
63+ done
3864 '';
3965
4066 meta = with lib; {
4167 description = "A library to talk to FTDI chips using libusb";
4268 homepage = "https://www.intra2net.com/en/developer/libftdi/";
43− license = with licenses; [ lgpl2 gpl2 ];
44− platforms = with platforms; linux ++ darwin;
45− maintainers = [ maintainers.bjornfor ];
69+ license = with licenses; [ lgpl2Only gpl2Only ];
70+ platforms = platforms.all;
71+ maintainers = with maintainers; [ bjornfor ];
4672 };
4773}