feat(platform): build on native Windows hosts
VoidBuildSystem CI / 1 · Requirements (push) Successful in 6s
VoidBuildSystem CI / 2C · Windows native build (debug) (push) Failing after 1m32s
VoidBuildSystem CI / 2C · Windows native build (sanitizers) (push) Failing after 18s
VoidBuildSystem CI / 2C · Windows native build (relwithdebinfo) (push) Failing after 3m4s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 6m20s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 6m32s
VoidBuildSystem CI / 3C · Windows native test (debug) (push) Failing after 1m45s
VoidBuildSystem CI / 2B · Windows Wine build (sanitizers) (push) Successful in 6m55s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 6m59s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 6m59s
VoidBuildSystem CI / 3C · Windows native test (sanitizers) (push) Failing after 15s
VoidBuildSystem CI / 3C · Windows native test (relwithdebinfo) (push) Failing after 1m47s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 2m4s
VoidBuildSystem CI / 4B · Windows package (debug) (push) Successful in 1m6s
VoidBuildSystem CI / 4B · Windows package (sanitizers) (push) Successful in 12s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 4m2s
VoidBuildSystem CI / 4B · Windows package (relwithdebinfo) (push) Successful in 1m44s
VoidBuildSystem CI / 3B · Windows Wine test (sanitizers) (push) Successful in 3m16s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 3m21s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 6m45s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 6m54s
VoidBuildSystem CI / 4A · Linux package (debug) (push) Skipped
VoidBuildSystem CI / 4A · Linux package (relwithdebinfo) (push) Skipped
VoidBuildSystem CI / 4A · Linux package (sanitizers) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 3m42s

Bump VoidLibrary to 482a3ea (Windows target support: qualified
Configuration/Crypto/System/Archive, Windows DirectoryWatcher,
TempDir/TempFile, process pipes) and port VBS's own host backends:

- Toolchain: Windows/macOS host names and architectures without uname.
- Platform FileOps: Win32 stat metadata, CreateFileW+LockFileEx file
  locks (Void FileLock is POSIX-only, Void/Library#66), no-op
  directory fsync, GetModuleFileNameW executable path, mtime via
  std::filesystem, and a file-copy fallback for the compdb alias.
- ProcessSupervisor: Windows PATH/PATHEXT resolution and no POSIX
  waitpid reaping (job objects own descendants).
- Snapshot: directory listing through std::filesystem on Windows.
- Remote cache/registry client/CDash: curl or Winsock-based HTTP on
  Windows (Void::Net is not qualified there yet).
- Daemon: explicit unsupported errors on Windows (named-pipe
  transport is Track C3); the registry service stays POSIX-only and
  is excluded from the Windows build.
- StateStore/Sbom/Main/Graph: portable stat, time and path handling.

Verified: MinGW-w64 GCC 16.2 builds vbs, vbs_describe, vbs_benchmarks
and the sdk/core/v1/selfhost test executables; vbs runs under Wine
and the SDK suite passes 17/17. The Linux suite stays green (8/8).
This commit is contained in:
faumaray committed 2026-12-06 02:01:24 +03:00
1 parent 8768720e54
commit e333bbe84b
23 files changed
+715 -127

No files matched your search

+61 -8
View File
@@ -18,16 +18,22 @@
#endif
#include <algorithm>
#include <arpa/inet.h>
#include <array>
#include <cerrno>
#include <cstring>
#include <format>
#include <map>
#include <mutex>
#if defined(_WIN32)
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>
#endif
namespace Void::Build::Package {
namespace {
@@ -93,12 +99,49 @@ struct RawHttpReply {
std::string body;
};
bool send_all(int fd, std::string_view data) {
#if defined(_WIN32)
using SocketHandle = SOCKET;
inline constexpr SocketHandle kInvalidSocket = INVALID_SOCKET;
void ensure_socket_runtime() {
static std::once_flag once;
std::call_once(once, [] {
WSADATA data{};
(void)::WSAStartup(MAKEWORD(2, 2), &data);
});
}
struct SocketGuard {
SocketHandle handle{kInvalidSocket};
~SocketGuard() {
if (handle != kInvalidSocket) {
::closesocket(handle);
}
}
};
bool interrupted() { return ::WSAGetLastError() == WSAEINTR; }
#else
using SocketHandle = int;
inline constexpr SocketHandle kInvalidSocket = -1;
void ensure_socket_runtime() {}
using SocketGuard = Void::System::OwnedFd;
bool interrupted() { return errno == EINTR; }
#endif
bool send_all(SocketHandle fd, std::string_view data) {
std::size_t off = 0;
while (off < data.size()) {
#if defined(_WIN32)
const int n = ::send(fd, data.data() + off, static_cast<int>(data.size() - off), 0);
#else
const ssize_t n = ::send(fd, data.data() + off, data.size() - off, MSG_NOSIGNAL);
#endif
if (n < 0) {
if (errno == EINTR) {
if (interrupted()) {
continue;
}
return false;
@@ -154,6 +197,7 @@ send_http_request(const ParsedHttpUrl &parsed, std::string_view method, std::str
#else
// Plain TCP HTTP/1.1 client for http:// (loopback/local registry without external deps).
if (parsed.scheme == "http") {
ensure_socket_runtime();
struct addrinfo hints{};
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
@@ -166,18 +210,27 @@ send_http_request(const ParsedHttpUrl &parsed, std::string_view method, std::str
}
auto free_ai = Void::Scope::on_exit([&] { ::freeaddrinfo(res); });
const int fd = ::socket(res->ai_family, res->ai_socktype | SOCK_CLOEXEC, res->ai_protocol);
if (fd < 0) {
const SocketHandle fd =
::socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (fd == kInvalidSocket) {
return std::unexpected{make_error(Void::System::SystemErrorCode::io_error,
"registry client: socket() failed")};
}
Void::System::OwnedFd guard{fd};
SocketGuard guard{fd};
#if defined(_WIN32)
DWORD timeout_ms = 30000;
(void)::setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO,
reinterpret_cast<const char *>(&timeout_ms), sizeof(timeout_ms));
(void)::setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO,
reinterpret_cast<const char *>(&timeout_ms), sizeof(timeout_ms));
#else
struct timeval tv{30, 0};
(void)::setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
(void)::setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
#endif
if (::connect(fd, res->ai_addr, res->ai_addrlen) != 0) {
if (::connect(fd, res->ai_addr, static_cast<int>(res->ai_addrlen)) != 0) {
return std::unexpected{make_error(
Void::System::SystemErrorCode::io_error,
std::format("registry client: connect to {}:{} failed", parsed.host, parsed.port))};
@@ -204,7 +257,7 @@ send_http_request(const ParsedHttpUrl &parsed, std::string_view method, std::str
raw.append(buf.data(), static_cast<std::size_t>(n));
} else if (n == 0) {
break;
} else if (errno != EINTR) {
} else if (!interrupted()) {
return std::unexpected{make_error(Void::System::SystemErrorCode::io_error,
"registry client: recv() failed")};
}