mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 14:11:36 +00:00
libuv: remove frameworks
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
This commit is contained in:
parent
d7591c44f0
commit
1dca19f057
|
@ -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
|
||||
|
|
|
@ -0,0 +1,176 @@
|
|||
From 6d03644817fb263489dc9fdf550bf1fac274fd8f Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Bauer <mjbauer95@gmail.com>
|
||||
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 <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
-#include <TargetConditionals.h>
|
||||
-
|
||||
-#if !TARGET_OS_IPHONE
|
||||
+#if HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H
|
||||
# include <CoreFoundation/CoreFoundation.h>
|
||||
# include <ApplicationServices/ApplicationServices.h>
|
||||
#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 <dlfcn.h>
|
||||
#include <assert.h>
|
||||
@@ -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
|
||||
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue