1{ stdenv, lib, fetchpatch, fetchFromGitHub, autoconf, automake, libtool, pkgconfig, ApplicationServices, CoreServices }:
2
3stdenv.mkDerivation rec {
4 version = "1.26.0";
5 pname = "libuv";
6
7 src = fetchFromGitHub {
8 owner = pname;
9 repo = pname;
10 rev = "v${version}";
11 sha256 = "08jvjyn5bp4xnzd5g4pi534mklm6hz5pw6wbzbaq3cnwb6a04iwj";
12 };
13
14 postPatch = let
15 toDisable = [
16 "getnameinfo_basic" "udp_send_hang_loop" # probably network-dependent
17 "spawn_setuid_fails" "spawn_setgid_fails" "fs_chown" # user namespaces
18 "getaddrinfo_fail" "getaddrinfo_fail_sync"
19 "threadpool_multiple_event_loops" # times out on slow machines
20 ]
21 # Sometimes: timeout (no output), failed uv_listen. Someone
22 # should report these failures to libuv team. There tests should
23 # be much more robust.
24 ++ stdenv.lib.optionals stdenv.isDarwin [
25 "process_title" "emfile" "poll_duplex" "poll_unidirectional"
26 "ipc_listen_before_write" "ipc_listen_after_write" "ipc_tcp_connection"
27 "tcp_alloc_cb_fail" "tcp_ping_pong" "tcp_ref3" "tcp_ref4"
28 "tcp_bind6_error_inval" "tcp_bind6_error_addrinuse" "tcp_read_stop"
29 "tcp_unexpected_read" "tcp_write_to_half_open_connection"
30 "tcp_oob" "tcp_close_accept" "tcp_create_early_accept"
31 "tcp_create_early" "tcp_close" "tcp_bind_error_inval"
32 "tcp_bind_error_addrinuse" "tcp_shutdown_after_write"
33 "tcp_open" "tcp_write_queue_order" "tcp_try_write" "tcp_writealot"
34 "multiple_listen" "delayed_accept"
35 "shutdown_close_tcp" "shutdown_eof" "shutdown_twice" "callback_stack"
36 "tty_pty" "condvar_5"
37 ] ++ stdenv.lib.optionals stdenv.isAarch32 [
38 # I observe this test failing with some regularity on ARMv7:
39 # https://github.com/libuv/libuv/issues/1871
40 "shutdown_close_pipe"
41 ];
42 tdRegexp = lib.concatStringsSep "\\|" toDisable;
43 in lib.optionalString doCheck ''
44 sed '/${tdRegexp}/d' -i test/test-list.h
45 '';
46
47 nativeBuildInputs = [ automake autoconf libtool pkgconfig ];
48 buildInputs = stdenv.lib.optionals stdenv.isDarwin [ ApplicationServices CoreServices ];
49
50 preConfigure = ''
51 LIBTOOLIZE=libtoolize ./autogen.sh
52 '';
53
54 enableParallelBuilding = true;
55
56 doCheck = true;
57
58 meta = with lib; {
59 description = "A multi-platform support library with a focus on asynchronous I/O";
60 homepage = https://github.com/libuv/libuv;
61 maintainers = with maintainers; [ cstrahan ];
62 platforms = with platforms; linux ++ darwin;
63 license = with licenses; [ mit isc bsd2 bsd3 cc-by-40 ];
64 };
65
66}