From bb0b0822ef39d987952a04ae61fb8071eca45454 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 8 Nov 2017 16:05:19 +0100 Subject: [PATCH] neko: Fix build against glibc 2.26 The header file xlocale.h has been removed in glibc 2.26. Quoting the release notes[1]: * The nonstandard header has been removed. Most programs should use instead. If you have a specific need for the definition of locale_t with no other declarations, please contact libc-alpha@sourceware.org and explain. I've backported HaxeFoundation/neko@e286c8f3301fa443255a3101d14b73924670 against version 2.1.0 and the build now succeeds. Signed-off-by: aszlig --- pkgs/development/compilers/neko/default.nix | 3 + .../compilers/neko/xlocale-fix.patch | 59 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 pkgs/development/compilers/neko/xlocale-fix.patch diff --git a/pkgs/development/compilers/neko/default.nix b/pkgs/development/compilers/neko/default.nix index e90f3af704df..5b90dc7debc1 100644 --- a/pkgs/development/compilers/neko/default.nix +++ b/pkgs/development/compilers/neko/default.nix @@ -30,6 +30,9 @@ stdenv.mkDerivation rec { + "c6d9c6d796200990b3b6a53a4dc716c9192398e6.patch"; sha256 = "1pq0qhhb9gbhc3zbgylwp0amhwsz0q0ggpj6v2xgv0hfy7d63rcd"; }) + # Glibc 2.26 no longer has xlocale.h, patch backported from upstream commit + # e286c8f3301fa443255a3101d14b7392467051b8. + ./xlocale-fix.patch ]; buildInputs = diff --git a/pkgs/development/compilers/neko/xlocale-fix.patch b/pkgs/development/compilers/neko/xlocale-fix.patch new file mode 100644 index 000000000000..f4c53f3a43d6 --- /dev/null +++ b/pkgs/development/compilers/neko/xlocale-fix.patch @@ -0,0 +1,59 @@ +commit 31d3ac3d691b2a1b07991e67302fd52b0f409cac +Author: Andy Li +Date: Thu Jul 13 13:23:33 2017 +0800 + + include xlocale.h only if it is available since it is removed in recent glibc + + see: https://bugzilla.redhat.com/show_bug.cgi?id=1464244 + + (Backported from e286c8f3301fa443255a3101d14b7392467051b8) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8de1702..d64cab9 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,6 @@ + cmake_minimum_required(VERSION 2.8.7) + ++include(CheckIncludeFile) + project(neko C) + + set(CMAKE_OSX_ARCHITECTURES x86_64) +@@ -48,6 +49,8 @@ set(NEKO_VERSION_MAJOR 2) + set(NEKO_VERSION_MINOR 1) + set(NEKO_VERSION_PATCH 0) + ++check_include_file(xlocale.h HAVE_XLOCALE_H) ++ + configure_file ( + "${CMAKE_SOURCE_DIR}/vm/neko.h.in" + "${CMAKE_BINARY_DIR}/neko.h" +diff --git a/libs/std/sys.c b/libs/std/sys.c +index 8003d41..ae0cfee 100644 +--- a/libs/std/sys.c ++++ b/libs/std/sys.c +@@ -41,7 +41,11 @@ + # include + # include + # include ++#ifdef HAVE_XLOCALE_H + # include ++#else ++# include ++#endif + #endif + + #ifdef NEKO_MAC +diff --git a/vm/neko.h.in b/vm/neko.h.in +index bb9ec1b..147ecce 100644 +--- a/vm/neko.h.in ++++ b/vm/neko.h.in +@@ -88,6 +88,8 @@ + # include + #endif + ++#cmakedefine HAVE_XLOCALE_H ++ + #define NEKO_VERSION_MAJOR @NEKO_VERSION_MAJOR@ + #define NEKO_VERSION_MINOR @NEKO_VERSION_MINOR@ + #define NEKO_VERSION_PATCH @NEKO_VERSION_PATCH@