10 , pythonSupport ? true
19 inherit (lib) optionals optionalString;
20 onOff = a: if a then "ON" else "OFF";
22 stdenv.mkDerivation rec {
24 version = "1.5-unstable-2023-12-21";
27 url = "git://developer.intra2net.com/libftdi";
28 rev = "de9f01ece34d2fe6e842e0250a38f4b16eda2429";
29 hash = "sha256-U37M5P7itTF1262oW+txbKxcw2lhYHAwy1ML51SDVMs=";
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 ] ++ lib.optionals pythonSupport [
48 "-DPYTHON_EXECUTABLE=${python3.pythonOnBuildForHost.interpreter}"
49 "-DPYTHON_LIBRARY=${python3}/lib/libpython${python3.pythonVersion}${stdenv.hostPlatform.extensions.sharedLibrary}"
52 propagatedBuildInputs = [ libusb1 ];
55 mkdir -p "$out/etc/udev/rules.d/"
56 cp ../packages/99-libftdi.rules "$out/etc/udev/rules.d/"
57 '' + optionalString docSupport ''
58 cp -r doc/man "$out/share/"
59 cp -r doc/html "$out/share/doc/libftdi1/"
62 postFixup = optionalString cppSupport ''
63 # This gets misassigned to the C++ version's path for some reason
64 for fileToFix in $out/{bin/libftdi1-config,lib/pkgconfig/libftdi1.pc}; do
65 substituteInPlace $fileToFix \
66 --replace "$out/include/libftdipp1" "$out/include/libftdi1"
71 description = "Library to talk to FTDI chips using libusb";
72 homepage = "https://www.intra2net.com/en/developer/libftdi/";
73 license = with licenses; [ lgpl2Only gpl2Only ];
74 platforms = platforms.all;
75 maintainers = with maintainers; [ bjornfor ];