-- Teach the bundled libuv about MidnightBSD. USE_TENSORPIPE is on for every
-- non-Windows build, which builds libuv; CMAKE_SYSTEM_NAME is "MidnightBSD",
-- so upstream's BSD checks do not match and none of the kqueue, freebsd or
-- bsd-ifaddrs sources get compiled.
--- third_party/tensorpipe/third_party/libuv/CMakeLists.txt.orig	2026-07-08 17:44:27 UTC
+++ third_party/tensorpipe/third_party/libuv/CMakeLists.txt
@@ -283,19 +283,19 @@
   list(APPEND uv_sources src/unix/proctitle.c)
 endif()
 
-if(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD")
+if(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|MidnightBSD")
   list(APPEND uv_sources src/unix/freebsd.c)
 endif()
 
-if(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|NetBSD|OpenBSD")
+if(CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|MidnightBSD|NetBSD|OpenBSD")
   list(APPEND uv_sources src/unix/posix-hrtime.c src/unix/bsd-proctitle.c)
 endif()
 
-if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|NetBSD|OpenBSD")
+if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|MidnightBSD|NetBSD|OpenBSD")
   list(APPEND uv_sources src/unix/bsd-ifaddrs.c src/unix/kqueue.c)
 endif()
 
-if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD|MidnightBSD")
   list(APPEND uv_sources src/unix/random-getrandom.c)
 endif()
 
@@ -432,7 +432,7 @@
   list(APPEND uv_libraries socket)
 endif()
 
-if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD")
+if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|MidnightBSD|Linux|NetBSD|OpenBSD")
   list(APPEND uv_test_libraries util)
   list(APPEND uv_libraries m)
 endif()
