$NetBSD$ * Part of patchset to build electron on NetBSD * Based on OpenBSD's chromium patches, and FreeBSD's electron patches --- third_party/electron_node/deps/uv/BUILD.gn.orig 2025-04-18 18:41:29.000000000 +0000 +++ third_party/electron_node/deps/uv/BUILD.gn @@ -1,14 +1,214 @@ -############################################################################## -# # -# DO NOT EDIT THIS FILE! # -# # -############################################################################## - -# This file is used by GN for building, which is NOT the build system used for -# building official binaries. -# Please modify the gyp files if you are making changes to build system. +config("libuv_config") { + include_dirs = [ "include" ] -import("unofficial.gni") + defines = [] -uv_gn_build("uv") { + if (is_linux && !is_bsd) { + defines += [ "_POSIX_C_SOURCE=200112" ] + } + if (!is_win) { + defines += [ + "_LARGEFILE_SOURCE", + "_FILE_OFFSET_BITS=64", + ] + } + if (is_mac) { + defines += [ "_DARWIN_USE_64_BIT_INODE=1" ] + } +} + +static_library("uv") { + include_dirs = [ + "include", + "src", + ] + + public_configs = [ ":libuv_config" ] + + ldflags = [] + + defines = [] + + # This only has an effect on Windows, where it will cause libuv's symbols to be exported in node.lib + defines += [ "BUILDING_UV_SHARED=1" ] + + cflags_c = [ + "-Wno-incompatible-pointer-types", + "-Wno-bitwise-op-parentheses", + "-Wno-implicit-fallthrough", + "-Wno-implicit-function-declaration", + "-Wno-missing-braces", + "-Wno-sign-compare", + "-Wno-sometimes-uninitialized", + "-Wno-string-conversion", + "-Wno-switch", + "-Wno-unused-function", + "-Wno-unused-result", + "-Wno-unused-variable", + "-Wno-unreachable-code", + "-Wno-unreachable-code-return", + "-Wno-unused-but-set-variable", + "-Wno-shadow", + ] + + libs = [] + + sources = [ + "include/uv.h", + "include/uv/tree.h", + "include/uv/errno.h", + "include/uv/threadpool.h", + "include/uv/version.h", + "src/fs-poll.c", + "src/heap-inl.h", + "src/idna.c", + "src/idna.h", + "src/inet.c", + "src/queue.h", + "src/random.c", + "src/strscpy.c", + "src/strscpy.h", + "src/strtok.c", + "src/strtok.h", + "src/thread-common.c", + "src/threadpool.c", + "src/timer.c", + "src/uv-data-getter-setters.c", + "src/uv-common.c", + "src/uv-common.h", + "src/version.c", + ] + + if (is_win) { + defines += [ "_GNU_SOURCE" ] + sources += [ + "include/uv/win.h", + "src/win/async.c", + "src/win/atomicops-inl.h", + "src/win/core.c", + "src/win/detect-wakeup.c", + "src/win/dl.c", + "src/win/error.c", + "src/win/fs.c", + "src/win/fs-event.c", + "src/win/getaddrinfo.c", + "src/win/getnameinfo.c", + "src/win/handle.c", + "src/win/handle-inl.h", + "src/win/internal.h", + "src/win/loop-watcher.c", + "src/win/pipe.c", + "src/win/thread.c", + "src/win/poll.c", + "src/win/process.c", + "src/win/process-stdio.c", + "src/win/req-inl.h", + "src/win/signal.c", + "src/win/snprintf.c", + "src/win/stream.c", + "src/win/stream-inl.h", + "src/win/tcp.c", + "src/win/tty.c", + "src/win/udp.c", + "src/win/util.c", + "src/win/winapi.c", + "src/win/winapi.h", + "src/win/winsock.c", + "src/win/winsock.h", + ] + + libs += [ + "advapi32.lib", + "iphlpapi.lib", + "psapi.lib", + "shell32.lib", + "user32.lib", + "userenv.lib", + "ws2_32.lib", + ] + } else { + sources += [ + "include/uv/unix.h", + "include/uv/linux.h", + "include/uv/sunos.h", + "include/uv/darwin.h", + "include/uv/bsd.h", + "include/uv/aix.h", + "src/unix/async.c", + "src/unix/core.c", + "src/unix/dl.c", + "src/unix/fs.c", + "src/unix/getaddrinfo.c", + "src/unix/getnameinfo.c", + "src/unix/internal.h", + "src/unix/loop.c", + "src/unix/loop-watcher.c", + "src/unix/pipe.c", + "src/unix/poll.c", + "src/unix/process.c", + "src/unix/random-devurandom.c", + "src/unix/signal.c", + "src/unix/stream.c", + "src/unix/tcp.c", + "src/unix/thread.c", + "src/unix/tty.c", + "src/unix/udp.c", + ] + libs += [ "m" ] + ldflags += [ "-pthread" ] + } + if (is_mac || (is_linux && !is_bsd)) { + sources += [ "src/unix/proctitle.c" ] + } + if (is_mac) { + sources += [ + "src/unix/darwin-proctitle.c", + "src/unix/darwin.c", + "src/unix/fsevents.c", + "src/unix/random-getentropy.c", + ] + defines += [ + "_DARWIN_USE_64_BIT_INODE=1", + "_DARWIN_UNLIMITED_SELECT=1", + ] + } + if (is_linux && !is_bsd) { + defines += [ "_GNU_SOURCE" ] + sources += [ + "src/unix/linux.c", + "src/unix/procfs-exepath.c", + "src/unix/random-getrandom.c", + "src/unix/random-sysctl-linux.c", + ] + libs += [ + "dl", + "rt", + ] + } + if (is_mac) { # is_bsd + sources += [ + "src/unix/bsd-ifaddrs.c", + "src/unix/kqueue.c", + ] + } + if (is_bsd) { + sources += [ + "src/unix/bsd-ifaddrs.c", + "src/unix/bsd-proctitle.c", + "src/unix/kqueue.c", + "src/unix/posix-hrtime.c", + "src/unix/random-getrandom.c", + ] + } + if (is_freebsd) { + sources += [ + "src/unix/freebsd.c", + ] + } + if (is_netbsd) { + sources += [ + "src/unix/netbsd.c", + ] + libs += [ "kvm" ] + } }