10 , pythonSupport ? true
19 inherit (lib) optionals optionalString;
20 onOff = a: if a then "ON" else "OFF";
22 stdenv.mkDerivation rec {
27 url = "git://developer.intra2net.com/libftdi";
29 sha256 = "0vipg3y0kbbzjhxky6hfyxy42mpqhvwn1r010zr5givcfp8ghq26";
34 nativeBuildInputs = [ cmake pkg-config ]
35 ++ optionals docSupport [ doxygen graphviz ]
36 ++ optionals pythonSupport [ swig ];
38 buildInputs = [ libconfuse ]
39 ++ optionals cppSupport [ boost ];
42 "-DFTDIPP=${onOff cppSupport}"
43 "-DBUILD_TESTS=${onOff cppSupport}"
44 "-DLINK_PYTHON_LIBRARY=${onOff pythonSupport}"
45 "-DPYTHON_BINDINGS=${onOff pythonSupport}"
46 "-DDOCUMENTATION=${onOff docSupport}"
47 "-DPYTHON_EXECUTABLE=${python3.pythonForBuild.interpreter}"
48 "-DPYTHON_LIBRARY=${python3}/lib/libpython${python3.pythonVersion}${stdenv.hostPlatform.extensions.sharedLibrary}"
51 propagatedBuildInputs = [ libusb1 ];
54 mkdir -p "$out/etc/udev/rules.d/"
55 cp ../packages/99-libftdi.rules "$out/etc/udev/rules.d/"
56 '' + optionalString docSupport ''
57 cp -r doc/man "$out/share/"
58 cp -r doc/html "$out/share/doc/libftdi1/"
61 postFixup = optionalString cppSupport ''
62 # This gets misassigned to the C++ version's path for some reason
63 for fileToFix in $out/{bin/libftdi1-config,lib/pkgconfig/libftdi1.pc}; do
64 substituteInPlace $fileToFix \
65 --replace "$out/include/libftdipp1" "$out/include/libftdi1"
70 description = "A library to talk to FTDI chips using libusb";
71 homepage = "https://www.intra2net.com/en/developer/libftdi/";
72 license = with licenses; [ lgpl2Only gpl2Only ];
73 platforms = platforms.all;
74 maintainers = with maintainers; [ bjornfor ];