at 24.05-pre 47 lines 1.3 kB view raw
1{ lib 2, stdenv 3, fetchurl 4, libusb-compat-0_1 5, Security 6, IOKit 7, libobjc 8}: 9 10stdenv.mkDerivation rec { 11 pname = "libftdi"; 12 version = "0.20"; 13 14 src = fetchurl { 15 url = "https://www.intra2net.com/en/developer/libftdi/download/${pname}-${version}.tar.gz"; 16 sha256 = "13l39f6k6gff30hsgh0wa2z422g9pyl91rh8a8zz6f34k2sxaxii"; 17 }; 18 19 buildInputs = [ libusb-compat-0_1 ] ++ lib.optionals stdenv.isDarwin [ libobjc Security IOKit ]; 20 21 propagatedBuildInputs = [ libusb-compat-0_1 ]; 22 23 configureFlags = lib.optional (!stdenv.isDarwin) "--with-async-mode"; 24 25 # allow async mode. from ubuntu. see: 26 # https://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/libftdi/trusty/view/head:/debian/patches/04_async_mode.diff 27 patchPhase = '' 28 substituteInPlace ./src/ftdi.c \ 29 --replace "ifdef USB_CLASS_PTP" "if 0" 30 ''; 31 32 # remove forbidden references to $TMPDIR 33 preFixup = lib.optionalString stdenv.isLinux '' 34 for f in "$out"/bin/*; do 35 if isELF "$f"; then 36 patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" "$f" 37 fi 38 done 39 ''; 40 41 meta = { 42 description = "A library to talk to FTDI chips using libusb"; 43 homepage = "https://www.intra2net.com/en/developer/libftdi/"; 44 license = lib.licenses.lgpl21; 45 platforms = lib.platforms.all; 46 }; 47}