From f29fa2098cee9209abbb3b5cd21855aacf5bb383 Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Thu, 28 Jun 2018 17:25:18 +0900 Subject: [PATCH] bison2: Fix Darwin runtime crash --- pkgs/development/tools/parsing/bison/2.x.nix | 4 +++- .../tools/parsing/bison/darwin-vasnprintf.patch | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/tools/parsing/bison/darwin-vasnprintf.patch diff --git a/pkgs/development/tools/parsing/bison/2.x.nix b/pkgs/development/tools/parsing/bison/2.x.nix index d760cec62a04..cc4891cb06f5 100644 --- a/pkgs/development/tools/parsing/bison/2.x.nix +++ b/pkgs/development/tools/parsing/bison/2.x.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, m4, perl }: +{ stdenv, lib, fetchurl, m4, perl }: stdenv.mkDerivation rec { name = "bison-2.7"; @@ -11,6 +11,8 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ m4 ] ++ stdenv.lib.optional doCheck perl; propagatedBuildInputs = [ m4 ]; + patches = lib.optional stdenv.isDarwin ./darwin-vasnprintf.patch; + doCheck = true; # M4 = "${m4}/bin/m4"; diff --git a/pkgs/development/tools/parsing/bison/darwin-vasnprintf.patch b/pkgs/development/tools/parsing/bison/darwin-vasnprintf.patch new file mode 100644 index 000000000000..84b0e6d39d87 --- /dev/null +++ b/pkgs/development/tools/parsing/bison/darwin-vasnprintf.patch @@ -0,0 +1,12 @@ +diff -ur bison-2.7-pristine/lib/vasnprintf.c bison-2.7/lib/vasnprintf.c +--- bison-2.7-pristine/lib/vasnprintf.c 2012-11-30 20:48:23.000000000 +0900 ++++ bison-2.7/lib/vasnprintf.c 2018-06-28 16:55:31.000000000 +0900 +@@ -4870,7 +4870,7 @@ + #endif + *fbp = dp->conversion; + #if USE_SNPRINTF +-# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) ++# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) || (defined __APPLE__ && defined __MACH__)) + fbp[1] = '%'; + fbp[2] = 'n'; + fbp[3] = '\0';