1{ lib, stdenv, fetchzip, pkg-config, libusb1, systemdMinimal }:
2let
3 binDirPrefix = if stdenv.isDarwin then "osx_" else "linux_";
4in
5stdenv.mkDerivation rec {
6 pname = "libusbsio";
7 version = "2.1.11";
8
9 src = fetchzip {
10 url = "https://www.nxp.com/downloads/en/libraries/libusbsio-${version}-src.zip";
11 sha256 = "sha256-qgoeaGWTWdTk5XpJwoauckEQlqB9lp5x2+TN09vQttI=";
12 };
13
14 postPatch = ''
15 rm -r bin/*
16 '';
17
18 nativeBuildInputs = [ pkg-config ];
19 buildInputs = [
20 libusb1
21 systemdMinimal # libudev
22 ];
23
24 installPhase = ''
25 runHook preInstall
26 install -D bin/${binDirPrefix}${stdenv.hostPlatform.parsed.cpu.name}/libusbsio${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libusbsio${stdenv.hostPlatform.extensions.sharedLibrary}
27 runHook postInstall
28 '';
29
30 meta = with lib; {
31 homepage = "https://www.nxp.com/design/software/development-software/library-for-windows-macos-and-ubuntu-linux:LIBUSBSIO";
32 description = "Library for communicating with devices connected via the USB bridge on LPC-Link2 and MCU-Link debug probes on supported NXP microcontroller evaluation boards";
33 platforms = platforms.all;
34 license = licenses.bsd3;
35 maintainers = with maintainers; [ frogamic sbruder ];
36 };
37}