From 06c6ec1c9938133107971cd04bb343aaadd0efed Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Tue, 23 Mar 2021 11:10:39 +0100 Subject: [PATCH 1/2] libftdi1: 1.4 -> 1.5, refactor --- pkgs/development/libraries/libftdi/1.x.nix | 78 ++++++++++++++-------- 1 file changed, 52 insertions(+), 26 deletions(-) diff --git a/pkgs/development/libraries/libftdi/1.x.nix b/pkgs/development/libraries/libftdi/1.x.nix index ae599a97529b..30c9e294ecc8 100644 --- a/pkgs/development/libraries/libftdi/1.x.nix +++ b/pkgs/development/libraries/libftdi/1.x.nix @@ -1,47 +1,73 @@ -{ lib, stdenv, fetchurl, cmake, pkg-config, libusb1, libconfuse -, cppSupport ? true, boost ? null -, pythonSupport ? true, python3 ? null, swig ? null -, docSupport ? true, doxygen ? null +{ lib +, stdenv +, fetchgit +, cmake +, pkg-config +, libusb1 +, libconfuse +, cppSupport ? true +, boost +, pythonSupport ? true +, python3 +, swig +, docSupport ? true +, doxygen +, graphviz }: -assert cppSupport -> boost != null; -assert pythonSupport -> python3 != null && swig != null; -assert docSupport -> doxygen != null; - +let + inherit (lib) optionals optionalString; + onOff = a: if a then "ON" else "OFF"; +in stdenv.mkDerivation rec { - name = "libftdi1-1.4"; + pname = "libftdi"; + version = "1.5"; - src = fetchurl { - url = "https://www.intra2net.com/en/developer/libftdi/download/${name}.tar.bz2"; - sha256 = "0x0vncf6i92slgrn0h7ghkskqbglbs534220qa84d0qg114zndpc"; + src = fetchgit { + url = "git://developer.intra2net.com/libftdi"; + rev = "v${version}"; + sha256 = "0vipg3y0kbbzjhxky6hfyxy42mpqhvwn1r010zr5givcfp8ghq26"; }; - nativeBuildInputs = [ cmake pkg-config ]; - buildInputs = with lib; [ libconfuse ] - ++ optionals cppSupport [ boost ] - ++ optionals pythonSupport [ python3 swig ] - ++ optionals docSupport [ doxygen ]; + nativeBuildInputs = [ cmake pkg-config ] + ++ optionals docSupport [ doxygen graphviz ] + ++ optionals pythonSupport [ swig ]; - preBuild = lib.optionalString docSupport '' - make doc_i - ''; + buildInputs = [ libconfuse ] + ++ optionals cppSupport [ boost ] + ++ optionals pythonSupport [ python3 ]; + + cmakeFlags = [ + "-DFTDIPP=${onOff cppSupport}" + "-DBUILD_TESTS=${onOff cppSupport}" + "-DLINK_PYTHON_LIBRARY=${onOff pythonSupport}" + "-DPYTHON_BINDINGS=${onOff pythonSupport}" + "-DDOCUMENTATION=${onOff docSupport}" + ]; propagatedBuildInputs = [ libusb1 ]; postInstall = '' mkdir -p "$out/etc/udev/rules.d/" cp ../packages/99-libftdi.rules "$out/etc/udev/rules.d/" + '' + optionalString docSupport '' cp -r doc/man "$out/share/" - '' + lib.optionalString docSupport '' - mkdir -p "$out/share/libftdi/doc/" - cp -r doc/html "$out/share/libftdi/doc/" + cp -r doc/html "$out/share/doc/libftdi1/" + ''; + + postFixup = optionalString cppSupport '' + # This gets misassigned to the C++ version's path for some reason + for fileToFix in $out/{bin/libftdi1-config,lib/pkgconfig/libftdi1.pc}; do + substituteInPlace $fileToFix \ + --replace "$out/include/libftdipp1" "$out/include/libftdi1" + done ''; meta = with 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 ]; + license = with licenses; [ lgpl2Only gpl2Only ]; + platforms = platforms.all; + maintainers = with maintainers; [ bjornfor ]; }; } From cfba508aa96cc6830e04a2b9d636f06797fc3921 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Tue, 23 Mar 2021 11:11:11 +0100 Subject: [PATCH 2/2] blackmagic: Add patch for libftdi1 1.5 compatibility --- pkgs/development/tools/misc/blackmagic/default.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/misc/blackmagic/default.nix b/pkgs/development/tools/misc/blackmagic/default.nix index fc1af1a4d684..479abed55b3f 100644 --- a/pkgs/development/tools/misc/blackmagic/default.nix +++ b/pkgs/development/tools/misc/blackmagic/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchFromGitHub +{ stdenv, lib, fetchFromGitHub, fetchpatch , gcc-arm-embedded, libftdi1, libusb-compat-0_1, pkg-config , python, pythonPackages }: @@ -19,6 +19,14 @@ stdenv.mkDerivation rec { fetchSubmodules = true; }; + patches = [ + # Fix deprecation warning with libftdi 1.5 + (fetchpatch { + url = "https://github.com/blacksphere/blackmagic/commit/dea4be2539c5ea63836ec78dca08b52fa8b26ab5.patch"; + sha256 = "0f81simij1wdhifsxaavalc6yxzagfbgwry969dbjmxqzvrsrds5"; + }) + ]; + nativeBuildInputs = [ gcc-arm-embedded pkg-config ];