Skip to content

Commit b7f2b7b

Browse files
authored
Fix unix-time in TH code when cross compiling for windows (#2237)
* Add test * Fix unix-time in TH code when cross compiling for windows * Fix older GHC versions
1 parent e8bd512 commit b7f2b7b

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

overlays/patches/ghc/ghc-8.10-win-add-tzset-to-rtssyms.patch

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c
22
index 348e5ccc21..339d169c89 100644
33
--- a/rts/RtsSymbols.c
44
+++ b/rts/RtsSymbols.c
5-
@@ -149,7 +149,11 @@
5+
@@ -149,7 +149,12 @@
66
RTS_WIN64_ONLY(SymI_HasProto_redirect( \
77
__imp___acrt_iob_func, __rts_iob_func, true)) \
88
RTS_WIN32_ONLY(SymI_HasProto_redirect( \
@@ -11,7 +11,8 @@ index 348e5ccc21..339d169c89 100644
1111
+ SymI_NeedsProto(_tzset) \
1212
+ /* ^^ This one needed for time, tzset deprecated */\
1313
+ SymI_NeedsProto(tzset) \
14-
+ /* ^^ This one needed for unix-time */
14+
+ SymI_HasProto(strtoll) \
15+
+ /* ^^ These two are needed for unix-time */
1516

1617
#define RTS_MINGW_COMPAT_SYMBOLS \
1718
SymI_HasProto_deprecated(access) \

overlays/patches/ghc/ghc-9.2-win-add-tzset-to-rtssyms.patch

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c
22
index 534f30cd4c..9ec7e3a1e4 100644
33
--- a/rts/RtsSymbols.c
44
+++ b/rts/RtsSymbols.c
5-
@@ -183,7 +183,11 @@ extern char **environ;
5+
@@ -183,7 +183,12 @@ extern char **environ;
66
SymI_HasProto(__mingw_vsnwprintf) \
77
/* ^^ Need to figure out why this is needed. */ \
88
SymI_HasProto(__mingw_vfprintf) \
@@ -11,7 +11,8 @@ index 534f30cd4c..9ec7e3a1e4 100644
1111
+ SymI_NeedsProto(_tzset) \
1212
+ /* ^^ This one needed for time, tzset deprecated */\
1313
+ SymI_NeedsProto(tzset) \
14-
+ /* ^^ This one needed for unix-time */
14+
+ SymI_HasProto(strtoll) \
15+
+ /* ^^ These two are needed for unix-time */
1516

1617
#define RTS_MINGW_COMPAT_SYMBOLS \
1718
SymI_HasProto_deprecated(access) \

overlays/patches/ghc/win-add-tzset-to-rtssyms.patch

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c
22
index 10efb2a..d8ea070 100644
33
--- a/rts/RtsSymbols.c
44
+++ b/rts/RtsSymbols.c
5-
@@ -163,7 +163,11 @@ extern char **environ;
5+
@@ -163,7 +163,12 @@ extern char **environ;
66
SymI_HasProto(__mingw_vfprintf) \
77
/* ^^ Need to figure out why this is needed. */ \
88
SymI_HasProto(closure_sizeW_) \
@@ -11,7 +11,8 @@ index 10efb2a..d8ea070 100644
1111
+ SymI_NeedsProto(_tzset) \
1212
+ /* ^^ This one needed for time, tzset deprecated */\
1313
+ SymI_NeedsProto(tzset) \
14-
+ /* ^^ This one needed for unix-time */
14+
+ SymI_HasProto(strtoll) \
15+
+ /* ^^ These two are needed for unix-time */
1516
#else
1617
#define RTS_MINGW_ONLY_SYMBOLS /**/
1718
#endif

test/th-dlls/th-dlls.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ library
1313
, template-haskell
1414
, text
1515
, double-conversion
16+
, unix-time
1617
exposed-modules: Lib
1718
hs-source-dirs: src
1819
default-language: Haskell2010

0 commit comments

Comments
 (0)