11 , pythonSupport ? true
20 inherit (lib) optionals optionalString;
21 onOff = a: if a then "ON" else "OFF";
23 stdenv.mkDerivation rec {
25 version = "1.5-unstable-2023-12-21";
28 url = "git://developer.intra2net.com/libftdi";
29 rev = "de9f01ece34d2fe6e842e0250a38f4b16eda2429";
30 hash = "sha256-U37M5P7itTF1262oW+txbKxcw2lhYHAwy1ML51SDVMs=";
35 # http://developer.intra2net.com/mailarchive/html/libftdi/2024/msg00024.html
36 # https://bugzilla.redhat.com/show_bug.cgi?id=2319133
37 name = "swig-4.3.0-fix.patch";
38 url = "https://src.fedoraproject.org/rpms/libftdi/raw/9051ea9ea767eced58b69d855a5d700a5d4602cc/f/libftdi-1.5-swig-4.3.patch";
39 hash = "sha256-X5tqiPewnyAyvLzR6s0VbNpZKLd0idtPGU4ro36CZHI=";
45 nativeBuildInputs = [ cmake pkg-config ]
46 ++ optionals docSupport [ doxygen graphviz ]
47 ++ optionals pythonSupport [ swig ];
49 buildInputs = [ libconfuse ]
50 ++ optionals cppSupport [ boost ];
53 "-DFTDIPP=${onOff cppSupport}"
54 "-DBUILD_TESTS=${onOff cppSupport}"
55 "-DLINK_PYTHON_LIBRARY=${onOff pythonSupport}"
56 "-DPYTHON_BINDINGS=${onOff pythonSupport}"
57 "-DDOCUMENTATION=${onOff docSupport}"
58 ] ++ lib.optionals pythonSupport [
59 "-DPYTHON_EXECUTABLE=${python3.pythonOnBuildForHost.interpreter}"
60 "-DPYTHON_LIBRARY=${python3}/lib/libpython${python3.pythonVersion}${stdenv.hostPlatform.extensions.sharedLibrary}"
63 propagatedBuildInputs = [ libusb1 ];
66 mkdir -p "$out/etc/udev/rules.d/"
67 cp ../packages/99-libftdi.rules "$out/etc/udev/rules.d/"
68 '' + optionalString docSupport ''
69 cp -r doc/man "$out/share/"
70 cp -r doc/html "$out/share/doc/libftdi1/"
74 description = "Library to talk to FTDI chips using libusb";
75 homepage = "https://www.intra2net.com/en/developer/libftdi/";
76 license = with licenses; [ lgpl2Only gpl2Only ];
77 platforms = platforms.all;
78 maintainers = with maintainers; [ bjornfor ];