Merge pull request #207880 from realsnick/fix/libusb1

libusb1: add option to build with examples
This commit is contained in:
Anderson Torres 2022-12-28 22:00:29 -03:00 committed by GitHub
commit 7f0ed55fec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 3 deletions

View file

@ -11717,6 +11717,12 @@
githubId = 1973389;
name = "Reuben D'Netto";
};
realsnick = {
name = "Ido Samuelson";
email = "ido.samuelson@gmail.com";
github = "realsnick";
githubId = 1440852;
};
redbaron = {
email = "ivanov.maxim@gmail.com";
github = "redbaron";

View file

@ -1,4 +1,5 @@
{ lib, stdenv
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, autoreconfHook
@ -8,6 +9,7 @@
, libobjc
, IOKit
, Security
, withExamples ? false
, withStatic ? false
}:
@ -31,12 +33,20 @@ stdenv.mkDerivation rec {
dontDisableStatic = withStatic;
configureFlags = lib.optional (!enableUdev) "--disable-udev";
configureFlags =
lib.optional (!enableUdev) "--disable-udev"
++ lib.optional (withExamples) "--enable-examples-build";
preFixup = lib.optionalString enableUdev ''
sed 's,-ludev,-L${lib.getLib udev}/lib -ludev,' -i $out/lib/libusb-1.0.la
'';
postInstall = lib.optionalString withExamples ''
mkdir -p $out/{bin,sbin,examples/bin}
cp -r examples/.libs/* $out/examples/bin
ln -s $out/examples/bin/fxload $out/sbin/fxload
'';
meta = with lib; {
homepage = "https://libusb.info/";
description = "cross-platform user-mode USB device library";
@ -45,6 +55,6 @@ stdenv.mkDerivation rec {
'';
platforms = platforms.all;
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ prusnak ];
maintainers = with maintainers; [ prusnak realsnick ];
};
}