tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
libftdi1: 1.4 -> 1.5, refactor
OPNA2608
4 years ago
06c6ec1c
bef62e8c
+51
-25
1 changed file
expand all
collapse all
unified
split
pkgs
development
libraries
libftdi
1.x.nix
+51
-25
pkgs/development/libraries/libftdi/1.x.nix
···
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
0
0
0
0
0
0
0
0
0
0
0
5
}:
6
7
-
assert cppSupport -> boost != null;
8
-
assert pythonSupport -> python3 != null && swig != null;
9
-
assert docSupport -> doxygen != null;
10
-
11
stdenv.mkDerivation rec {
12
-
name = "libftdi1-1.4";
0
13
14
-
src = fetchurl {
15
-
url = "https://www.intra2net.com/en/developer/libftdi/download/${name}.tar.bz2";
16
-
sha256 = "0x0vncf6i92slgrn0h7ghkskqbglbs534220qa84d0qg114zndpc";
0
17
};
18
19
-
nativeBuildInputs = [ cmake pkg-config ];
20
-
buildInputs = with lib; [ libconfuse ]
0
0
0
21
++ optionals cppSupport [ boost ]
22
-
++ optionals pythonSupport [ python3 swig ]
23
-
++ optionals docSupport [ doxygen ];
24
25
-
preBuild = lib.optionalString docSupport ''
26
-
make doc_i
27
-
'';
0
0
0
0
28
29
propagatedBuildInputs = [ libusb1 ];
30
31
postInstall = ''
32
mkdir -p "$out/etc/udev/rules.d/"
33
cp ../packages/99-libftdi.rules "$out/etc/udev/rules.d/"
0
34
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/"
0
0
0
0
0
0
38
'';
39
40
meta = with lib; {
41
description = "A library to talk to FTDI chips using libusb";
42
homepage = "https://www.intra2net.com/en/developer/libftdi/";
43
-
license = with licenses; [ lgpl2 gpl2 ];
44
-
platforms = with platforms; linux ++ darwin;
45
-
maintainers = [ maintainers.bjornfor ];
46
};
47
}
···
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
16
}:
17
18
+
let
19
+
inherit (lib) optionals optionalString;
20
+
onOff = a: if a then "ON" else "OFF";
21
+
in
22
stdenv.mkDerivation rec {
23
+
pname = "libftdi";
24
+
version = "1.5";
25
26
+
src = fetchgit {
27
+
url = "git://developer.intra2net.com/libftdi";
28
+
rev = "v${version}";
29
+
sha256 = "0vipg3y0kbbzjhxky6hfyxy42mpqhvwn1r010zr5givcfp8ghq26";
30
};
31
32
+
nativeBuildInputs = [ cmake pkg-config ]
33
+
++ optionals docSupport [ doxygen graphviz ]
34
+
++ optionals pythonSupport [ swig ];
35
+
36
+
buildInputs = [ libconfuse ]
37
++ optionals cppSupport [ boost ]
38
+
++ optionals pythonSupport [ python3 ];
0
39
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
+
];
47
48
propagatedBuildInputs = [ libusb1 ];
49
50
postInstall = ''
51
mkdir -p "$out/etc/udev/rules.d/"
52
cp ../packages/99-libftdi.rules "$out/etc/udev/rules.d/"
53
+
'' + optionalString docSupport ''
54
cp -r doc/man "$out/share/"
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
64
'';
65
66
meta = with lib; {
67
description = "A library to talk to FTDI chips using libusb";
68
homepage = "https://www.intra2net.com/en/developer/libftdi/";
69
+
license = with licenses; [ lgpl2Only gpl2Only ];
70
+
platforms = platforms.all;
71
+
maintainers = with maintainers; [ bjornfor ];
72
};
73
}