Created
June 12, 2020 19:25
-
-
Save jralls/499b8dc7fda4f0eef78a420e8cc6abe8 to your computer and use it in GitHub Desktop.
Patches already built into guile-2.2.7.4-9d7759
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From fd719dd9456d7ebd1674fc019d1955f40875c286 Mon Sep 17 00:00:00 2001 | |
From: John Ralls <jralls@ceridwen.us> | |
Date: Tue, 23 Apr 2019 15:06:48 -0700 | |
Subject: [PATCH 1/4] Fix build on MinGW-w64 | |
Fixes bug 35405 | |
* lib/poll.h: MinGW provides struct pollfd in winsock2.h and | |
lib/threads.h includes it so disable declaring it in poll.h and | |
get the declaration from winsock2.h. Otherwise gcc complains that | |
poll() has a different signature between the declaration and | |
definition. | |
* libguile/socket.c: TCP declarations are in winsock.h on Windows. | |
* libguile/timegm.c: MinGW doesn't include mktime so include mktime.c to | |
provide it. | |
--- | |
lib/poll.in.h | 5 +++++ | |
lib/timegm.c | 2 ++ | |
libguile/socket.c | 6 +++++- | |
3 files changed, 12 insertions(+), 1 deletion(-) | |
diff --git a/lib/poll.in.h b/lib/poll.in.h | |
index e9b141d8f..3b0a99165 100644 | |
--- a/lib/poll.in.h | |
+++ b/lib/poll.in.h | |
@@ -40,6 +40,9 @@ | |
#if !@HAVE_POLL_H@ | |
+# ifdef __MINGW32__ | |
+# include <winsock2.h> | |
+# endif | |
/* fake a poll(2) environment */ | |
# define POLLIN 0x0001 /* any readable data available */ | |
@@ -55,12 +58,14 @@ | |
# if !GNULIB_defined_poll_types | |
+# ifndef __MINGW32__ | |
struct pollfd | |
{ | |
int fd; /* which file descriptor to poll */ | |
short events; /* events we are interested in */ | |
short revents; /* events found on return */ | |
}; | |
+# endif | |
typedef unsigned long nfds_t; | |
diff --git a/lib/timegm.c b/lib/timegm.c | |
index 168da8ead..35bc67dc1 100644 | |
--- a/lib/timegm.c | |
+++ b/lib/timegm.c | |
@@ -38,3 +38,5 @@ timegm (struct tm *tmp) | |
tmp->tm_isdst = 0; | |
return __mktime_internal (tmp, __gmtime_r, &gmtime_offset); | |
} | |
+ | |
+#include "mktime.c" | |
diff --git a/libguile/socket.c b/libguile/socket.c | |
index 71c17e892..f5371b6c8 100644 | |
--- a/libguile/socket.c | |
+++ b/libguile/socket.c | |
@@ -40,7 +40,11 @@ | |
#include <sys/un.h> | |
#endif | |
#include <netinet/in.h> | |
-#include <netinet/tcp.h> | |
+#ifdef __MINGW32__ | |
+# include <winsock.h> | |
+#else | |
+# include <netinet/tcp.h> | |
+#endif | |
#include <netdb.h> | |
#include <arpa/inet.h> | |
-- | |
2.26.2 | |
From fb8bf1dd79620be9e18aa9dbbb2a3f602028db64 Mon Sep 17 00:00:00 2001 | |
From: John Ralls <jralls@ceridwen.us> | |
Date: Fri, 15 May 2020 14:54:33 -0700 | |
Subject: [PATCH 2/4] MinGW doesn't do signals. | |
--- | |
libguile/null-threads.h | 7 +++++++ | |
1 file changed, 7 insertions(+) | |
diff --git a/libguile/null-threads.h b/libguile/null-threads.h | |
index dcb14e6a7..2ecc921c4 100644 | |
--- a/libguile/null-threads.h | |
+++ b/libguile/null-threads.h | |
@@ -82,10 +82,17 @@ scm_i_sched_yield (void) | |
/* Signals | |
*/ | |
+#ifdef __MINGW32__ | |
+typedef unsigned int sigset_t; | |
+#endif | |
static inline int | |
scm_i_pthread_sigmask (int how, const sigset_t *set, sigset_t *oldset) | |
{ | |
+#ifdef __MINGW32__ | |
+ return 0; | |
+#else | |
return sigprocmask (how, set, oldset); | |
+#endif | |
} | |
/* Mutexes | |
-- | |
2.26.2 | |
From f9a407711597a1506205230e51ad530ef86d180f Mon Sep 17 00:00:00 2001 | |
From: John Ralls <jralls@ceridwen.us> | |
Date: Sun, 26 May 2019 16:35:33 -0700 | |
Subject: [PATCH 3/4] MinGW: Don't break build when including libguile.h | |
--- | |
libguile/iselect.h | 4 ++++ | |
1 file changed, 4 insertions(+) | |
diff --git a/libguile/iselect.h b/libguile/iselect.h | |
index 945ad14af..c2f42d38b 100644 | |
--- a/libguile/iselect.h | |
+++ b/libguile/iselect.h | |
@@ -29,7 +29,11 @@ | |
/* Needed for FD_SET on some systems. */ | |
#include <sys/types.h> | |
+#ifdef __MINGW32__ | |
+#include <winsock2.h> | |
+#else | |
#include <sys/select.h> | |
+#endif | |
SCM_API int scm_std_select (int fds, | |
fd_set *rfds, | |
-- | |
2.26.2 | |
From 9d775924506b971de60d7629473547ea9427cbec Mon Sep 17 00:00:00 2001 | |
From: John Ralls <jralls@ceridwen.us> | |
Date: Mon, 27 May 2019 12:01:29 -0700 | |
Subject: [PATCH 4/4] AC_DEFINE REPLACE_MKTIME | |
Using it to control redefinition of mktime() and inclusion of mktime.c | |
in timegm.c. | |
The former prevents duplicate definitions from mktime.c and the C | |
runtime. The latter prevents duplicate definitions when both mktime.c | |
and timegm.c are built. | |
--- | |
lib/mktime.c | 2 ++ | |
m4/mktime.m4 | 2 ++ | |
2 files changed, 4 insertions(+) | |
diff --git a/lib/mktime.c b/lib/mktime.c | |
index 2efd44a22..588d4d139 100644 | |
--- a/lib/mktime.c | |
+++ b/lib/mktime.c | |
@@ -462,6 +462,7 @@ __mktime_internal (struct tm *tp, | |
static mktime_offset_t localtime_offset; | |
/* Convert *TP to a time_t value. */ | |
+#if REPLACE_MKTIME | |
time_t | |
mktime (struct tm *tp) | |
{ | |
@@ -476,6 +477,7 @@ mktime (struct tm *tp) | |
return __mktime_internal (tp, __localtime_r, &localtime_offset); | |
} | |
+#endif | |
#ifdef weak_alias | |
weak_alias (mktime, timelocal) | |
diff --git a/m4/mktime.m4 b/m4/mktime.m4 | |
index d594ddc58..ec7299f08 100644 | |
--- a/m4/mktime.m4 | |
+++ b/m4/mktime.m4 | |
@@ -244,9 +244,11 @@ main () | |
if test $gl_cv_func_working_mktime = no; then | |
REPLACE_MKTIME=1 | |
+ AC_DEFINE([REPLACE_MKTIME], [1], [System mktime is defective or missing.]) | |
else | |
REPLACE_MKTIME=0 | |
fi | |
+ | |
]) | |
AC_DEFUN([gl_FUNC_MKTIME_INTERNAL], [ | |
-- | |
2.26.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment