python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / development / libraries / libftdi / 1.x.nix
blobe19a9764bdf9e66fe0ead0bf1d4122f6fdb6acd3
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
18 let
19   inherit (lib) optionals optionalString;
20   onOff = a: if a then "ON" else "OFF";
22 stdenv.mkDerivation rec {
23   pname = "libftdi";
24   version = "1.5";
26   src = fetchgit {
27     url = "git://developer.intra2net.com/libftdi";
28     rev = "v${version}";
29     sha256 = "0vipg3y0kbbzjhxky6hfyxy42mpqhvwn1r010zr5givcfp8ghq26";
30   };
32   strictDeps = true;
34   nativeBuildInputs = [ cmake pkg-config ]
35     ++ optionals docSupport [ doxygen graphviz ]
36     ++ optionals pythonSupport [ swig ];
38   buildInputs = [ libconfuse ]
39     ++ optionals cppSupport [ boost ];
41   cmakeFlags = [
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}"
49   ];
51   propagatedBuildInputs = [ libusb1 ];
53   postInstall = ''
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/"
59   '';
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"
66     done
67   '';
69   meta = with lib; {
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 ];
75   };