libusb: build from source instead of release tarball

This commit is contained in:
Leon Schuermann
2020-03-08 20:15:03 +01:00
committed by Leon Schuermann
parent 54bab3faaf
commit aa63d51a34
2 changed files with 19 additions and 16 deletions
+12 -11
View File
@@ -1,5 +1,6 @@
{ stdenv
, fetchurl
, fetchFromGitHub
, autoreconfHook
, pkgconfig
, enableSystemd ? stdenv.isLinux && !stdenv.hostPlatform.isMusl
, systemd ? null
@@ -10,22 +11,26 @@
assert enableSystemd -> systemd != null;
stdenv.mkDerivation (rec {
stdenv.mkDerivation rec {
pname = "libusb";
version = "1.0.23";
src = fetchurl {
url = "https://github.com/${pname}/${pname}/releases/download/v${version}/${pname}-${version}.tar.bz2";
sha256 = "13dd2a9x290d1q8nb1lqiaf36grcvns5ripk5k2xm0lajmpc04fv";
src = fetchFromGitHub {
owner = "libusb";
repo = "libusb";
rev = "v${version}";
sha256 = "0mxbpg01kgbk5nh6524b0m4xk7ywkyzmc3yhi5asqcsd3rbhjj98";
};
outputs = [ "out" "dev" ]; # get rid of propagating systemd closure
nativeBuildInputs = [ pkgconfig ];
nativeBuildInputs = [ pkgconfig autoreconfHook ];
propagatedBuildInputs =
stdenv.lib.optional enableSystemd systemd ++
stdenv.lib.optionals stdenv.isDarwin [ libobjc IOKit ];
dontDisableStatic = withStatic;
NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lgcc_s";
preFixup = stdenv.lib.optionalString stdenv.isLinux ''
@@ -43,8 +48,4 @@ stdenv.mkDerivation (rec {
license = licenses.lgpl21Plus;
maintainers = [ ];
};
} // stdenv.lib.optionalAttrs withStatic {
# Carefully added here to avoid a mass rebuild.
# Inline this the next time this package changes.
dontDisableStatic = withStatic;
})
}