git.iko.soy/typeable/nixpkgs
on master help sign in
libusb1: enable compiling with musl

libusb1 can't depend on systemd in order to be compiling with musl, because systemd can't be built with musl. Since systemd provides udev, udev support needs to be disabled when building libusb1.

commit370d483a0d347bcc2455c61a2ba425d01d5483b4 author(cdep)illabout <cdep.illabout@gmail.com> dateMon 21 Oct 2019, 13:45 (7 years ago) parentb72984e
1 file changed+18−3
pkgs/development/libraries/libusb1/default.nix+18−3
pkgs/development/libraries/libusb1/default.nix+18−3
@@ -1,4 +1,14 @@
1−{ stdenv, fetchurl, pkgconfig, systemd ? null, libobjc, IOKit, withStatic ? false }:
1+{ stdenv
2+, fetchurl
3+, pkgconfig
4+, enableSystemd ? stdenv.isLinux && !stdenv.hostPlatform.isMusl
5+, systemd ? null
6+, libobjc
7+, IOKit
8+, withStatic ? false
9+}:
10+
11+assert enableSystemd -> systemd != null;
212
313stdenv.mkDerivation (rec {
414 pname = "libusb";
@@ -13,12 +23,17 @@ stdenv.mkDerivation (rec {
1323
1424 nativeBuildInputs = [ pkgconfig ];
1525 propagatedBuildInputs =
16− stdenv.lib.optional stdenv.isLinux systemd ++
26+ stdenv.lib.optional enableSystemd systemd ++
1727 stdenv.lib.optionals stdenv.isDarwin [ libobjc IOKit ];
1828
1929 NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lgcc_s";
2030
21− preFixup = stdenv.lib.optionalString stdenv.isLinux ''
31+ configureFlags =
32+ # We use `isLinux` here only to avoid mass rebuilds for Darwin, where
33+ # disabling udev happens automatically. Remove `isLinux` at next big change!
34+ stdenv.lib.optional (stdenv.isLinux && !enableSystemd) "--disable-udev";
35+
36+ preFixup = stdenv.lib.optionalString enableSystemd ''
2237 sed 's,-ludev,-L${systemd.lib}/lib -ludev,' -i $out/lib/libusb-1.0.la
2338 '';
2439