-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: cmake #49
Comments
I had to upgrade my system CMake binary to build LLVM 😅 let me see what CMake needs for a bulid. |
I've tried building CMake and got errors like: Errors
|
By applying the following patch, the errors above are gone. errno patchdiff --git a/Utilities/cmlibuv/include/uv.h b/Utilities/cmlibuv/include/uv.h
index 42e34467ef..16ff9bcc3c 100644
--- a/Utilities/cmlibuv/include/uv.h
+++ b/Utilities/cmlibuv/include/uv.h
@@ -188,7 +188,7 @@ extern "C" {
XX(RANDOM, random) \
typedef enum {
-#define XX(code, _) UV_ ## code = UV__ ## code,
+#define XX(code, not_used) UV_ ## code = UV__ ## code,
UV_ERRNO_MAP(XX)
#undef XX
UV_ERRNO_MAX = UV__EOF - 1
diff --git a/Utilities/cmlibuv/include/uv/errno.h b/Utilities/cmlibuv/include/uv/errno.h
index 71906b3f5e..87e18ab6aa 100644
--- a/Utilities/cmlibuv/include/uv/errno.h
+++ b/Utilities/cmlibuv/include/uv/errno.h
@@ -50,355 +50,355 @@
/* Only map to the system errno on non-Windows platforms. It's apparently
* a fairly common practice for Windows programmers to redefine errno codes.
*/
-#if defined(E2BIG) && !defined(_WIN32)
+#if defined(E2BIG) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__E2BIG UV__ERR(E2BIG)
#else
# define UV__E2BIG (-4093)
#endif
-#if defined(EACCES) && !defined(_WIN32)
+#if defined(EACCES) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EACCES UV__ERR(EACCES)
#else
# define UV__EACCES (-4092)
#endif
-#if defined(EADDRINUSE) && !defined(_WIN32)
+#if defined(EADDRINUSE) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EADDRINUSE UV__ERR(EADDRINUSE)
#else
# define UV__EADDRINUSE (-4091)
#endif
-#if defined(EADDRNOTAVAIL) && !defined(_WIN32)
+#if defined(EADDRNOTAVAIL) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EADDRNOTAVAIL UV__ERR(EADDRNOTAVAIL)
#else
# define UV__EADDRNOTAVAIL (-4090)
#endif
-#if defined(EAFNOSUPPORT) && !defined(_WIN32)
+#if defined(EAFNOSUPPORT) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EAFNOSUPPORT UV__ERR(EAFNOSUPPORT)
#else
# define UV__EAFNOSUPPORT (-4089)
#endif
-#if defined(EAGAIN) && !defined(_WIN32)
+#if defined(EAGAIN) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EAGAIN UV__ERR(EAGAIN)
#else
# define UV__EAGAIN (-4088)
#endif
-#if defined(EALREADY) && !defined(_WIN32)
+#if defined(EALREADY) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EALREADY UV__ERR(EALREADY)
#else
# define UV__EALREADY (-4084)
#endif
-#if defined(EBADF) && !defined(_WIN32)
+#if defined(EBADF) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EBADF UV__ERR(EBADF)
#else
# define UV__EBADF (-4083)
#endif
-#if defined(EBUSY) && !defined(_WIN32)
+#if defined(EBUSY) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EBUSY UV__ERR(EBUSY)
#else
# define UV__EBUSY (-4082)
#endif
-#if defined(ECANCELED) && !defined(_WIN32)
+#if defined(ECANCELED) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ECANCELED UV__ERR(ECANCELED)
#else
# define UV__ECANCELED (-4081)
#endif
-#if defined(ECHARSET) && !defined(_WIN32)
+#if defined(ECHARSET) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ECHARSET UV__ERR(ECHARSET)
#else
# define UV__ECHARSET (-4080)
#endif
-#if defined(ECONNABORTED) && !defined(_WIN32)
+#if defined(ECONNABORTED) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ECONNABORTED UV__ERR(ECONNABORTED)
#else
# define UV__ECONNABORTED (-4079)
#endif
-#if defined(ECONNREFUSED) && !defined(_WIN32)
+#if defined(ECONNREFUSED) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ECONNREFUSED UV__ERR(ECONNREFUSED)
#else
# define UV__ECONNREFUSED (-4078)
#endif
-#if defined(ECONNRESET) && !defined(_WIN32)
+#if defined(ECONNRESET) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ECONNRESET UV__ERR(ECONNRESET)
#else
# define UV__ECONNRESET (-4077)
#endif
-#if defined(EDESTADDRREQ) && !defined(_WIN32)
+#if defined(EDESTADDRREQ) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EDESTADDRREQ UV__ERR(EDESTADDRREQ)
#else
# define UV__EDESTADDRREQ (-4076)
#endif
-#if defined(EEXIST) && !defined(_WIN32)
+#if defined(EEXIST) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EEXIST UV__ERR(EEXIST)
#else
# define UV__EEXIST (-4075)
#endif
-#if defined(EFAULT) && !defined(_WIN32)
+#if defined(EFAULT) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EFAULT UV__ERR(EFAULT)
#else
# define UV__EFAULT (-4074)
#endif
-#if defined(EHOSTUNREACH) && !defined(_WIN32)
+#if defined(EHOSTUNREACH) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EHOSTUNREACH UV__ERR(EHOSTUNREACH)
#else
# define UV__EHOSTUNREACH (-4073)
#endif
-#if defined(EINTR) && !defined(_WIN32)
+#if defined(EINTR) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EINTR UV__ERR(EINTR)
#else
# define UV__EINTR (-4072)
#endif
-#if defined(EINVAL) && !defined(_WIN32)
+#if defined(EINVAL) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EINVAL UV__ERR(EINVAL)
#else
# define UV__EINVAL (-4071)
#endif
-#if defined(EIO) && !defined(_WIN32)
+#if defined(EIO) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EIO UV__ERR(EIO)
#else
# define UV__EIO (-4070)
#endif
-#if defined(EISCONN) && !defined(_WIN32)
+#if defined(EISCONN) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EISCONN UV__ERR(EISCONN)
#else
# define UV__EISCONN (-4069)
#endif
-#if defined(EISDIR) && !defined(_WIN32)
+#if defined(EISDIR) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EISDIR UV__ERR(EISDIR)
#else
# define UV__EISDIR (-4068)
#endif
-#if defined(ELOOP) && !defined(_WIN32)
+#if defined(ELOOP) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ELOOP UV__ERR(ELOOP)
#else
# define UV__ELOOP (-4067)
#endif
-#if defined(EMFILE) && !defined(_WIN32)
+#if defined(EMFILE) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EMFILE UV__ERR(EMFILE)
#else
# define UV__EMFILE (-4066)
#endif
-#if defined(EMSGSIZE) && !defined(_WIN32)
+#if defined(EMSGSIZE) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EMSGSIZE UV__ERR(EMSGSIZE)
#else
# define UV__EMSGSIZE (-4065)
#endif
-#if defined(ENAMETOOLONG) && !defined(_WIN32)
+#if defined(ENAMETOOLONG) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENAMETOOLONG UV__ERR(ENAMETOOLONG)
#else
# define UV__ENAMETOOLONG (-4064)
#endif
-#if defined(ENETDOWN) && !defined(_WIN32)
+#if defined(ENETDOWN) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENETDOWN UV__ERR(ENETDOWN)
#else
# define UV__ENETDOWN (-4063)
#endif
-#if defined(ENETUNREACH) && !defined(_WIN32)
+#if defined(ENETUNREACH) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENETUNREACH UV__ERR(ENETUNREACH)
#else
# define UV__ENETUNREACH (-4062)
#endif
-#if defined(ENFILE) && !defined(_WIN32)
+#if defined(ENFILE) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENFILE UV__ERR(ENFILE)
#else
# define UV__ENFILE (-4061)
#endif
-#if defined(ENOBUFS) && !defined(_WIN32)
+#if defined(ENOBUFS) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENOBUFS UV__ERR(ENOBUFS)
#else
# define UV__ENOBUFS (-4060)
#endif
-#if defined(ENODEV) && !defined(_WIN32)
+#if defined(ENODEV) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENODEV UV__ERR(ENODEV)
#else
# define UV__ENODEV (-4059)
#endif
-#if defined(ENOENT) && !defined(_WIN32)
+#if defined(ENOENT) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENOENT UV__ERR(ENOENT)
#else
# define UV__ENOENT (-4058)
#endif
-#if defined(ENOMEM) && !defined(_WIN32)
+#if defined(ENOMEM) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENOMEM UV__ERR(ENOMEM)
#else
# define UV__ENOMEM (-4057)
#endif
-#if defined(ENONET) && !defined(_WIN32)
+#if defined(ENONET) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENONET UV__ERR(ENONET)
#else
# define UV__ENONET (-4056)
#endif
-#if defined(ENOSPC) && !defined(_WIN32)
+#if defined(ENOSPC) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENOSPC UV__ERR(ENOSPC)
#else
# define UV__ENOSPC (-4055)
#endif
-#if defined(ENOSYS) && !defined(_WIN32)
+#if defined(ENOSYS) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENOSYS UV__ERR(ENOSYS)
#else
# define UV__ENOSYS (-4054)
#endif
-#if defined(ENOTCONN) && !defined(_WIN32)
+#if defined(ENOTCONN) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENOTCONN UV__ERR(ENOTCONN)
#else
# define UV__ENOTCONN (-4053)
#endif
-#if defined(ENOTDIR) && !defined(_WIN32)
+#if defined(ENOTDIR) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENOTDIR UV__ERR(ENOTDIR)
#else
# define UV__ENOTDIR (-4052)
#endif
-#if defined(ENOTEMPTY) && !defined(_WIN32)
+#if defined(ENOTEMPTY) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENOTEMPTY UV__ERR(ENOTEMPTY)
#else
# define UV__ENOTEMPTY (-4051)
#endif
-#if defined(ENOTSOCK) && !defined(_WIN32)
+#if defined(ENOTSOCK) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENOTSOCK UV__ERR(ENOTSOCK)
#else
# define UV__ENOTSOCK (-4050)
#endif
-#if defined(ENOTSUP) && !defined(_WIN32)
+#if defined(ENOTSUP) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENOTSUP UV__ERR(ENOTSUP)
#else
# define UV__ENOTSUP (-4049)
#endif
-#if defined(EPERM) && !defined(_WIN32)
+#if defined(EPERM) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EPERM UV__ERR(EPERM)
#else
# define UV__EPERM (-4048)
#endif
-#if defined(EPIPE) && !defined(_WIN32)
+#if defined(EPIPE) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EPIPE UV__ERR(EPIPE)
#else
# define UV__EPIPE (-4047)
#endif
-#if defined(EPROTO) && !defined(_WIN32)
+#if defined(EPROTO) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EPROTO UV__ERR(EPROTO)
#else
# define UV__EPROTO (-4046)
#endif
-#if defined(EPROTONOSUPPORT) && !defined(_WIN32)
+#if defined(EPROTONOSUPPORT) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EPROTONOSUPPORT UV__ERR(EPROTONOSUPPORT)
#else
# define UV__EPROTONOSUPPORT (-4045)
#endif
-#if defined(EPROTOTYPE) && !defined(_WIN32)
+#if defined(EPROTOTYPE) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EPROTOTYPE UV__ERR(EPROTOTYPE)
#else
# define UV__EPROTOTYPE (-4044)
#endif
-#if defined(EROFS) && !defined(_WIN32)
+#if defined(EROFS) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EROFS UV__ERR(EROFS)
#else
# define UV__EROFS (-4043)
#endif
-#if defined(ESHUTDOWN) && !defined(_WIN32)
+#if defined(ESHUTDOWN) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ESHUTDOWN UV__ERR(ESHUTDOWN)
#else
# define UV__ESHUTDOWN (-4042)
#endif
-#if defined(ESPIPE) && !defined(_WIN32)
+#if defined(ESPIPE) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ESPIPE UV__ERR(ESPIPE)
#else
# define UV__ESPIPE (-4041)
#endif
-#if defined(ESRCH) && !defined(_WIN32)
+#if defined(ESRCH) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ESRCH UV__ERR(ESRCH)
#else
# define UV__ESRCH (-4040)
#endif
-#if defined(ETIMEDOUT) && !defined(_WIN32)
+#if defined(ETIMEDOUT) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ETIMEDOUT UV__ERR(ETIMEDOUT)
#else
# define UV__ETIMEDOUT (-4039)
#endif
-#if defined(ETXTBSY) && !defined(_WIN32)
+#if defined(ETXTBSY) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ETXTBSY UV__ERR(ETXTBSY)
#else
# define UV__ETXTBSY (-4038)
#endif
-#if defined(EXDEV) && !defined(_WIN32)
+#if defined(EXDEV) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EXDEV UV__ERR(EXDEV)
#else
# define UV__EXDEV (-4037)
#endif
-#if defined(EFBIG) && !defined(_WIN32)
+#if defined(EFBIG) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EFBIG UV__ERR(EFBIG)
#else
# define UV__EFBIG (-4036)
#endif
-#if defined(ENOPROTOOPT) && !defined(_WIN32)
+#if defined(ENOPROTOOPT) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENOPROTOOPT UV__ERR(ENOPROTOOPT)
#else
# define UV__ENOPROTOOPT (-4035)
#endif
-#if defined(ERANGE) && !defined(_WIN32)
+#if defined(ERANGE) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ERANGE UV__ERR(ERANGE)
#else
# define UV__ERANGE (-4034)
#endif
-#if defined(ENXIO) && !defined(_WIN32)
+#if defined(ENXIO) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENXIO UV__ERR(ENXIO)
#else
# define UV__ENXIO (-4033)
#endif
-#if defined(EMLINK) && !defined(_WIN32)
+#if defined(EMLINK) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EMLINK UV__ERR(EMLINK)
#else
# define UV__EMLINK (-4032)
@@ -408,7 +408,7 @@
* defined. Fortunately, its value is always 64 so it's possible albeit
* icky to hard-code it.
*/
-#if defined(EHOSTDOWN) && !defined(_WIN32)
+#if defined(EHOSTDOWN) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EHOSTDOWN UV__ERR(EHOSTDOWN)
#elif defined(__APPLE__) || \
defined(__DragonFly__) || \
@@ -421,37 +421,37 @@
# define UV__EHOSTDOWN (-4031)
#endif
-#if defined(EREMOTEIO) && !defined(_WIN32)
+#if defined(EREMOTEIO) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EREMOTEIO UV__ERR(EREMOTEIO)
#else
# define UV__EREMOTEIO (-4030)
#endif
-#if defined(ENOTTY) && !defined(_WIN32)
+#if defined(ENOTTY) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ENOTTY UV__ERR(ENOTTY)
#else
# define UV__ENOTTY (-4029)
#endif
-#if defined(EFTYPE) && !defined(_WIN32)
+#if defined(EFTYPE) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EFTYPE UV__ERR(EFTYPE)
#else
# define UV__EFTYPE (-4028)
#endif
-#if defined(EILSEQ) && !defined(_WIN32)
+#if defined(EILSEQ) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EILSEQ UV__ERR(EILSEQ)
#else
# define UV__EILSEQ (-4027)
#endif
-#if defined(EOVERFLOW) && !defined(_WIN32)
+#if defined(EOVERFLOW) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__EOVERFLOW UV__ERR(EOVERFLOW)
#else
# define UV__EOVERFLOW (-4026)
#endif
-#if defined(ESOCKTNOSUPPORT) && !defined(_WIN32)
+#if defined(ESOCKTNOSUPPORT) && !defined(_WIN32) && !defined(__COSMOPOLITAN__)
# define UV__ESOCKTNOSUPPORT UV__ERR(ESOCKTNOSUPPORT)
#else
# define UV__ESOCKTNOSUPPORT (-4025) and one new batch of errors showed up:
|
for now, a fix would be to replace the enum declaration with typedef int uv_errno_t;
#define XX(code, not_used) static int UV_ ## code = UV__ ## code; |
it also seems like a |
With the patch below I was able to compile CMake with Cosmopolitan 🎉 cmake-cosmopolitan.patchdiff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index 2c809b6e97..d1a55826ad 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -534,6 +534,76 @@ std::string cmProcess::GetExitExceptionString() const
snprintf(buf, sizeof(buf), fmt, this->ExitValue);
exception_str.assign(buf);
}
+#elif defined(__COSMOPOLITAN__)
+ if (this->Signal == SIGSEGV) {
+ exception_str = "Segmentation fault";
+ } else if (this->Signal == SIGBUS) {
+ exception_str = "Bus error";
+ } else if (this->Signal == SIGFPE) {
+ exception_str = "Floating-point exception";
+ } else if (this->Signal == SIGILL) {
+ exception_str = "Illegal instruction";
+ } else if (this->Signal == SIGILL) {
+ exception_str = "User interrupt";
+ } else if (this->Signal == SIGABRT) {
+ exception_str = "Subprocess aborted";
+ } else if (this->Signal == SIGKILL) {
+ exception_str = "Subprocess killed";
+ } else if (this->Signal == SIGTERM) {
+ exception_str = "Subprocess terminated";
+ } else if (this->Signal == SIGHUP) {
+ exception_str = "SIGHUP";
+ } else if (this->Signal == SIGQUIT) {
+ exception_str = "SIGQUIT";
+ } else if (this->Signal == SIGTRAP) {
+ exception_str = "SIGTRAP";
+ } else if (this->Signal == SIGIOT) {
+ exception_str = "SIGIOT";
+ } else if (this->Signal == SIGUSR1) {
+ exception_str = "SIGUSR1";
+ } else if (this->Signal == SIGUSR2) {
+ exception_str = "SIGUSR2";
+ } else if (this->Signal == SIGPIPE) {
+ exception_str = "SIGPIPE";
+ } else if (this->Signal == SIGALRM) {
+ exception_str = "SIGALRM";
+ } else if (this->Signal == SIGSTKFLT) {
+ exception_str = "SIGSTKFLT";
+ } else if (this->Signal == SIGCHLD) {
+ exception_str = "SIGCHLD";
+ } else if (this->Signal == SIGCONT) {
+ exception_str = "SIGCONT";
+ } else if (this->Signal == SIGSTOP) {
+ exception_str = "SIGSTOP";
+ } else if (this->Signal == SIGTSTP) {
+ exception_str = "SIGTSTP";
+ } else if (this->Signal == SIGTTIN) {
+ exception_str = "SIGTTIN";
+ } else if (this->Signal == SIGTTOU) {
+ exception_str = "SIGTTOU";
+ } else if (this->Signal == SIGURG) {
+ exception_str = "SIGURG";
+ } else if (this->Signal == SIGXCPU) {
+ exception_str = "SIGXCPU";
+ } else if (this->Signal == SIGXFSZ) {
+ exception_str = "SIGXFSZ";
+ } else if (this->Signal == SIGVTALRM) {
+ exception_str = "SIGVTALRM";
+ } else if (this->Signal == SIGPROF) {
+ exception_str = "SIGPROF";
+ } else if (this->Signal == SIGWINCH) {
+ exception_str = "SIGWINCH";
+ } else if (this->Signal == SIGPOLL) {
+ exception_str = "SIGPOLL";
+ } else if (this->Signal == SIGIO) {
+ exception_str = "SIGIO";
+ } else if (this->Signal == SIGPWR) {
+ exception_str = "SIGPWR";
+ } else if (this->Signal == SIGSYS) {
+ exception_str = "SIGSYS";
+ } else {
+ exception_str = cmStrCat("Signal ", this->Signal);
+ }
#else
switch (this->Signal) {
# ifdef SIGSEGV
diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx
index b787f19943..0e7f6db672 100644
--- a/Source/cmUVProcessChain.cxx
+++ b/Source/cmUVProcessChain.cxx
@@ -555,6 +555,84 @@ cmUVProcessChain::Status::GetException() const
}
}
}
+#elif defined(__COSMOPOLITAN__)
+ if (this->Finished && this->TermSignal) {
+ if (this->TermSignal == SIGSEGV) {
+ return std::make_pair(ExceptionCode::Fault, "Segmentation fault");
+ } else if (this->TermSignal == SIGBUS) {
+ return std::make_pair(ExceptionCode::Fault, "Bus error");
+ } else if (this->TermSignal == SIGFPE) {
+ return std::make_pair(ExceptionCode::Numerical,
+ "Floating-point exception");
+ } else if (this->TermSignal == SIGILL) {
+ return std::make_pair(ExceptionCode::Illegal, "Illegal instruction");
+ } else if (this->TermSignal == SIGINT) {
+ return std::make_pair(ExceptionCode::Interrupt, "User interrupt");
+ } else if (this->TermSignal == SIGABRT) {
+ return std::make_pair(ExceptionCode::Other, "Subprocess aborted");
+ } else if (this->TermSignal == SIGKILL) {
+ return std::make_pair(ExceptionCode::Other, "Subprocess killed");
+ } else if (this->TermSignal == SIGTERM) {
+ return std::make_pair(ExceptionCode::Other, "Subprocess terminated");
+ } else if (this->TermSignal == SIGHUP) {
+ return std::make_pair(ExceptionCode::Other, "SIGHUP");
+ } else if (this->TermSignal == SIGQUIT) {
+ return std::make_pair(ExceptionCode::Other, "SIGQUIT");
+ } else if (this->TermSignal == SIGTRAP) {
+ return std::make_pair(ExceptionCode::Other, "SIGTRAP");
+ } else if (this->TermSignal == SIGIOT) {
+ return std::make_pair(ExceptionCode::Other, "SIGIOT");
+ } else if (this->TermSignal == SIGUSR1) {
+ return std::make_pair(ExceptionCode::Other, "SIGUSR1");
+ } else if (this->TermSignal == SIGUSR2) {
+ return std::make_pair(ExceptionCode::Other, "SIGUSR2");
+ } else if (this->TermSignal == SIGPIPE) {
+ return std::make_pair(ExceptionCode::Other, "SIGPIPE");
+ } else if (this->TermSignal == SIGALRM) {
+ return std::make_pair(ExceptionCode::Other, "SIGALRM");
+ } else if (this->TermSignal == SIGSTKFLT) {
+ return std::make_pair(ExceptionCode::Other, "SIGSTKFLT");
+ } else if (this->TermSignal == SIGCHLD) {
+ return std::make_pair(ExceptionCode::Other, "SIGCHLD");
+ } else if (this->TermSignal == SIGFPE) {
+ return std::make_pair(ExceptionCode::Other, "SIGCLD");
+ } else if (this->TermSignal == SIGCONT) {
+ return std::make_pair(ExceptionCode::Other, "SIGCONT");
+ } else if (this->TermSignal == SIGSTOP) {
+ return std::make_pair(ExceptionCode::Other, "SIGSTOP");
+ } else if (this->TermSignal == SIGTSTP) {
+ return std::make_pair(ExceptionCode::Other, "SIGTSTP");
+ } else if (this->TermSignal == SIGTTIN) {
+ return std::make_pair(ExceptionCode::Other, "SIGTTIN");
+ } else if (this->TermSignal == SIGTTOU) {
+ return std::make_pair(ExceptionCode::Other, "SIGTTOU");
+ } else if (this->TermSignal == SIGURG) {
+ return std::make_pair(ExceptionCode::Other, "SIGURG");
+ } else if (this->TermSignal == SIGXCPU) {
+ return std::make_pair(ExceptionCode::Other, "SIGXCPU");
+ } else if (this->TermSignal == SIGXFSZ) {
+ return std::make_pair(ExceptionCode::Other, "SIGXFSZ");
+ } else if (this->TermSignal == SIGVTALRM) {
+ return std::make_pair(ExceptionCode::Other, "SIGVTALRM");
+ } else if (this->TermSignal == SIGPROF) {
+ return std::make_pair(ExceptionCode::Other, "SIGPROF");
+ } else if (this->TermSignal == SIGWINCH) {
+ return std::make_pair(ExceptionCode::Other, "SIGWINCH");
+ } else if (this->TermSignal == SIGPOLL) {
+ return std::make_pair(ExceptionCode::Other, "SIGPOLL");
+ } else if (this->TermSignal == SIGIO) {
+ return std::make_pair(ExceptionCode::Other, "SIGIO");
+ } else if (this->TermSignal == SIGPWR) {
+ return std::make_pair(ExceptionCode::Other, "SIGPWR");
+ } else if (this->TermSignal == SIGSYS) {
+ return std::make_pair(ExceptionCode::Other, "SIGSYS");
+ } else {
+ char buf[256];
+ snprintf(buf, sizeof(buf), "Signal %d", this->TermSignal);
+ return std::make_pair(ExceptionCode::Other, buf);
+ }
+ }
+
#else
if (this->Finished && this->TermSignal) {
switch (this->TermSignal) {
diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt
index a0b161b5c0..ef379260b2 100644
--- a/Utilities/cmlibuv/CMakeLists.txt
+++ b/Utilities/cmlibuv/CMakeLists.txt
@@ -343,6 +343,18 @@ if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
)
endif()
+if(COSMOPOLITAN)
+ list(APPEND uv_headers
+ include/uv/posix.h
+ )
+ list(APPEND uv_sources
+ src/unix/posix-hrtime.c
+ src/unix/posix-poll.c
+ src/unix/no-fsevents.c
+ src/unix/no-proctitle.c
+ )
+endif()
+
include_directories(
${uv_includes}
${KWSYS_HEADER_ROOT}
diff --git a/Utilities/cmlibuv/include/uv/errno.h b/Utilities/cmlibuv/include/uv/errno.h
index 71906b3f5e..8ba3b75221 100644
--- a/Utilities/cmlibuv/include/uv/errno.h
+++ b/Utilities/cmlibuv/include/uv/errno.h
@@ -50,6 +50,14 @@
/* Only map to the system errno on non-Windows platforms. It's apparently
* a fairly common practice for Windows programmers to redefine errno codes.
*/
+
+#if defined(__COSMOPOLITAN__)
+/* Cosmo hass isuess with the libuv macro magic for errno. Therfore use
+ * the _WIN32 code path.
+ */
+#define _WIN32
+#endif
+
#if defined(E2BIG) && !defined(_WIN32)
# define UV__E2BIG UV__ERR(E2BIG)
#else
@@ -457,4 +465,8 @@
# define UV__ESOCKTNOSUPPORT (-4025)
#endif
+#if defined(__COSMOPOLITAN__)
+#undef _WIN32
+#endif
+
#endif /* UV_ERRNO_H_ */
diff --git a/Utilities/cmlibuv/include/uv/unix.h b/Utilities/cmlibuv/include/uv/unix.h
index 7a5a3cb54b..61e4ccd1a1 100644
--- a/Utilities/cmlibuv/include/uv/unix.h
+++ b/Utilities/cmlibuv/include/uv/unix.h
@@ -74,7 +74,8 @@
defined(__MSYS__) || \
defined(__HAIKU__) || \
defined(__QNX__) || \
- defined(__GNU__)
+ defined(__GNU__) || \
+ defined(__COSMOPOLITAN__)
# include "posix.h"
#endif
diff --git a/Utilities/cmlibuv/src/unix/getaddrinfo.c b/Utilities/cmlibuv/src/unix/getaddrinfo.c
index 77337ace94..40cfc9c26e 100644
--- a/Utilities/cmlibuv/src/unix/getaddrinfo.c
+++ b/Utilities/cmlibuv/src/unix/getaddrinfo.c
@@ -32,6 +32,10 @@
#include <string.h>
#include <net/if.h> /* if_indextoname() */
+#ifdef __COSMOPOLITAN__
+#include <sys/ioctl.h>
+#endif
+
/* EAI_* constants. */
#include <netdb.h>
@@ -222,7 +226,7 @@ void uv_freeaddrinfo(struct addrinfo* ai) {
freeaddrinfo(ai);
}
-
+#if !defined(__COSMOPOLITAN__)
int uv_if_indextoname(unsigned int ifindex, char* buffer, size_t* size) {
char ifname_buf[UV_IF_NAMESIZE];
size_t len;
@@ -246,6 +250,36 @@ int uv_if_indextoname(unsigned int ifindex, char* buffer, size_t* size) {
return 0;
}
+#else
+int uv_if_indextoname(unsigned int index, char *name, size_t* size) {
+ int fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, AF_UNSPEC);
+
+ if (fd == -1)
+ return ENXIO;
+
+ struct ifreq ifr;
+ ifr.ifr_ifindex = index;
+
+ int res = 0;
+ int ret = ioctl(fd, SIOCGIFNAME, &ifr, &res);
+ close(fd);
+
+ if (ret) {
+ if(ret == ENODEV)
+ return ENXIO;
+ return ret;
+ }
+
+ if (*size <= IF_NAMESIZE) {
+ *size = IF_NAMESIZE + 1;
+ return UV_ENOBUFS;
+ }
+
+ strncpy(name, ifr.ifr_name, IF_NAMESIZE);
+
+ return 0;
+}
+#endif
int uv_if_indextoiid(unsigned int ifindex, char* buffer, size_t* size) {
return uv_if_indextoname(ifindex, buffer, size);
diff --git a/Utilities/cmlibuv/src/unix/thread.c b/Utilities/cmlibuv/src/unix/thread.c
index 5a07b027ea..9a47703f1c 100644
--- a/Utilities/cmlibuv/src/unix/thread.c
+++ b/Utilities/cmlibuv/src/unix/thread.c
@@ -729,7 +729,7 @@ int uv_cond_init(uv_cond_t* cond) {
if (err)
return UV__ERR(err);
-#if !defined(__hpux)
+#if !defined(__hpux) && !defined(__COSMOPOLITAN__)
err = pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
if (err)
goto error2;
diff --git a/Utilities/cmlibuv/src/unix/udp.c b/Utilities/cmlibuv/src/unix/udp.c
index 83acf13e5b..72f735d0b0 100644
--- a/Utilities/cmlibuv/src/unix/udp.c
+++ b/Utilities/cmlibuv/src/unix/udp.c
@@ -944,7 +944,8 @@ static int uv__udp_set_membership6(uv_udp_t* handle,
!defined(__ANDROID__) && \
!defined(__DragonFly__) && \
!defined(__QNX__) && \
- !defined(__GNU__)
+ !defined(__GNU__) && \
+ !defined(__COSMOPOLITAN__)
static int uv__udp_set_source_membership4(uv_udp_t* handle,
const struct sockaddr_in* multicast_addr,
const char* interface_addr,
@@ -1137,7 +1138,8 @@ int uv_udp_set_source_membership(uv_udp_t* handle,
!defined(__ANDROID__) && \
!defined(__DragonFly__) && \
!defined(__QNX__) && \
- !defined(__GNU__)
+ !defined(__GNU__) && \
+ !defined(__COSMOPOLITAN__)
int err;
union uv__sockaddr mcast_addr;
union uv__sockaddr src_addr;
diff --git a/Utilities/cmlibuv/src/uv-common.c b/Utilities/cmlibuv/src/uv-common.c
index d8f7b0e487..a9147992ba 100644
--- a/Utilities/cmlibuv/src/uv-common.c
+++ b/Utilities/cmlibuv/src/uv-common.c
@@ -254,7 +254,7 @@ int uv_ip6_addr(const char* ip, int port, struct sockaddr_in6* addr) {
zone_index++; /* skip '%' */
/* NOTE: unknown interface (id=0) is silently ignored */
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__COSMOPOLITAN__)
addr->sin6_scope_id = atoi(zone_index);
#else
addr->sin6_scope_id = if_nametoindex(zone_index); |
@cristianadam are you planning to add Right now, this repo depends externally on Ubuntu |
I've opened up a ticket at upstream CMake https://gitlab.kitware.com/cmake/cmake/-/issues/26180
I think having CMake as a cosmopolitan binary would help some Linux users that have old versions in their distribution.
CMake has some files in their
Modules
directory, I guess it needs patching in order to have them inside the zip as it works for Python.The text was updated successfully, but these errors were encountered: