From 1dca19f057dbb60bafb0f572e7c343c13666ba50 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 4 Jul 2018 15:02:07 -0400 Subject: libuv: remove frameworks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s not a good idea to rely on apple’s sdk for such a core library in Nixpkgs. I have made a patch to libuv to make these frameworks optional. There is also a pull request here: https://github.com/libuv/libuv/pull/1909 --- pkgs/development/libraries/libuv/default.nix | 6 +- .../libuv/make-apple-frameworks-optional.patch | 176 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 +- 3 files changed, 180 insertions(+), 6 deletions(-) create mode 100644 pkgs/development/libraries/libuv/make-apple-frameworks-optional.patch (limited to 'pkgs') diff --git a/pkgs/development/libraries/libuv/default.nix b/pkgs/development/libraries/libuv/default.nix index 4dc601745a42..f45001c21fe3 100644 --- a/pkgs/development/libraries/libuv/default.nix +++ b/pkgs/development/libraries/libuv/default.nix @@ -1,5 +1,4 @@ -{ stdenv, lib, fetchFromGitHub, autoconf, automake, libtool, pkgconfig -, ApplicationServices, CoreServices }: +{ stdenv, lib, fetchFromGitHub, autoconf, automake, libtool, pkgconfig }: stdenv.mkDerivation rec { version = "1.20.3"; @@ -12,6 +11,8 @@ stdenv.mkDerivation rec { sha256 = "1a8a679wni560z7x6w5i431vh2g0f34cznflcn52klx1vwcggrg7"; }; + patches = [ ./make-apple-frameworks-optional.patch ]; + postPatch = let toDisable = [ "getnameinfo_basic" "udp_send_hang_loop" # probably network-dependent @@ -27,7 +28,6 @@ stdenv.mkDerivation rec { ''; nativeBuildInputs = [ automake autoconf libtool pkgconfig ]; - buildInputs = stdenv.lib.optionals stdenv.isDarwin [ ApplicationServices CoreServices ]; preConfigure = '' LIBTOOLIZE=libtoolize ./autogen.sh diff --git a/pkgs/development/libraries/libuv/make-apple-frameworks-optional.patch b/pkgs/development/libraries/libuv/make-apple-frameworks-optional.patch new file mode 100644 index 000000000000..195fcbf03393 --- /dev/null +++ b/pkgs/development/libraries/libuv/make-apple-frameworks-optional.patch @@ -0,0 +1,176 @@ +From 6d03644817fb263489dc9fdf550bf1fac274fd8f Mon Sep 17 00:00:00 2001 +From: Matthew Bauer +Date: Wed, 4 Jul 2018 14:49:33 -0400 +Subject: [PATCH] Make apple frameworks optional +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Previously, you had to have the apple sdk frameworks downloaded to +build on “Darwin”. There are certain cases where this is not desired, +so an Autoconf conditional is added to check for their availability. +When they are not available, proctitle & fsevents are unavailable. + +These frameworks are proprietary- owned and developed by Apple Inc. +They have never been released publically so we should not make +everyone use it in a core library like libuv. +--- + configure.ac | 2 ++ + src/unix/darwin-proctitle.c | 8 +++----- + src/unix/fsevents.c | 6 +++--- + test/test-list.h | 12 ++++++++++++ + 4 files changed, 20 insertions(+), 8 deletions(-) + +diff --git a/configure.ac b/configure.ac +index c3a6a779..2df943c0 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -69,4 +69,6 @@ AS_CASE([$host_os],[mingw*], [ + AS_CASE([$host_os], [netbsd*], [AC_CHECK_LIB([kvm], [kvm_open])]) + AC_CHECK_HEADERS([sys/ahafs_evProds.h]) + AC_CONFIG_FILES([Makefile libuv.pc]) ++AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h) ++AC_CHECK_HEADERS(CoreServices/CoreServices.h) + AC_OUTPUT +diff --git a/src/unix/darwin-proctitle.c b/src/unix/darwin-proctitle.c +index dabde223..f5506a32 100644 +--- a/src/unix/darwin-proctitle.c ++++ b/src/unix/darwin-proctitle.c +@@ -26,9 +26,7 @@ + #include + #include + +-#include +- +-#if !TARGET_OS_IPHONE ++#if HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H + # include + # include + #endif +@@ -58,7 +56,7 @@ static int uv__pthread_setname_np(const char* name) { + + + 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 @@ out: + dlclose(application_services_handle); + + return err; +-#endif /* !TARGET_OS_IPHONE */ ++#endif /* !HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H */ + } +diff --git a/src/unix/fsevents.c b/src/unix/fsevents.c +index ee45299b..3135e738 100644 +--- a/src/unix/fsevents.c ++++ b/src/unix/fsevents.c +@@ -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 @@ int uv__fsevents_close(uv_fs_event_t* handle) { + void uv__fsevents_loop_delete(uv_loop_t* loop) { + } + +-#else /* TARGET_OS_IPHONE */ ++#else /* !HAVE_CORESERVICES_CORESERVICES_H */ + + #include + #include +@@ -916,4 +916,4 @@ int uv__fsevents_close(uv_fs_event_t* handle) { + return 0; + } + +-#endif /* TARGET_OS_IPHONE */ ++#endif /* !HAVE_CORESERVICES_CORESERVICES_H */ +diff --git a/test/test-list.h b/test/test-list.h +index e59c6b65..160f6b36 100644 +--- a/test/test-list.h ++++ b/test/test-list.h +@@ -229,7 +229,9 @@ TEST_DECLARE (get_passwd) + TEST_DECLARE (handle_fileno) + TEST_DECLARE (homedir) + TEST_DECLARE (tmpdir) ++#if !__APPLE__ + TEST_DECLARE (hrtime) ++#endif + TEST_DECLARE (getaddrinfo_fail) + TEST_DECLARE (getaddrinfo_fail_sync) + TEST_DECLARE (getaddrinfo_basic) +@@ -306,6 +308,7 @@ TEST_DECLARE (fs_futime) + TEST_DECLARE (fs_file_open_append) + TEST_DECLARE (fs_stat_missing_path) + TEST_DECLARE (fs_read_file_eof) ++#if !__APPLE__ || HAVE_CORESERVICES_CORESERVICES_H + TEST_DECLARE (fs_event_watch_dir) + TEST_DECLARE (fs_event_watch_dir_recursive) + #ifdef _WIN32 +@@ -327,6 +330,7 @@ TEST_DECLARE (fs_event_close_in_callback) + TEST_DECLARE (fs_event_start_and_close) + TEST_DECLARE (fs_event_error_reporting) + TEST_DECLARE (fs_event_getpath) ++#endif + TEST_DECLARE (fs_scandir_empty_dir) + TEST_DECLARE (fs_scandir_non_existent_dir) + TEST_DECLARE (fs_scandir_file) +@@ -426,9 +430,11 @@ TEST_DECLARE (fork_socketpair) + TEST_DECLARE (fork_socketpair_started) + TEST_DECLARE (fork_signal_to_child) + TEST_DECLARE (fork_signal_to_child_closed) ++#if !__APPLE__ || HAVE_CORESERVICES_CORESERVICES_H + TEST_DECLARE (fork_fs_events_child) + TEST_DECLARE (fork_fs_events_child_dir) + TEST_DECLARE (fork_fs_events_file_parent_child) ++#endif + #ifndef __MVS__ + TEST_DECLARE (fork_threadpool_queue_work_simple) + #endif +@@ -721,7 +727,9 @@ TASK_LIST_START + + TEST_ENTRY (tmpdir) + ++#if !__APPLE__ + TEST_ENTRY (hrtime) ++#endif + + TEST_ENTRY_CUSTOM (getaddrinfo_fail, 0, 0, 10000) + TEST_ENTRY_CUSTOM (getaddrinfo_fail_sync, 0, 0, 10000) +@@ -851,6 +859,7 @@ TASK_LIST_START + TEST_ENTRY (fs_stat_missing_path) + TEST_ENTRY (fs_read_file_eof) + TEST_ENTRY (fs_file_open_append) ++#if !__APPLE__ || HAVE_CORESERVICES_CORESERVICES_H + TEST_ENTRY (fs_event_watch_dir) + TEST_ENTRY (fs_event_watch_dir_recursive) + #ifdef _WIN32 +@@ -872,6 +881,7 @@ TASK_LIST_START + TEST_ENTRY (fs_event_start_and_close) + TEST_ENTRY (fs_event_error_reporting) + TEST_ENTRY (fs_event_getpath) ++#endif + TEST_ENTRY (fs_scandir_empty_dir) + TEST_ENTRY (fs_scandir_non_existent_dir) + TEST_ENTRY (fs_scandir_file) +@@ -921,9 +931,11 @@ TASK_LIST_START + TEST_ENTRY (fork_socketpair_started) + TEST_ENTRY (fork_signal_to_child) + TEST_ENTRY (fork_signal_to_child_closed) ++#if !__APPLE__ || HAVE_CORESERVICES_CORESERVICES_H + TEST_ENTRY (fork_fs_events_child) + TEST_ENTRY (fork_fs_events_child_dir) + TEST_ENTRY (fork_fs_events_file_parent_child) ++#endif + #ifndef __MVS__ + TEST_ENTRY (fork_threadpool_queue_work_simple) + #endif +-- +2.17.1 + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dfa2a3b66967..2148b2f22a25 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10683,9 +10683,7 @@ with pkgs; then darwin.libunwind else callPackage ../development/libraries/libunwind { }; - libuv = callPackage ../development/libraries/libuv { - inherit (darwin.apple_sdk.frameworks) ApplicationServices CoreServices; - }; + libuv = callPackage ../development/libraries/libuv { }; libv4l = lowPrio (v4l_utils.override { withUtils = false; -- cgit 1.4.1