From 68ac282f8e8eff5f8e4bf51b09ebfbfbe5b76273 Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Mon, 13 Aug 2018 10:16:02 +0900 Subject: [PATCH] cmake: patch internal libuv to remove dependency on macOS Frameworks --- .../tools/build-managers/cmake/default.nix | 3 + .../cmake/libuv-application-services.patch | 83 +++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 pkgs/development/tools/build-managers/cmake/libuv-application-services.patch diff --git a/pkgs/development/tools/build-managers/cmake/default.nix b/pkgs/development/tools/build-managers/cmake/default.nix index 0070160bb58..ca81260ffdb 100644 --- a/pkgs/development/tools/build-managers/cmake/default.nix +++ b/pkgs/development/tools/build-managers/cmake/default.nix @@ -44,6 +44,9 @@ stdenv.mkDerivation rec { # Don't depend on frameworks. ./application-services.patch + + # Derived from https://github.com/libuv/libuv/commit/1a5d4f08238dd532c3718e210078de1186a5920d + ./libuv-application-services.patch ] ++ optional stdenv.isCygwin ./3.2.2-cygwin.patch; outputs = [ "out" ]; diff --git a/pkgs/development/tools/build-managers/cmake/libuv-application-services.patch b/pkgs/development/tools/build-managers/cmake/libuv-application-services.patch new file mode 100644 index 00000000000..08899f5c241 --- /dev/null +++ b/pkgs/development/tools/build-managers/cmake/libuv-application-services.patch @@ -0,0 +1,83 @@ +diff -ur cmake-3.12.1/Utilities/cmlibuv/CMakeLists.txt cmake-3.12.1-patched/Utilities/cmlibuv/CMakeLists.txt +--- cmake-3.12.1/Utilities/cmlibuv/CMakeLists.txt 2018-08-09 21:14:08.000000000 +0900 ++++ cmake-3.12.1-patched/Utilities/cmlibuv/CMakeLists.txt 2018-08-13 10:14:53.000000000 +0900 +@@ -173,6 +173,22 @@ + src/unix/kqueue.c + src/unix/proctitle.c + ) ++ ++ include(CheckIncludeFile) ++ ++ check_include_file("ApplicationServices/ApplicationServices.h" HAVE_ApplicationServices) ++ if (HAVE_ApplicationServices) ++ list(APPEND uv_defines ++ HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H=1 ++ ) ++ endif() ++ ++ check_include_file("CoreServices/CoreServices.h" HAVE_CoreServices) ++ if (HAVE_CoreServices) ++ list(APPEND uv_defines ++ HAVE_CORESERVICES_CORESERVICES_H=1 ++ ) ++ endif() + endif() + + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") +diff -ur cmake-3.12.1/Utilities/cmlibuv/src/unix/darwin-proctitle.c cmake-3.12.1-patched/Utilities/cmlibuv/src/unix/darwin-proctitle.c +--- cmake-3.12.1/Utilities/cmlibuv/src/unix/darwin-proctitle.c 2018-08-09 21:14:08.000000000 +0900 ++++ cmake-3.12.1-patched/Utilities/cmlibuv/src/unix/darwin-proctitle.c 2018-08-13 10:01:29.000000000 +0900 +@@ -26,9 +26,7 @@ + #include + #include + +-#include +- +-#if !TARGET_OS_IPHONE ++#if HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H + # include + # include + #endif +@@ -58,7 +56,7 @@ + + + int uv__set_process_title(const char* title) { +-#if TARGET_OS_IPHONE ++#if !HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H + return uv__pthread_setname_np(title); + #else + CFStringRef (*pCFStringCreateWithCString)(CFAllocatorRef, +@@ -205,5 +203,5 @@ + dlclose(application_services_handle); + + return err; +-#endif /* !TARGET_OS_IPHONE */ ++#endif /* HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H */ + } +diff -ur cmake-3.12.1/Utilities/cmlibuv/src/unix/fsevents.c cmake-3.12.1-patched/Utilities/cmlibuv/src/unix/fsevents.c +--- cmake-3.12.1/Utilities/cmlibuv/src/unix/fsevents.c 2018-08-09 21:14:08.000000000 +0900 ++++ cmake-3.12.1-patched/Utilities/cmlibuv/src/unix/fsevents.c 2018-08-13 10:01:29.000000000 +0900 +@@ -21,7 +21,7 @@ + #include "uv.h" + #include "internal.h" + +-#if TARGET_OS_IPHONE ++#if !HAVE_CORESERVICES_CORESERVICES_H + + /* iOS (currently) doesn't provide the FSEvents-API (nor CoreServices) */ + +@@ -38,7 +38,7 @@ + void uv__fsevents_loop_delete(uv_loop_t* loop) { + } + +-#else /* TARGET_OS_IPHONE */ ++#else /* !HAVE_CORESERVICES_CORESERVICES_H */ + + #include + #include +@@ -916,4 +916,4 @@ + return 0; + } + +-#endif /* TARGET_OS_IPHONE */ ++#endif /* !HAVE_CORESERVICES_CORESERVICES_H */