From 70e199136ec0ff742aa412a542cf3c6d0cf6cee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Kochen?= Date: Tue, 18 May 2021 14:08:03 +0200 Subject: [PATCH] spacenavd: fix darwin build --- pkgs/misc/drivers/spacenavd/default.nix | 17 ++++++++++++++--- pkgs/top-level/all-packages.nix | 4 +++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/pkgs/misc/drivers/spacenavd/default.nix b/pkgs/misc/drivers/spacenavd/default.nix index 734b2229c877..fe6d206c3e98 100644 --- a/pkgs/misc/drivers/spacenavd/default.nix +++ b/pkgs/misc/drivers/spacenavd/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchFromGitHub, libX11 }: +{ stdenv, lib, fetchFromGitHub, fetchpatch, libX11, IOKit }: stdenv.mkDerivation rec { version = "0.8"; @@ -11,9 +11,20 @@ stdenv.mkDerivation rec { sha256 = "1zz0cm5cgvp9s5n4nzksl8rb11c7sw214bdafzra74smvqfjcjcf"; }; - buildInputs = [ libX11 ]; + patches = [ + # Fixes Darwin: https://github.com/FreeSpacenav/spacenavd/pull/38 + (fetchpatch { + url = "https://github.com/FreeSpacenav/spacenavd/commit/d6a25d5c3f49b9676d039775efc8bf854737c43c.patch"; + sha256 = "02pdgcvaqc20qf9hi3r73nb9ds7yk2ps9nnxaj0x9p50xjnhfg5c"; + }) + ]; - configureFlags = [ "--disable-debug"]; + buildInputs = [ libX11 ] + ++ lib.optional stdenv.isDarwin IOKit; + + configureFlags = [ "--disable-debug" ]; + + makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ]; meta = with lib; { homepage = "http://spacenav.sourceforge.net/"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5c8c3c5d712f..4f56735161f4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -30792,7 +30792,9 @@ in hasktags = haskellPackages.hasktags; }; - spacenavd = callPackage ../misc/drivers/spacenavd { }; + spacenavd = callPackage ../misc/drivers/spacenavd { + inherit (darwin.apple_sdk.frameworks) IOKit; + }; spacenav-cube-example = callPackage ../applications/misc/spacenav-cube-example { };