Merge pull request #117242 from OPNA2608/update/libftdi1-1.5/21.05

libftdi1: 1.4 -> 1.5
This commit is contained in:
Robert Scott 2021-04-03 00:17:38 +01:00 committed by GitHub
commit d535600060
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 61 additions and 27 deletions

View File

@ -1,47 +1,73 @@
{ lib, stdenv, fetchurl, cmake, pkg-config, libusb1, libconfuse { lib
, cppSupport ? true, boost ? null , stdenv
, pythonSupport ? true, python3 ? null, swig ? null , fetchgit
, docSupport ? true, doxygen ? null , cmake
, pkg-config
, libusb1
, libconfuse
, cppSupport ? true
, boost
, pythonSupport ? true
, python3
, swig
, docSupport ? true
, doxygen
, graphviz
}: }:
assert cppSupport -> boost != null; let
assert pythonSupport -> python3 != null && swig != null; inherit (lib) optionals optionalString;
assert docSupport -> doxygen != null; onOff = a: if a then "ON" else "OFF";
in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "libftdi1-1.4"; pname = "libftdi";
version = "1.5";
src = fetchurl { src = fetchgit {
url = "https://www.intra2net.com/en/developer/libftdi/download/${name}.tar.bz2"; url = "git://developer.intra2net.com/libftdi";
sha256 = "0x0vncf6i92slgrn0h7ghkskqbglbs534220qa84d0qg114zndpc"; rev = "v${version}";
sha256 = "0vipg3y0kbbzjhxky6hfyxy42mpqhvwn1r010zr5givcfp8ghq26";
}; };
nativeBuildInputs = [ cmake pkg-config ]; nativeBuildInputs = [ cmake pkg-config ]
buildInputs = with lib; [ libconfuse ] ++ optionals docSupport [ doxygen graphviz ]
++ optionals cppSupport [ boost ] ++ optionals pythonSupport [ swig ];
++ optionals pythonSupport [ python3 swig ]
++ optionals docSupport [ doxygen ];
preBuild = lib.optionalString docSupport '' buildInputs = [ libconfuse ]
make doc_i ++ 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 ]; propagatedBuildInputs = [ libusb1 ];
postInstall = '' postInstall = ''
mkdir -p "$out/etc/udev/rules.d/" mkdir -p "$out/etc/udev/rules.d/"
cp ../packages/99-libftdi.rules "$out/etc/udev/rules.d/" cp ../packages/99-libftdi.rules "$out/etc/udev/rules.d/"
'' + optionalString docSupport ''
cp -r doc/man "$out/share/" cp -r doc/man "$out/share/"
'' + lib.optionalString docSupport '' cp -r doc/html "$out/share/doc/libftdi1/"
mkdir -p "$out/share/libftdi/doc/" '';
cp -r doc/html "$out/share/libftdi/doc/"
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; { meta = with lib; {
description = "A library to talk to FTDI chips using libusb"; description = "A library to talk to FTDI chips using libusb";
homepage = "https://www.intra2net.com/en/developer/libftdi/"; homepage = "https://www.intra2net.com/en/developer/libftdi/";
license = with licenses; [ lgpl2 gpl2 ]; license = with licenses; [ lgpl2Only gpl2Only ];
platforms = with platforms; linux ++ darwin; platforms = platforms.all;
maintainers = [ maintainers.bjornfor ]; maintainers = with maintainers; [ bjornfor ];
}; };
} }

View File

@ -1,4 +1,4 @@
{ stdenv, lib, fetchFromGitHub { stdenv, lib, fetchFromGitHub, fetchpatch
, gcc-arm-embedded, libftdi1, libusb-compat-0_1, pkg-config , gcc-arm-embedded, libftdi1, libusb-compat-0_1, pkg-config
, python3 , python3
}: }:
@ -19,6 +19,14 @@ stdenv.mkDerivation rec {
fetchSubmodules = true; fetchSubmodules = true;
}; };
patches = [
# Fix deprecation warning with libftdi 1.5
(fetchpatch {
url = "https://github.com/blacksphere/blackmagic/commit/dea4be2539c5ea63836ec78dca08b52fa8b26ab5.patch";
sha256 = "0f81simij1wdhifsxaavalc6yxzagfbgwry969dbjmxqzvrsrds5";
})
];
nativeBuildInputs = [ nativeBuildInputs = [
gcc-arm-embedded pkg-config gcc-arm-embedded pkg-config
python3 python3