nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{lib, stdenv, fetchurl, libusb-compat-0_1}:
2
3stdenv.mkDerivation rec {
4 pname = "libftdi";
5 version = "0.20";
6
7 src = fetchurl {
8 url = "https://www.intra2net.com/en/developer/libftdi/download/${pname}-${version}.tar.gz";
9 sha256 = "13l39f6k6gff30hsgh0wa2z422g9pyl91rh8a8zz6f34k2sxaxii";
10 };
11
12 buildInputs = [ libusb-compat-0_1 ];
13
14 propagatedBuildInputs = [ libusb-compat-0_1 ];
15
16 # Hack to avoid TMPDIR in RPATHs.
17 preFixup = ''rm -rf "$(pwd)" '';
18 configureFlags = lib.optional (!stdenv.isDarwin) "--with-async-mode";
19
20 # allow async mode. from ubuntu. see:
21 # https://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/libftdi/trusty/view/head:/debian/patches/04_async_mode.diff
22 patchPhase = ''
23 substituteInPlace ./src/ftdi.c \
24 --replace "ifdef USB_CLASS_PTP" "if 0"
25 '';
26
27 meta = {
28 description = "A library to talk to FTDI chips using libusb";
29 homepage = "https://www.intra2net.com/en/developer/libftdi/";
30 license = lib.licenses.lgpl21;
31 platforms = lib.platforms.all;
32 };
33}