about summary refs log tree commit diff
path: root/pkgs/development/libraries/libusbsio/default.nix
blob: 21c7e3f1396ec0f623c8746396a86290233790bb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{ lib
, stdenv
, fetchzip
, pkg-config
, fixDarwinDylibNames
, libusb1
, systemdMinimal
, darwin
}:

stdenv.mkDerivation rec {
  pname = "libusbsio";
  version = "2.1.11";

  src = fetchzip {
    url = "https://www.nxp.com/downloads/en/libraries/libusbsio-${version}-src.zip";
    sha256 = "sha256-qgoeaGWTWdTk5XpJwoauckEQlqB9lp5x2+TN09vQttI=";
  };

  postPatch = ''
    rm -r bin/*
  '';

  makeFlags = [
    "CC=${stdenv.cc.targetPrefix}cc"
    "BINDIR="
  ];

  nativeBuildInputs = [
    pkg-config
  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
    fixDarwinDylibNames
  ];

  buildInputs = [
    libusb1
  ] ++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
    AppKit
    CoreFoundation
    IOKit
  ]) ++ lib.optionals stdenv.hostPlatform.isLinux [
    systemdMinimal # libudev
  ];

  installPhase = ''
    runHook preInstall
    install -D bin/libusbsio${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libusbsio${stdenv.hostPlatform.extensions.sharedLibrary}
    runHook postInstall
  '';

  meta = with lib; {
    homepage = "https://www.nxp.com/design/software/development-software/library-for-windows-macos-and-ubuntu-linux:LIBUSBSIO";
    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";
    platforms = platforms.all;
    license = licenses.bsd3;
    maintainers = with maintainers; [ frogamic sbruder ];
  };
}