From 9b1a70f1ac59a0dea562ebf39907042c53e488ae Mon Sep 17 00:00:00 2001 From: George Whewell Date: Sat, 1 Apr 2017 22:11:11 +0100 Subject: [PATCH] mtools: fix build on darwin --- pkgs/tools/filesystems/mtools/UNUSED-darwin.patch | 11 +++++++++++ pkgs/tools/filesystems/mtools/default.nix | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 pkgs/tools/filesystems/mtools/UNUSED-darwin.patch diff --git a/pkgs/tools/filesystems/mtools/UNUSED-darwin.patch b/pkgs/tools/filesystems/mtools/UNUSED-darwin.patch new file mode 100644 index 000000000000..46b790afd30a --- /dev/null +++ b/pkgs/tools/filesystems/mtools/UNUSED-darwin.patch @@ -0,0 +1,11 @@ +--- mtools/sysincludes.h.orig 2017-04-01 20:59:46.083196540 +0100 ++++ mtools/sysincludes.h 2017-04-01 20:59:12.855030456 +0100 +@@ -103,7 +103,7 @@ + # define PACKED __attribute__ ((packed)) + # if __GNUC__ == 2 && __GNUC_MINOR__ > 6 || __GNUC__ >= 3 + /* gcc 2.6.3 doesn't have "unused" */ /* mool */ +-# define UNUSED(x) x __attribute__ ((unused));x ++# define UNUSED(x) x + # define UNUSEDP __attribute__ ((unused)) + # else + # define UNUSED(x) x diff --git a/pkgs/tools/filesystems/mtools/default.nix b/pkgs/tools/filesystems/mtools/default.nix index 6b9631bfccfe..ff311b9fae2f 100644 --- a/pkgs/tools/filesystems/mtools/default.nix +++ b/pkgs/tools/filesystems/mtools/default.nix @@ -8,12 +8,19 @@ stdenv.mkDerivation rec { sha256 = "119gdfnsxc6hzicnsf718k0fxgy2q14pxn7557rc96aki20czsar"; }; + # Prevents errors such as "mainloop.c:89:15: error: expected ')'" + # Upstream issue https://lists.gnu.org/archive/html/info-mtools/2014-02/msg00000.html + patches = stdenv.lib.optional stdenv.isDarwin ./UNUSED-darwin.patch; + + # fails to find X on darwin + configureFlags = stdenv.lib.optional stdenv.isDarwin "--without-x"; + doCheck = true; meta = { homepage = http://www.gnu.org/software/mtools/; description = "Utilities to access MS-DOS disks"; - platforms = stdenv.lib.platforms.gnu; # arbitrary choice + platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.darwin; maintainers = [ ]; }; }