at 24.05-pre 133 lines 4.8 kB view raw
1{ stdenv 2, lib 3, fetchFromGitHub 4, fetchpatch 5, autoconf 6, automake 7, libtool 8, pkg-config 9, ApplicationServices 10, CoreServices 11, pkgsStatic 12 13# for passthru.tests 14, bind 15, cmake 16, knot-resolver 17, lispPackages 18, luajitPackages 19, mosquitto 20, neovim 21, nodejs 22, ocamlPackages 23, python3 24}: 25 26stdenv.mkDerivation (finalAttrs: { 27 version = "1.46.0"; 28 pname = "libuv"; 29 30 src = fetchFromGitHub { 31 owner = "libuv"; 32 repo = "libuv"; 33 rev = "v${finalAttrs.version}"; 34 sha256 = "sha256-Lrsyh4qd3OkTw1cSPfahzfSGNt6+pRN1X21iiv1SsFo="; 35 }; 36 37 patches = [ 38 # Disable io_uring close on selected kernels. Remove on next release 39 # https://github.com/libuv/libuv/pull/4141 40 (fetchpatch { 41 url = "https://github.com/libuv/libuv/commit/c811169f91b2101f7302e96de3d2dc366ade3a25.patch"; 42 hash = "sha256-7vk6XGXwJcwYUQPqIJ3JPd/fPIGrjE5WRDSJCMQfKeU="; 43 }) 44 ]; 45 46 outputs = [ "out" "dev" ]; 47 48 postPatch = let 49 toDisable = [ 50 "getnameinfo_basic" "udp_send_hang_loop" # probably network-dependent 51 "tcp_connect_timeout" # tries to reach out to 8.8.8.8 52 "spawn_setuid_fails" "spawn_setgid_fails" "fs_chown" # user namespaces 53 "getaddrinfo_fail" "getaddrinfo_fail_sync" 54 "threadpool_multiple_event_loops" # times out on slow machines 55 "get_passwd" # passed on NixOS but failed on other Linuxes 56 "tcp_writealot" "udp_multicast_join" "udp_multicast_join6" "metrics_pool_events" # times out sometimes 57 "fs_fstat" # https://github.com/libuv/libuv/issues/2235#issuecomment-1012086927 58 59 # Assertion failed in test/test-tcp-bind6-error.c on line 60: r == UV_EADDRINUSE 60 # Assertion failed in test/test-tcp-bind-error.c on line 99: r == UV_EADDRINUSE 61 "tcp_bind6_error_addrinuse" "tcp_bind_error_addrinuse_listen" 62 ] ++ lib.optionals stdenv.isDarwin [ 63 # Sometimes: timeout (no output), failed uv_listen. Someone 64 # should report these failures to libuv team. There tests should 65 # be much more robust. 66 "process_title" "emfile" "poll_duplex" "poll_unidirectional" 67 "ipc_listen_before_write" "ipc_listen_after_write" "ipc_tcp_connection" 68 "tcp_alloc_cb_fail" "tcp_ping_pong" "tcp_ref3" "tcp_ref4" 69 "tcp_bind6_error_inval" "tcp_bind6_error_addrinuse" "tcp_read_stop" 70 "tcp_unexpected_read" "tcp_write_to_half_open_connection" 71 "tcp_oob" "tcp_close_accept" "tcp_create_early_accept" 72 "tcp_create_early" "tcp_close" "tcp_bind_error_inval" 73 "tcp_bind_error_addrinuse" "tcp_shutdown_after_write" 74 "tcp_open" "tcp_write_queue_order" "tcp_try_write" "tcp_writealot" 75 "multiple_listen" "delayed_accept" "udp_recv_in_a_row" 76 "shutdown_close_tcp" "shutdown_eof" "shutdown_twice" "callback_stack" 77 "tty_pty" "condvar_5" "hrtime" "udp_multicast_join" 78 # Tests that fail when sandboxing is enabled. 79 "fs_event_close_in_callback" "fs_event_watch_dir" "fs_event_error_reporting" 80 "fs_event_watch_dir_recursive" "fs_event_watch_file" 81 "fs_event_watch_file_current_dir" "fs_event_watch_file_exact_path" 82 "process_priority" "udp_create_early_bad_bind" 83 ] ++ lib.optionals stdenv.isAarch32 [ 84 # I observe this test failing with some regularity on ARMv7: 85 # https://github.com/libuv/libuv/issues/1871 86 "shutdown_close_pipe" 87 ]; 88 tdRegexp = lib.concatStringsSep "\\|" toDisable; 89 in lib.optionalString (finalAttrs.doCheck) '' 90 sed '/${tdRegexp}/d' -i test/test-list.h 91 ''; 92 93 nativeBuildInputs = [ automake autoconf libtool pkg-config ]; 94 buildInputs = lib.optionals stdenv.isDarwin [ ApplicationServices CoreServices ]; 95 96 preConfigure = '' 97 LIBTOOLIZE=libtoolize ./autogen.sh 98 ''; 99 100 enableParallelBuilding = true; 101 102 # separateDebugInfo breaks static build 103 # https://github.com/NixOS/nixpkgs/issues/219466 104 separateDebugInfo = !stdenv.hostPlatform.isStatic; 105 106 doCheck = 107 # routinely hangs on powerpc64le 108 !stdenv.hostPlatform.isPower64; 109 110 # Some of the tests use localhost networking. 111 __darwinAllowLocalNetworking = true; 112 113 passthru.tests = { 114 inherit bind cmake knot-resolver mosquitto neovim nodejs; 115 inherit (lispPackages) cl-libuv; 116 luajit-libluv = luajitPackages.libluv; 117 luajit-luv = luajitPackages.luv; 118 ocaml-luv = ocamlPackages.luv; 119 python-pyuv = python3.pkgs.pyuv; 120 python-uvloop = python3.pkgs.uvloop; 121 static = pkgsStatic.libuv; 122 }; 123 124 meta = with lib; { 125 description = "A multi-platform support library with a focus on asynchronous I/O"; 126 homepage = "https://libuv.org/"; 127 changelog = "https://github.com/libuv/libuv/blob/v${finalAttrs.version}/ChangeLog"; 128 maintainers = with maintainers; [ marsam ]; 129 platforms = platforms.all; 130 license = with licenses; [ mit isc bsd2 bsd3 cc-by-40 ]; 131 }; 132 133})