diff options
author | (cdep)illabout <cdep.illabout@gmail.com> | 2019-10-21 13:45:34 -0400 |
---|---|---|
committer | Niklas Hambüchen <mail@nh2.me> | 2019-10-28 15:28:33 +0100 |
commit | 370d483a0d347bcc2455c61a2ba425d01d5483b4 (patch) | |
tree | 05eeb6127c9267a423021ded81f4b1e8ac875a6c /pkgs/development/libraries | |
parent | b72984e7a3a7eb44300897c7909e103a8fdb1670 (diff) |
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.
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r-- | pkgs/development/libraries/libusb1/default.nix | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/pkgs/development/libraries/libusb1/default.nix b/pkgs/development/libraries/libusb1/default.nix index 19a8025359a05..9a08a7756c84b 100644 --- a/pkgs/development/libraries/libusb1/default.nix +++ b/pkgs/development/libraries/libusb1/default.nix @@ -1,4 +1,14 @@ -{ stdenv, fetchurl, pkgconfig, systemd ? null, libobjc, IOKit, withStatic ? false }: +{ stdenv +, fetchurl +, pkgconfig +, enableSystemd ? stdenv.isLinux && !stdenv.hostPlatform.isMusl +, systemd ? null +, libobjc +, IOKit +, withStatic ? false +}: + +assert enableSystemd -> systemd != null; stdenv.mkDerivation (rec { pname = "libusb"; @@ -13,12 +23,17 @@ stdenv.mkDerivation (rec { nativeBuildInputs = [ pkgconfig ]; propagatedBuildInputs = - stdenv.lib.optional stdenv.isLinux systemd ++ + stdenv.lib.optional enableSystemd systemd ++ stdenv.lib.optionals stdenv.isDarwin [ libobjc IOKit ]; NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lgcc_s"; - preFixup = stdenv.lib.optionalString stdenv.isLinux '' + configureFlags = + # We use `isLinux` here only to avoid mass rebuilds for Darwin, where + # disabling udev happens automatically. Remove `isLinux` at next big change! + stdenv.lib.optional (stdenv.isLinux && !enableSystemd) "--disable-udev"; + + preFixup = stdenv.lib.optionalString enableSystemd '' sed 's,-ludev,-L${systemd.lib}/lib -ludev,' -i $out/lib/libusb-1.0.la ''; |