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
1
-
{ lib, stdenv, fetchurl, cmake, pkg-config, libusb1, libconfuse
2
2
-
, cppSupport ? true, boost ? null
3
3
-
, pythonSupport ? true, python3 ? null, swig ? null
4
4
-
, docSupport ? true, doxygen ? null
1
1
+
{ lib
2
2
+
, stdenv
3
3
+
, fetchgit
4
4
+
, cmake
5
5
+
, pkg-config
6
6
+
, libusb1
7
7
+
, libconfuse
8
8
+
, cppSupport ? true
9
9
+
, boost
10
10
+
, pythonSupport ? true
11
11
+
, python3
12
12
+
, swig
13
13
+
, docSupport ? true
14
14
+
, doxygen
15
15
+
, graphviz
5
16
}:
6
17
7
7
-
assert cppSupport -> boost != null;
8
8
-
assert pythonSupport -> python3 != null && swig != null;
9
9
-
assert docSupport -> doxygen != null;
10
10
-
18
18
+
let
19
19
+
inherit (lib) optionals optionalString;
20
20
+
onOff = a: if a then "ON" else "OFF";
21
21
+
in
11
22
stdenv.mkDerivation rec {
12
12
-
name = "libftdi1-1.4";
23
23
+
pname = "libftdi";
24
24
+
version = "1.5";
13
25
14
14
-
src = fetchurl {
15
15
-
url = "https://www.intra2net.com/en/developer/libftdi/download/${name}.tar.bz2";
16
16
-
sha256 = "0x0vncf6i92slgrn0h7ghkskqbglbs534220qa84d0qg114zndpc";
26
26
+
src = fetchgit {
27
27
+
url = "git://developer.intra2net.com/libftdi";
28
28
+
rev = "v${version}";
29
29
+
sha256 = "0vipg3y0kbbzjhxky6hfyxy42mpqhvwn1r010zr5givcfp8ghq26";
17
30
};
18
31
19
19
-
nativeBuildInputs = [ cmake pkg-config ];
20
20
-
buildInputs = with lib; [ libconfuse ]
32
32
+
nativeBuildInputs = [ cmake pkg-config ]
33
33
+
++ optionals docSupport [ doxygen graphviz ]
34
34
+
++ optionals pythonSupport [ swig ];
35
35
+
36
36
+
buildInputs = [ libconfuse ]
21
37
++ optionals cppSupport [ boost ]
22
22
-
++ optionals pythonSupport [ python3 swig ]
23
23
-
++ optionals docSupport [ doxygen ];
38
38
+
++ optionals pythonSupport [ python3 ];
24
39
25
25
-
preBuild = lib.optionalString docSupport ''
26
26
-
make doc_i
27
27
-
'';
40
40
+
cmakeFlags = [
41
41
+
"-DFTDIPP=${onOff cppSupport}"
42
42
+
"-DBUILD_TESTS=${onOff cppSupport}"
43
43
+
"-DLINK_PYTHON_LIBRARY=${onOff pythonSupport}"
44
44
+
"-DPYTHON_BINDINGS=${onOff pythonSupport}"
45
45
+
"-DDOCUMENTATION=${onOff docSupport}"
46
46
+
];
28
47
29
48
propagatedBuildInputs = [ libusb1 ];
30
49
31
50
postInstall = ''
32
51
mkdir -p "$out/etc/udev/rules.d/"
33
52
cp ../packages/99-libftdi.rules "$out/etc/udev/rules.d/"
53
53
+
'' + optionalString docSupport ''
34
54
cp -r doc/man "$out/share/"
35
35
-
'' + lib.optionalString docSupport ''
36
36
-
mkdir -p "$out/share/libftdi/doc/"
37
37
-
cp -r doc/html "$out/share/libftdi/doc/"
55
55
+
cp -r doc/html "$out/share/doc/libftdi1/"
56
56
+
'';
57
57
+
58
58
+
postFixup = optionalString cppSupport ''
59
59
+
# This gets misassigned to the C++ version's path for some reason
60
60
+
for fileToFix in $out/{bin/libftdi1-config,lib/pkgconfig/libftdi1.pc}; do
61
61
+
substituteInPlace $fileToFix \
62
62
+
--replace "$out/include/libftdipp1" "$out/include/libftdi1"
63
63
+
done
38
64
'';
39
65
40
66
meta = with lib; {
41
67
description = "A library to talk to FTDI chips using libusb";
42
68
homepage = "https://www.intra2net.com/en/developer/libftdi/";
43
43
-
license = with licenses; [ lgpl2 gpl2 ];
44
44
-
platforms = with platforms; linux ++ darwin;
45
45
-
maintainers = [ maintainers.bjornfor ];
69
69
+
license = with licenses; [ lgpl2Only gpl2Only ];
70
70
+
platforms = platforms.all;
71
71
+
maintainers = with maintainers; [ bjornfor ];
46
72
};
47
73
}