2022-11-21 17:40:18 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, libusb-compat-0_1
|
|
|
|
, Security
|
|
|
|
, IOKit
|
|
|
|
, libobjc
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2021-07-21 07:28:18 +00:00
|
|
|
pname = "libftdi";
|
|
|
|
version = "0.20";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-07-21 07:28:18 +00:00
|
|
|
url = "https://www.intra2net.com/en/developer/libftdi/download/${pname}-${version}.tar.gz";
|
2020-04-24 23:36:52 +00:00
|
|
|
sha256 = "13l39f6k6gff30hsgh0wa2z422g9pyl91rh8a8zz6f34k2sxaxii";
|
|
|
|
};
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
buildInputs = [ libusb-compat-0_1 ] ++ lib.optionals stdenv.isDarwin [ libobjc Security IOKit ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-05-03 17:38:23 +00:00
|
|
|
propagatedBuildInputs = [ libusb-compat-0_1 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
configureFlags = lib.optional (!stdenv.isDarwin) "--with-async-mode";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# allow async mode. from ubuntu. see:
|
|
|
|
# https://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/libftdi/trusty/view/head:/debian/patches/04_async_mode.diff
|
|
|
|
patchPhase = ''
|
|
|
|
substituteInPlace ./src/ftdi.c \
|
|
|
|
--replace "ifdef USB_CLASS_PTP" "if 0"
|
|
|
|
'';
|
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
# remove forbidden references to $TMPDIR
|
|
|
|
preFixup = lib.optionalString stdenv.isLinux ''
|
|
|
|
for f in "$out"/bin/*; do
|
|
|
|
if isELF "$f"; then
|
|
|
|
patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" "$f"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
description = "A library to talk to FTDI chips using libusb";
|
|
|
|
homepage = "https://www.intra2net.com/en/developer/libftdi/";
|
|
|
|
license = lib.licenses.lgpl21;
|
|
|
|
platforms = lib.platforms.all;
|
|
|
|
};
|
|
|
|
}
|