about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libftdi
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libftdi')
-rw-r--r--nixpkgs/pkgs/development/libraries/libftdi/1.x.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/libftdi/default.nix32
2 files changed, 79 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libftdi/1.x.nix b/nixpkgs/pkgs/development/libraries/libftdi/1.x.nix
new file mode 100644
index 000000000000..1b00ff4c0fbb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libftdi/1.x.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, cmake, pkgconfig, libusb1, libconfuse
+, cppSupport ? true, boost ? null
+, pythonSupport ? true, python ? null, swig ? null
+, docSupport ? true, doxygen ? null
+}:
+
+assert cppSupport -> boost != null;
+assert pythonSupport -> python != null && swig != null;
+assert docSupport -> doxygen != null;
+
+stdenv.mkDerivation rec {
+  name = "libftdi1-1.4";
+
+  src = fetchurl {
+    url = "https://www.intra2net.com/en/developer/libftdi/download/${name}.tar.bz2";
+    sha256 = "0x0vncf6i92slgrn0h7ghkskqbglbs534220qa84d0qg114zndpc";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = with stdenv.lib; [ libconfuse ]
+    ++ optionals cppSupport [ boost ]
+    ++ optionals pythonSupport [ python swig ]
+    ++ optionals docSupport [ doxygen ];
+
+  preBuild = stdenv.lib.optionalString docSupport ''
+    make doc_i
+  '';
+
+  propagatedBuildInputs = [ libusb1 ];
+
+  postInstall = ''
+    mkdir -p "$out/etc/udev/rules.d/"
+    cp ../packages/99-libftdi.rules "$out/etc/udev/rules.d/"
+    cp -r doc/man "$out/share/"
+  '' + stdenv.lib.optionalString docSupport ''
+    mkdir -p "$out/share/libftdi/doc/"
+    cp -r doc/html "$out/share/libftdi/doc/"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A library to talk to FTDI chips using libusb";
+    homepage = https://www.intra2net.com/en/developer/libftdi/;
+    license = with licenses; [ lgpl2 gpl2 ];
+    platforms = with platforms; linux ++ darwin;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libftdi/default.nix b/nixpkgs/pkgs/development/libraries/libftdi/default.nix
new file mode 100644
index 000000000000..74b87a46ef0a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libftdi/default.nix
@@ -0,0 +1,32 @@
+{stdenv, fetchurl, libusb}:
+
+stdenv.mkDerivation rec {
+  name = "libftdi-0.20";
+
+  src = fetchurl {
+    url = "https://www.intra2net.com/en/developer/libftdi/download/${name}.tar.gz";
+    sha256 = "13l39f6k6gff30hsgh0wa2z422g9pyl91rh8a8zz6f34k2sxaxii";
+  };
+
+  buildInputs = [ libusb ];
+
+  propagatedBuildInputs = [ libusb ];
+
+  # Hack to avoid TMPDIR in RPATHs.
+  preFixup = ''rm -rf "$(pwd)" '';
+  configureFlags = [ "--with-async-mode" ];
+
+  # 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"
+  '';
+
+  meta = {
+    description = "A library to talk to FTDI chips using libusb";
+    homepage = https://www.intra2net.com/en/developer/libftdi/;
+    license = stdenv.lib.licenses.lgpl21;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}