├── patches_clean ├── conduit-1.3.4.diff ├── streaming-commons-0.2.2.1.diff ├── math-functions-0.3.4.1.diff ├── cryptohash-0.11.9.diff ├── cipher-aes-0.2.11.diff ├── entropy-0.4.1.6.diff ├── persistent-sqlite-2.11.0.0.diff ├── ieee754-0.8.0.diff └── hashtables-1.2.4.1.diff ├── README.md ├── patches_dirty ├── double-conversion-2.0.2.0.diff ├── unix-compat-0.5.3.diff ├── system-fileio-0.3.16.4.diff ├── regex-posix-clib-2.7.diff ├── basement-0.0.11.diff ├── atomic-primops-0.8.4.diff ├── ghcide.diff ├── network-3.1.2.1.diff ├── foundation-0.0.25.diff ├── cryptonite-0.28.diff ├── inline-c-cpp-0.4.0.3.diff └── old-time-1.1.0.3.diff └── docs └── index.md /patches_clean/conduit-1.3.4.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/conduit.cabal b/conduit.cabal 2 | --- a/conduit.cabal 2021-02-03 11:25:55.181704800 +0300 3 | +++ b/conduit.cabal 2021-02-03 11:24:55.076782800 +0300 4 | @@ -61,6 +61,7 @@ 5 | build-depends: Win32 6 | other-modules: System.Win32File 7 | cpp-options: -DWINDOWS 8 | + extra-ghci-libraries: ucrtbase 9 | else 10 | build-depends: unix 11 | 12 | -------------------------------------------------------------------------------- /patches_clean/streaming-commons-0.2.2.1.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/streaming-commons.cabal b/streaming-commons.cabal 2 | --- a/streaming-commons.cabal 2021-02-03 11:25:55.374818400 +0300 3 | +++ b/streaming-commons.cabal 2021-02-03 11:25:03.274678300 +0300 4 | @@ -111,6 +111,7 @@ 5 | 6 | if os(windows) 7 | cpp-options: -DWINDOWS 8 | + extra-ghci-libraries: ucrtbase 9 | else 10 | build-depends: unix 11 | 12 | -------------------------------------------------------------------------------- /patches_clean/math-functions-0.3.4.1.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/math-functions.cabal b/math-functions.cabal 2 | --- a/math-functions.cabal 2021-02-03 11:25:55.258867300 +0300 3 | +++ b/math-functions.cabal 2021-02-03 11:25:00.701948800 +0300 4 | @@ -93,6 +93,8 @@ 5 | Numeric.Sum 6 | other-modules: 7 | Numeric.SpecFunctions.Compat 8 | + if os(windows) 9 | + extra-ghci-libraries: ucrtbase 10 | 11 | test-suite math-function-tests 12 | default-language: Haskell2010 13 | -------------------------------------------------------------------------------- /patches_clean/cryptohash-0.11.9.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/cbits/bitfn.h b/cbits/bitfn.h 2 | --- a/cbits/bitfn.h 2016-03-25 20:25:04.000000000 +0300 3 | +++ b/cbits/bitfn.h 2021-02-03 11:24:55.893698500 +0300 4 | @@ -158,7 +158,7 @@ 5 | } 6 | #endif 7 | 8 | -#ifdef __MINGW32__ 9 | +#if defined __MINGW32__ || defined _MSC_VER 10 | # define LITTLE_ENDIAN 1234 11 | # define BYTE_ORDER LITTLE_ENDIAN 12 | #elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ghc-nw 2 | This is a supplementary project to support [Visual C/Windows SDK compatible GHC distribution ("GHC NW")](https://awson.github.io/ghc-nw). 3 | 4 | Please, use this project's issue tracker for any feedback. 5 | 6 | The "full" distribution contains a large set of prebuilt haskell packages. Patches to apply for successful build are collected here -- both [the patches ready to be upstreamed](patches_clean), and [quick and dirty patches suitable for GHC NW build only at the moment](patches_dirty). 7 | -------------------------------------------------------------------------------- /patches_dirty/double-conversion-2.0.2.0.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/double-conversion.cabal b/double-conversion.cabal 2 | --- a/double-conversion.cabal 2016-12-13 22:37:31.000000000 +0300 3 | +++ b/double-conversion.cabal 2020-03-31 08:58:27.714652900 +0300 4 | @@ -73,7 +73,8 @@ 5 | 6 | if os(windows) 7 | if arch(x86_64) 8 | - extra-libraries: stdc++-6 gcc_s_seh-1 9 | + extra-libraries: msvcprt 10 | + extra-ghci-libraries: msvcp140 ucrtbase 11 | else 12 | extra-libraries: stdc++-6 gcc_s_dw2-1 13 | else 14 | -------------------------------------------------------------------------------- /patches_clean/cipher-aes-0.2.11.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/cbits/bitfn.h b/cbits/bitfn.h 2 | --- a/cbits/bitfn.h 2015-06-21 15:13:51.000000000 +0300 3 | +++ b/cbits/bitfn.h 2021-02-03 11:24:54.252383100 +0300 4 | @@ -158,13 +158,13 @@ 5 | } 6 | #endif 7 | 8 | -#ifdef __GNUC__ 9 | +#if defined __GNUC__ || defined __clang__ 10 | #define bitfn_ntz(n) __builtin_ctz(n) 11 | #else 12 | #error "define ntz for your platform" 13 | #endif 14 | 15 | -#ifdef __MINGW32__ 16 | +#if defined __MINGW32__ || defined _MSC_VER 17 | # define LITTLE_ENDIAN 1234 18 | # define BYTE_ORDER LITTLE_ENDIAN 19 | #elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) 20 | -------------------------------------------------------------------------------- /patches_clean/entropy-0.4.1.6.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/System/EntropyWindows.hs b/System/EntropyWindows.hs 2 | --- a/System/EntropyWindows.hs 2001-09-09 05:46:40.000000000 +0400 3 | +++ b/System/EntropyWindows.hs 2021-02-03 11:24:56.715103900 +0300 4 | @@ -32,6 +32,7 @@ 5 | import Foreign.Storable (peek) 6 | 7 | {- C example for windows rng - taken from a blog, can't recall which one but thank you! 8 | +/* 9 | #include 10 | #include 11 | ... 12 | @@ -45,6 +46,7 @@ 13 | CryptAcquireContext(&hCryptCtx, NULL, MS_DEF_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT); 14 | CryptGenRandom(hCryptCtx, 128, randomArray); 15 | CryptReleaseContext(hCryptCtx, 0); 16 | + */ 17 | -} 18 | 19 | 20 | -------------------------------------------------------------------------------- /patches_clean/persistent-sqlite-2.11.0.0.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/persistent-sqlite.cabal b/persistent-sqlite.cabal 2 | --- a/persistent-sqlite.cabal 2021-02-03 11:25:55.327947500 +0300 3 | +++ b/persistent-sqlite.cabal 2021-02-03 11:26:39.414161200 +0300 4 | @@ -73,7 +73,7 @@ 5 | include-dirs: cbits 6 | includes: sqlite3.h 7 | install-includes: sqlite3.h 8 | - cc-options: -fPIC -std=c99 9 | + cc-options: -std=c99 10 | if flag(full-text-search) 11 | cc-options: -DSQLITE_ENABLE_FTS3 12 | -DSQLITE_ENABLE_FTS3_PARENTHESIS 13 | @@ -91,6 +91,7 @@ 14 | c-sources: cbits/config.c 15 | 16 | if !os(windows) 17 | + cc-options: -fPIC 18 | extra-libraries: pthread 19 | 20 | source-repository head 21 | -------------------------------------------------------------------------------- /patches_dirty/unix-compat-0.5.3.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/cbits/mktemp.c b/cbits/mktemp.c 2 | --- a/cbits/mktemp.c 2001-09-09 05:46:40.000000000 +0400 3 | +++ b/cbits/mktemp.c 2021-02-05 13:38:59.021997100 +0300 4 | @@ -33,7 +33,12 @@ 5 | * SUCH DAMAGE. 6 | */ 7 | 8 | +#ifdef __MINGW32__ 9 | #include 10 | +#else 11 | +#include 12 | +#define MAXPATHLEN _MAX_PATH 13 | +#endif 14 | #include 15 | #include 16 | #include 17 | diff -urN a/unix-compat.cabal b/unix-compat.cabal 18 | --- a/unix-compat.cabal 2021-02-05 13:39:00.000000000 +0300 19 | +++ b/unix-compat.cabal 2021-02-05 13:38:59.001794500 +0300 20 | @@ -44,7 +44,7 @@ 21 | cbits/HsUname.c 22 | cbits/mktemp.c 23 | 24 | - extra-libraries: msvcrt 25 | + extra-ghci-libraries: ucrtbase 26 | build-depends: Win32 >= 2.5.0.0 27 | 28 | if flag(old-time) 29 | -------------------------------------------------------------------------------- /patches_clean/ieee754-0.8.0.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/cbits/double.c b/cbits/double.c 2 | --- a/cbits/double.c 2017-01-30 14:15:18.000000000 +0300 3 | +++ b/cbits/double.c 2021-02-03 11:24:57.539272500 +0300 4 | @@ -27,6 +27,7 @@ 5 | return ux.w == uy.w; 6 | } 7 | 8 | +#ifndef _MSC_VER 9 | double 10 | copysign (double x, double y) 11 | { 12 | @@ -38,6 +39,7 @@ 13 | uz.w = sign | val; 14 | return uz.d; 15 | } 16 | +#endif 17 | 18 | /* ported from tango/math/IEEE.d nextup */ 19 | double 20 | diff -urN a/cbits/float.c b/cbits/float.c 21 | --- a/cbits/float.c 2017-01-30 14:15:18.000000000 +0300 22 | +++ b/cbits/float.c 2021-02-03 11:24:57.559481700 +0300 23 | @@ -28,6 +28,7 @@ 24 | return ux.w == uy.w; 25 | } 26 | 27 | +#ifndef _MSC_VER 28 | float 29 | copysignf (float x, float y) 30 | { 31 | @@ -39,6 +40,7 @@ 32 | uz.w = sign | val; 33 | return uz.f; 34 | } 35 | +#endif 36 | 37 | /* ported from tango/math/IEEE.d nextupf */ 38 | float 39 | -------------------------------------------------------------------------------- /patches_dirty/system-fileio-0.3.16.4.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/lib/hssystemfileio-win32.c b/lib/hssystemfileio-win32.c 2 | --- a/lib/hssystemfileio-win32.c 2018-01-18 18:26:14.000000000 +0300 3 | +++ b/lib/hssystemfileio-win32.c 2021-02-05 13:38:57.253449100 +0300 4 | @@ -1,23 +1,3 @@ 5 | -/* 6 | -Before including anything, we need to fix up MinGW's MSVCRT defines. 7 | - 8 | -MinGW's requires __MSVCRT_VERSION__ >= 0x0601 to define 9 | -_wstat64(). This is fine for the MinGW distributed with GHC, which sets 10 | -__MSVCRT_VERSION__ = 0x0700, but fails for the Haskell Platform because 11 | -its MinGW sets __MSVCRT_VERSION__ = 0x0600. 12 | - 13 | -Therefore, we include <_mingw.h> first and bump its MSVCRT if necessary. 14 | -*/ 15 | -#include <_mingw.h> 16 | - 17 | -#if defined(__MSVCRT_VERSION__) 18 | -# if __MSVCRT_VERSION__ < 0x0601 19 | -# define __MSVCRT_VERSION__ 0x0601 20 | -# endif 21 | -#else 22 | -# define __MSVCRT_VERSION__ 0x0601 23 | -#endif 24 | - 25 | #include "hssystemfileio-win32.h" 26 | 27 | #include 28 | -------------------------------------------------------------------------------- /patches_dirty/regex-posix-clib-2.7.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/cbits/regcomp.c b/cbits/regcomp.c 2 | --- a/cbits/regcomp.c 2001-09-09 05:46:40.000000000 +0400 3 | +++ b/cbits/regcomp.c 2021-02-05 13:38:55.629204100 +0300 4 | @@ -855,8 +855,8 @@ 5 | codeset_name = strchr (codeset_name, '.') + 1; 6 | # endif 7 | 8 | - if (strcasecmp (codeset_name, "UTF-8") == 0 9 | - || strcasecmp (codeset_name, "UTF8") == 0) 10 | + if (_stricmp (codeset_name, "UTF-8") == 0 11 | + || _stricmp (codeset_name, "UTF8") == 0) 12 | dfa->is_utf8 = 1; 13 | 14 | /* We check exhaustively in the loop below if this charset is a 15 | diff -urN a/cbits/regexec.c b/cbits/regexec.c 16 | --- a/cbits/regexec.c 2001-09-09 05:46:40.000000000 +0400 17 | +++ b/cbits/regexec.c 2021-02-05 13:38:55.644830600 +0300 18 | @@ -18,6 +18,8 @@ 19 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 20 | 02111-1307 USA. */ 21 | 22 | +#include 23 | + 24 | static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags, 25 | int n) internal_function; 26 | static void match_ctx_clean (re_match_context_t *mctx) internal_function; 27 | -------------------------------------------------------------------------------- /patches_dirty/basement-0.0.11.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/Basement/Types/OffsetSize.hs b/Basement/Types/OffsetSize.hs 2 | --- a/Basement/Types/OffsetSize.hs 2019-06-30 10:22:18.000000000 +0300 3 | +++ b/Basement/Types/OffsetSize.hs 2021-02-05 13:38:43.741587600 +0300 4 | @@ -38,7 +38,6 @@ 5 | , sizeOfE 6 | , csizeOfOffset 7 | , csizeOfSize 8 | - , sizeOfCSSize 9 | , sizeOfCSize 10 | , Countable 11 | , Offsetable 12 | @@ -52,7 +51,6 @@ 13 | import GHC.Word 14 | import GHC.Int 15 | import GHC.Prim 16 | -import System.Posix.Types (CSsize (..)) 17 | import Data.Bits 18 | import Basement.Compat.Base 19 | import Basement.Compat.C.Types 20 | @@ -237,14 +235,6 @@ 21 | csizeOfOffset (Offset (I# sz)) = CSize (W64# (int2Word# sz)) 22 | #endif 23 | 24 | -sizeOfCSSize :: CSsize -> CountOf Word8 25 | -sizeOfCSSize (CSsize (-1)) = error "invalid size: CSSize is -1" 26 | -#if WORD_SIZE_IN_BITS < 64 27 | -sizeOfCSSize (CSsize (I32# sz)) = CountOf (I# sz) 28 | -#else 29 | -sizeOfCSSize (CSsize (I64# sz)) = CountOf (I# sz) 30 | -#endif 31 | - 32 | sizeOfCSize :: CSize -> CountOf Word8 33 | #if WORD_SIZE_IN_BITS < 64 34 | sizeOfCSize (CSize (W32# sz)) = CountOf (I# (word2Int# sz)) 35 | -------------------------------------------------------------------------------- /patches_clean/hashtables-1.2.4.1.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/cbits/common.c b/cbits/common.c 2 | --- a/cbits/common.c 2018-05-22 15:47:15.000000000 +0300 3 | +++ b/cbits/common.c 2018-06-17 18:19:16.678413400 +0300 4 | @@ -1,5 +1,9 @@ 5 | #include "defs.h" 6 | 7 | +#ifdef _WIN32 8 | +#define WIN32 9 | +#endif 10 | + 11 | #ifdef WIN32 12 | #include 13 | #else 14 | diff -urN a/cbits/defs.h b/cbits/defs.h 15 | --- a/cbits/defs.h 2018-05-22 15:47:15.000000000 +0300 16 | +++ b/cbits/defs.h 2018-06-17 18:16:56.552193700 +0300 17 | @@ -2,7 +2,6 @@ 18 | #define HASHTABLES_DEFS_H 19 | 20 | #include 21 | -#include 22 | 23 | typedef uintptr_t full_hash_t; 24 | typedef uint16_t small_hash_t; 25 | diff -urN a/cbits/sse-42.c b/cbits/sse-42.c 26 | --- a/cbits/sse-42.c 2018-05-22 15:47:15.000000000 +0300 27 | +++ b/cbits/sse-42.c 2018-06-17 18:22:49.386797400 +0300 28 | @@ -49,8 +49,7 @@ 29 | #define _MODE (SIDD_UWORD_OPS | SIDD_CMP_EQUAL_EACH) 30 | 31 | static inline __m128i cmp_mask(__m128i a, __m128i b) { 32 | - const int mode = SIDD_UWORD_OPS | SIDD_CMP_EQUAL_EACH | SIDD_BIT_MASK; 33 | - return _mm_cmpistrm(a, b, mode); 34 | + return _mm_cmpistrm(a, b, SIDD_UWORD_OPS | SIDD_CMP_EQUAL_EACH | SIDD_BIT_MASK); 35 | } 36 | 37 | static inline int32_t line_result(uint32_t m, int start) { 38 | -------------------------------------------------------------------------------- /patches_dirty/atomic-primops-0.8.4.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/Data/Atomics.hs b/Data/Atomics.hs 2 | --- a/Data/Atomics.hs 2001-09-09 04:46:40.000000000 +0300 3 | +++ b/Data/Atomics.hs 2021-02-08 07:55:15.584926800 +0300 4 | @@ -1,5 +1,6 @@ 5 | {-# LANGUAGE MagicHash, UnboxedTuples, ScopedTypeVariables, BangPatterns, CPP #-} 6 | {-# LANGUAGE ForeignFunctionInterface #-} 7 | +{-# LANGUAGE CApiFFI #-} 8 | 9 | -- | Provides atomic memory operations on IORefs and Mutable Arrays. 10 | -- 11 | @@ -351,15 +352,15 @@ 12 | 13 | #if !(defined(mingw32_HOST_OS) && __GLASGOW_HASKELL__ < 802) 14 | -- | Memory barrier implemented by the GHC rts (see SMP.h). 15 | -foreign import ccall unsafe "store_load_barrier" storeLoadBarrier 16 | +foreign import capi unsafe "store_load_barrier" storeLoadBarrier 17 | :: IO () 18 | 19 | -- | Memory barrier implemented by the GHC rts (see SMP.h). 20 | -foreign import ccall unsafe "load_load_barrier" loadLoadBarrier 21 | +foreign import capi unsafe "load_load_barrier" loadLoadBarrier 22 | :: IO () 23 | 24 | -- | Memory barrier implemented by the GHC rts (see SMP.h). 25 | -foreign import ccall unsafe "write_barrier" writeBarrier 26 | +foreign import capi unsafe "write_barrier" writeBarrier 27 | :: IO () 28 | #else 29 | #warning "importing store_load_barrier and friends from the package's C code." 30 | -------------------------------------------------------------------------------- /patches_dirty/ghcide.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/session-loader/Development/IDE/Session.hs b/session-loader/Development/IDE/Session.hs 2 | --- a/session-loader/Development/IDE/Session.hs 2021-02-19 13:35:27.312489100 +0300 3 | +++ b/session-loader/Development/IDE/Session.hs 2021-02-24 12:14:05.904729900 +0300 4 | @@ -319,22 +319,6 @@ 5 | session args@(hieYaml, _cfp, _opts, _libDir) = do 6 | (hscEnv, new, old_deps) <- packageSetup args 7 | 8 | - -- Whenever we spin up a session on Linux, dynamically load libm.so.6 9 | - -- in. We need this in case the binary is statically linked, in which 10 | - -- case the interactive session will fail when trying to load 11 | - -- ghc-prim, which happens whenever Template Haskell is being 12 | - -- evaluated or haskell-language-server's eval plugin tries to run 13 | - -- some code. If the binary is dynamically linked, then this will have 14 | - -- no effect. 15 | - -- See https://github.com/haskell/haskell-language-server/issues/221 16 | - when (os == "linux") $ do 17 | - initObjLinker hscEnv 18 | - res <- loadDLL hscEnv "libm.so.6" 19 | - case res of 20 | - Nothing -> pure () 21 | - Just err -> hPutStrLn stderr $ 22 | - "Error dynamically loading libm.so.6:\n" <> err 23 | - 24 | -- Make a map from unit-id to DynFlags, this is used when trying to 25 | -- resolve imports. (especially PackageImports) 26 | let uids = map (\ci -> (componentUnitId ci, componentDynFlags ci)) (new : old_deps) 27 | -------------------------------------------------------------------------------- /patches_dirty/network-3.1.2.1.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/Setup.hs b/Setup.hs 2 | --- a/Setup.hs 2020-11-26 04:06:46.000000000 +0300 3 | +++ b/Setup.hs 2021-02-24 11:26:41.436726500 +0300 4 | @@ -3,4 +3,4 @@ 5 | import Distribution.Simple 6 | 7 | main :: IO () 8 | -main = defaultMainWithHooks autoconfUserHooks 9 | +main = defaultMain 10 | diff -urN a/include/HsNet.h b/include/HsNet.h 11 | --- a/include/HsNet.h 2020-11-26 04:06:46.000000000 +0300 12 | +++ b/include/HsNet.h 2021-02-24 11:26:41.439269800 +0300 13 | @@ -11,7 +11,7 @@ 14 | 15 | #ifndef INLINE 16 | # if defined(_MSC_VER) 17 | -# define INLINE extern __inline 18 | +# define INLINE static __inline 19 | # elif defined(__GNUC_GNU_INLINE__) 20 | # define INLINE extern inline 21 | # else 22 | diff -urN a/include/HsNetworkConfig.h b/include/HsNetworkConfig.h 23 | --- a/include/HsNetworkConfig.h 1970-01-01 03:00:00.000000000 +0300 24 | +++ b/include/HsNetworkConfig.h 2021-02-24 11:26:41.442271200 +0300 25 | @@ -0,0 +1,26 @@ 26 | +#define HAVE_DECL_AI_ADDRCONFIG 1 27 | +#define HAVE_DECL_AI_ALL 1 28 | +#define HAVE_DECL_AI_NUMERICSERV 1 29 | +#define HAVE_DECL_AI_V4MAPPED 1 30 | +#define HAVE_DECL_IPPROTO_IP 1 31 | +#define HAVE_DECL_IPPROTO_IPV6 1 32 | +#define HAVE_DECL_IPPROTO_TCP 1 33 | +#define HAVE_DECL_IPV6_V6ONLY 1 34 | +#define HAVE_DECL_SO_PEERCRED 0 35 | +#define HAVE_FCNTL_H 1 36 | +#define HAVE_INTTYPES_H 1 37 | +#define HAVE_LIMITS_H 1 38 | +#define HAVE_MEMORY_H 1 39 | +#define HAVE_NETIOAPI_H 1 40 | +#define HAVE_STDINT_H 1 41 | +#define HAVE_STDLIB_H 1 42 | +#define HAVE_STRING_H 1 43 | +#define HAVE_SYS_STAT_H 1 44 | +#define HAVE_SYS_TYPES_H 1 45 | +#define PACKAGE_BUGREPORT "libraries@haskell.org" 46 | +#define PACKAGE_NAME "Haskell network package" 47 | +#define PACKAGE_STRING "Haskell network package 3.1.2.1" 48 | +#define PACKAGE_TARNAME "network" 49 | +#define PACKAGE_URL "" 50 | +#define PACKAGE_VERSION "3.1.2.1" 51 | +#define STDC_HEADERS 1 52 | diff -urN a/network.cabal b/network.cabal 53 | --- a/network.cabal 2020-11-26 04:06:46.000000000 +0300 54 | +++ b/network.cabal 2021-02-24 11:27:34.367194400 +0300 55 | @@ -33,10 +33,7 @@ 56 | > library 57 | > build-depends: network-uri-flag 58 | category: Network 59 | -build-type: Configure 60 | -extra-tmp-files: 61 | - config.log config.status autom4te.cache network.buildinfo 62 | - include/HsNetworkConfig.h 63 | +build-type: Simple 64 | extra-source-files: 65 | README.md CHANGELOG.md 66 | examples/*.hs tests/*.hs config.guess config.sub install-sh 67 | @@ -94,7 +91,7 @@ 68 | 69 | include-dirs: include 70 | includes: HsNet.h HsNetDef.h alignment.h win32defs.h 71 | - install-includes: HsNet.h HsNetDef.h alignment.h win32defs.h 72 | + install-includes: HsNet.h HsNetDef.h alignment.h win32defs.h HsNetworkConfig.h 73 | c-sources: cbits/HsNet.c cbits/cmsg.c 74 | ghc-options: -Wall -fwarn-tabs 75 | build-tools: hsc2hs 76 | -------------------------------------------------------------------------------- /patches_dirty/foundation-0.0.25.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/Foundation/System/Bindings/Time.hsc b/Foundation/System/Bindings/Time.hsc 2 | --- a/Foundation/System/Bindings/Time.hsc 2019-09-02 06:58:08.000000000 +0300 3 | +++ b/Foundation/System/Bindings/Time.hsc 2021-02-05 13:38:50.436267100 +0300 4 | @@ -10,13 +10,14 @@ 5 | import Basement.Types.OffsetSize 6 | 7 | #include 8 | -#include 9 | #include "foundation_system.h" 10 | 11 | +#if defined _MSC_VER && _MSC_VER < 1900 12 | +#include "foundation_time_compat.h" 13 | +#endif 14 | + 15 | type CClockId = CInt 16 | data CTimeSpec 17 | -data CTimeVal 18 | -data CTimeZone 19 | 20 | size_CTimeSpec :: CSize 21 | size_CTimeSpec = #const sizeof(struct timespec) 22 | @@ -27,12 +28,6 @@ 23 | ofs_CTimeSpec_NanoSeconds :: Offset Word8 24 | ofs_CTimeSpec_NanoSeconds = Offset (#offset struct timespec, tv_nsec) 25 | 26 | -size_CTimeVal :: CSize 27 | -size_CTimeVal = #const sizeof(struct timeval) 28 | - 29 | -size_CTimeZone :: CSize 30 | -size_CTimeZone = #const sizeof(struct timezone) 31 | - 32 | size_CTimeT :: CSize 33 | size_CTimeT = #const sizeof(time_t) 34 | 35 | @@ -121,6 +116,3 @@ 36 | foreign import ccall unsafe "clock_gettime" 37 | sysTimeClockGetTime :: CClockId -> Ptr CTimeSpec -> IO CInt 38 | #endif 39 | - 40 | -foreign import ccall unsafe "gettimeofday" 41 | - sysTimeGetTimeOfDay :: Ptr CTimeVal -> Ptr CTimeZone -> IO CInt 42 | diff -urN a/cbits/foundation_bits.h b/cbits/foundation_bits.h 43 | --- a/cbits/foundation_bits.h 2019-09-02 06:58:08.000000000 +0300 44 | +++ b/cbits/foundation_bits.h 2021-02-05 13:38:50.436267100 +0300 45 | @@ -165,13 +165,13 @@ 46 | } 47 | #endif 48 | 49 | -#ifdef __GNUC__ 50 | +#if defined __GNUC__ || defined __clang__ 51 | #define bitfn_ntz(n) __builtin_ctz(n) 52 | #else 53 | #error "define ntz for your platform" 54 | #endif 55 | 56 | -#ifdef __MINGW32__ 57 | +#if defined __MINGW32__ || defined _MSC_VER 58 | # define LITTLE_ENDIAN 1234 59 | # define BYTE_ORDER LITTLE_ENDIAN 60 | #elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) 61 | diff -urN a/cbits/foundation_time.c b/cbits/foundation_time.c 62 | --- a/cbits/foundation_time.c 2019-09-02 06:58:08.000000000 +0300 63 | +++ b/cbits/foundation_time.c 2021-02-05 13:38:50.451901500 +0300 64 | @@ -92,6 +92,7 @@ 65 | 66 | int foundation_time_clock_getres(unsigned int clockid, struct timespec *timespec) 67 | { 68 | + return -1; 69 | } 70 | 71 | int foundation_time_clock_gettime(unsigned int clockid, struct timespec *ct) 72 | diff -urN a/cbits/foundation_time_compat.h b/cbits/foundation_time_compat.h 73 | --- a/cbits/foundation_time_compat.h 1970-01-01 03:00:00.000000000 +0300 74 | +++ b/cbits/foundation_time_compat.h 2021-02-05 13:38:50.467556300 +0300 75 | @@ -0,0 +1,7 @@ 76 | +#include 77 | + 78 | +struct timespec 79 | +{ 80 | + time_t tv_sec; 81 | + long tv_nsec; 82 | +}; 83 | -------------------------------------------------------------------------------- /patches_dirty/cryptonite-0.28.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/cbits/cryptonite_bitfn.h b/cbits/cryptonite_bitfn.h 2 | --- a/cbits/cryptonite_bitfn.h 2019-12-17 03:55:14.000000000 +0300 3 | +++ b/cbits/cryptonite_bitfn.h 2021-02-05 13:38:47.655690900 +0300 4 | @@ -165,13 +165,13 @@ 5 | } 6 | #endif 7 | 8 | -#ifdef __GNUC__ 9 | +#if defined __GNUC__ || defined __clang__ 10 | #define bitfn_ntz(n) __builtin_ctz(n) 11 | #else 12 | #error "define ntz for your platform" 13 | #endif 14 | 15 | -#ifdef __MINGW32__ 16 | +#if defined __MINGW32__ || defined _MSC_VER 17 | # define LITTLE_ENDIAN 1234 18 | # define BYTE_ORDER LITTLE_ENDIAN 19 | #elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) 20 | diff -urN a/cbits/decaf/include/word.h b/cbits/decaf/include/word.h 21 | --- a/cbits/decaf/include/word.h 2019-12-17 03:55:14.000000000 +0300 22 | +++ b/cbits/decaf/include/word.h 2021-02-05 13:38:47.671339700 +0300 23 | @@ -5,14 +5,7 @@ 24 | #ifndef __WORD_H__ 25 | #define __WORD_H__ 26 | 27 | -/* for posix_memalign */ 28 | -#define _XOPEN_SOURCE 600 29 | -#define __STDC_WANT_LIB_EXT1__ 1 /* for memset_s */ 30 | #include 31 | -#if defined(__sun) && defined(__SVR4) 32 | -extern int posix_memalign(void **, size_t, size_t); 33 | -#endif 34 | - 35 | #include 36 | #include 37 | #include "arch_intrinsics.h" 38 | @@ -27,8 +20,6 @@ 39 | #define _DEFAULT_SOURCE 1 40 | #endif 41 | 42 | -#include "portable_endian.h" 43 | - 44 | #include 45 | #include 46 | #include 47 | @@ -211,30 +202,6 @@ 48 | } 49 | #endif 50 | 51 | -/** 52 | - * Allocate memory which is sufficiently aligned to be used for the 53 | - * largest vector on the system (for now that's a big_register_t). 54 | - * 55 | - * Man malloc says that it does this, but at least for AVX2 on MacOS X, 56 | - * it's lying. 57 | - * 58 | - * @param size The size of the region to allocate. 59 | - * @return A suitable pointer, which can be free'd with free(), 60 | - * or NULL if no memory can be allocated. 61 | - */ 62 | -static CRYPTONITE_DECAF_INLINE void * 63 | -malloc_vector(size_t size) { 64 | - void *out = NULL; 65 | - 66 | - int ret = posix_memalign(&out, sizeof(big_register_t), size); 67 | - 68 | - if (ret) { 69 | - return NULL; 70 | - } else { 71 | - return out; 72 | - } 73 | -} 74 | - 75 | /* PERF: vectorize vs unroll */ 76 | #ifdef __clang__ 77 | #if 100*__clang_major__ + __clang_minor__ > 305 78 | diff -urN a/cryptonite.cabal b/cryptonite.cabal 79 | --- a/cryptonite.cabal 2021-02-05 13:38:46.000000000 +0300 80 | +++ b/cryptonite.cabal 2021-02-05 13:38:47.624426900 +0300 81 | @@ -384,6 +384,7 @@ 82 | Build-Depends: Win32 83 | Other-modules: Crypto.Random.Entropy.Windows 84 | extra-libraries: advapi32 85 | + extra-ghci-libraries: advapi32 ucrtbase 86 | else 87 | Other-modules: Crypto.Random.Entropy.Unix 88 | 89 | -------------------------------------------------------------------------------- /patches_dirty/inline-c-cpp-0.4.0.3.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/cxx-src/HaskellException.cxx b/cxx-src/HaskellException.cxx 2 | --- a/cxx-src/HaskellException.cxx 2020-09-20 13:15:31.000000000 +0300 3 | +++ b/cxx-src/HaskellException.cxx 2021-02-05 13:42:30.453655000 +0300 4 | @@ -10,7 +10,13 @@ 5 | #include 6 | #include 7 | 8 | -#if defined(__GNUC__) || defined(__clang__) 9 | +#if defined(__GNUC__) || (defined(__clang__) && !defined(_MSC_VER)) 10 | +#define ITA_ABI 1 11 | +#else 12 | +#define ITA_ABI 0 13 | +#endif 14 | + 15 | +#if ITA_ABI 16 | #include 17 | #include 18 | #endif 19 | @@ -37,7 +43,7 @@ 20 | // 21 | // regarding how to show the type of an exception. 22 | 23 | -#if defined(__GNUC__) || defined(__clang__) 24 | +#if ITA_ABI 25 | const char* currentExceptionTypeName() 26 | { 27 | int demangle_status; 28 | @@ -46,7 +52,7 @@ 29 | #endif 30 | 31 | void setMessageOfStdException(std::exception &e,char** __inline_c_cpp_error_message__){ 32 | -#if defined(__GNUC__) || defined(__clang__) 33 | +#if ITA_ABI 34 | const char* demangle_result = currentExceptionTypeName(); 35 | std::string message = "Exception: " + std::string(e.what()) + "; type: " + std::string(demangle_result); 36 | #else 37 | @@ -58,7 +64,7 @@ 38 | } 39 | 40 | void setMessageOfOtherException(char** __inline_c_cpp_error_message__){ 41 | -#if defined(__GNUC__) || defined(__clang__) 42 | +#if ITA_ABI 43 | const char* message = currentExceptionTypeName(); 44 | size_t message_len = strlen(message) + 1; 45 | *__inline_c_cpp_error_message__ = static_cast(std::malloc(message_len)); 46 | diff -urN a/inline-c-cpp.cabal b/inline-c-cpp.cabal 47 | --- a/inline-c-cpp.cabal 2021-02-05 13:38:52.000000000 +0300 48 | +++ b/inline-c-cpp.cabal 2021-02-05 13:46:40.914138200 +0300 49 | @@ -35,9 +35,13 @@ 50 | -- bundle C++ code that requires a newer version of the standard. 51 | -- Generated code in user libraries will be compiled with the language 52 | -- version configured there. 53 | - -std=c++11 54 | + -std=c++14 55 | -Wall 56 | - extra-libraries: stdc++ 57 | + if os(windows) 58 | + extra-libraries: msvcprt 59 | + extra-ghci-libraries: msvcp140 ucrtbase 60 | + else 61 | + extra-libraries: stdc++ 62 | 63 | if os(darwin) 64 | -- avoid https://gitlab.haskell.org/ghc/ghc/issues/11829 65 | @@ -45,14 +49,14 @@ 66 | 67 | if impl(ghc >= 8.10) 68 | ghc-options: 69 | - -optcxx-std=c++11 70 | + -optcxx-std=c++14 71 | -optcxx-Wall 72 | else 73 | -- On GHC < 8.10, we have to emulate -optcxx by making the C compiler compile 74 | -- C++. GCC accepts this via -std, whereas Clang requires us to change the 75 | -- command. 76 | ghc-options: 77 | - -optc-std=c++11 78 | + -optc-std=c++14 79 | -optc-Wall 80 | if os(darwin) 81 | ghc-options: -pgmc=clang++ 82 | -------------------------------------------------------------------------------- /patches_dirty/old-time-1.1.0.3.diff: -------------------------------------------------------------------------------- 1 | diff -urN a/Setup.hs b/Setup.hs 2 | --- a/Setup.hs 2014-11-21 13:44:17.000000000 +0300 3 | +++ b/Setup.hs 2021-02-05 13:38:53.827521700 +0300 4 | @@ -3,4 +3,4 @@ 5 | import Distribution.Simple 6 | 7 | main :: IO () 8 | -main = defaultMainWithHooks autoconfUserHooks 9 | +main = defaultMain 10 | diff -urN a/System/Time.hsc b/System/Time.hsc 11 | --- a/System/Time.hsc 2014-11-21 13:44:17.000000000 +0300 12 | +++ b/System/Time.hsc 2021-02-05 13:38:53.834061900 +0300 13 | @@ -1,5 +1,6 @@ 14 | #if __GLASGOW_HASKELL__ >= 701 15 | {-# LANGUAGE Trustworthy #-} 16 | +{-# LANGUAGE CApiFFI #-} 17 | #endif 18 | 19 | ----------------------------------------------------------------------------- 20 | @@ -734,17 +735,17 @@ 21 | foreign import ccall unsafe "HsTime.h __hscore_localtime_r" 22 | localtime_r :: Ptr CTime -> Ptr CTm -> IO (Ptr CTm) 23 | #else 24 | -foreign import ccall unsafe "time.h localtime" 25 | +foreign import capi "time.h localtime" 26 | localtime :: Ptr CTime -> IO (Ptr CTm) 27 | #endif 28 | #if HAVE_GMTIME_R 29 | foreign import ccall unsafe "HsTime.h __hscore_gmtime_r" 30 | gmtime_r :: Ptr CTime -> Ptr CTm -> IO (Ptr CTm) 31 | #else 32 | -foreign import ccall unsafe "time.h gmtime" 33 | +foreign import capi "time.h gmtime" 34 | gmtime :: Ptr CTime -> IO (Ptr CTm) 35 | #endif 36 | -foreign import ccall unsafe "time.h mktime" 37 | +foreign import capi "time.h mktime" 38 | mktime :: Ptr CTm -> IO CTime 39 | 40 | #if HAVE_GETTIMEOFDAY 41 | @@ -760,6 +761,6 @@ 42 | foreign import ccall unsafe "time.h ftime" ftime :: Ptr CTimeB -> IO () 43 | #endif 44 | #else 45 | -foreign import ccall unsafe "time.h time" time :: Ptr CTime -> IO CTime 46 | +foreign import capi "time.h time" time :: Ptr CTime -> IO CTime 47 | #endif 48 | #endif /* ! __HUGS__ */ 49 | diff -urN a/include/HsTimeConfig.h b/include/HsTimeConfig.h 50 | --- a/include/HsTimeConfig.h 1970-01-01 03:00:00.000000000 +0300 51 | +++ b/include/HsTimeConfig.h 2021-02-05 13:38:53.865349000 +0300 52 | @@ -0,0 +1,18 @@ 53 | +#define HAVE_DECL_ALTZONE 0 54 | +#define HAVE_DECL_TZNAME 0 55 | +#define HAVE_INTTYPES_H 1 56 | +#define HAVE_MEMORY_H 1 57 | +#define HAVE_STDINT_H 1 58 | +#define HAVE_STDLIB_H 1 59 | +#define HAVE_STRING_H 1 60 | +#define HAVE_SYS_STAT_H 1 61 | +#define HAVE_SYS_TIMEB_H 1 62 | +#define HAVE_SYS_TYPES_H 1 63 | +#define HAVE_TIME_H 1 64 | +#define PACKAGE_BUGREPORT "libraries@haskell.org" 65 | +#define PACKAGE_NAME "Haskell old-time package" 66 | +#define PACKAGE_STRING "Haskell old-time package 1.0" 67 | +#define PACKAGE_TARNAME "old-time" 68 | +#define PACKAGE_URL "" 69 | +#define PACKAGE_VERSION "1.0" 70 | +#define STDC_HEADERS 1 71 | diff -urN a/old-time.cabal b/old-time.cabal 72 | --- a/old-time.cabal 2021-02-05 13:38:54.000000000 +0300 73 | +++ b/old-time.cabal 2021-02-05 13:38:53.880976900 +0300 74 | @@ -8,7 +8,7 @@ 75 | bug-reports: https://github.com/haskell/old-time/issues 76 | synopsis: Time library 77 | category: System 78 | -build-type: Configure 79 | +build-type: Simple 80 | cabal-Version: >=1.10 81 | description: 82 | This package provides the old time library. 83 | @@ -28,12 +28,6 @@ 84 | install-sh 85 | old-time.buildinfo 86 | 87 | -extra-tmp-files: 88 | - autom4te.cache 89 | - config.log 90 | - config.status 91 | - include/HsTimeConfig.h 92 | - 93 | source-repository head 94 | type: git 95 | location: https://github.com/haskell/old-time.git 96 | @@ -48,6 +42,9 @@ 97 | c-sources: 98 | cbits/timeUtils.c 99 | 100 | + extra-ghci-libraries: 101 | + ucrtbase 102 | + 103 | include-dirs: include 104 | includes: HsTime.h 105 | install-includes: 106 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | ## General Information 2 | 3 | This is a [GHC](https://www.haskell.org/ghc) 8.10.5 (8.10 branch as of 4 | Apr 11, 2021) 64-bit Windows distro, based on and targeting Microsoft 5 | Visual C runtime and native Windows SDK. 6 | 7 | [DOWNLOAD!](https://github.com/awson/ghc-nw/releases/tag/0.0.2) 8 | 9 | ### How it differs from stock Windows GHC distro 10 | 11 | This distro is based on the stock LLVM (clang, lld, llvm-lib) tools and 12 | my own set of tools --- haskell DLL exporter, haskell DLL symbol 13 | loader/locator (for interactive/TH GHC), merge objects tool and 14 | LLVM-based llvm-windres, all the tools are written in C++ and are 15 | blazingly fast. 16 | 17 | It produces the code that is binary compatible and statically linkable 18 | with native Microsoft Visual C (dynamic CRT) and Windows SDK libraries. 19 | 20 | This distro fully supports dynamic linking of *Haskell* libraries and 21 | programs (meet 14kb helloworld exe). The compiler we ship is itself 22 | dynamic. 23 | 24 | The stock distro doesn't support this because of: 25 | 26 | - Windows DLL support in GHC is horribly bitrotted and has some never 27 | resolved issues; 28 | - The DLL format has a limit of max 64k exported symbols, and large 29 | Haskell packages (and first of all, GHC itself) may want to export 30 | more. 31 | 32 | For convenience, we also ship statically linked GHC (`ghc-static.exe`, 33 | to use it tell cabal `--with-ghc=ghc-static.exe`), which is analogous 34 | to the stock GHC and has exactly the same default workflow. 35 | 36 | This default workflow (build static libs and prelinked object files only) 37 | is much faster than full because it doesn't create dynamic 38 | versions of packages. 39 | 40 | The key difference between static and dynamic compilers is in that 41 | they have completely different interactive/TH modes: static compiler 42 | loads and parses object files directly, dynamic compiler links 43 | everything into DLLs and loads them using system facilities. 44 | 45 | All stock GHC tools are *position dependent* executables and produce 46 | *position dependent* code that must be loaded into lower 2GB address 47 | space. Modern security standards consider this a disadvantage. 48 | Microsoft tools *won't even let you* create a DLL satisfying this 49 | condition. 50 | 51 | Our tools are *position independent* executables and generate *position 52 | independent* code that can be loaded into arbitrary addresses. 53 | 54 | ### Some other advantages 55 | 56 | LLD linker is orders of magnitude faster than GNU ld when linking object 57 | files with a large number of sections (which is the case when 58 | `split-sections` is enabled). 59 | 60 | When creating pre-linked object files for static GHC ("ghci 61 | libraries") for large packages our tools are much (twice or more) 62 | faster than GNU ld. 63 | 64 | When using only static compile workflow using static GHC, we observed 65 | that even at compilation stage only, our GHC is considerably faster 66 | (~9%) on a long-to-compile package (haskell-src-exts) and slightly 67 | slower (~2%) on a medium-to-compile package (vector). Perhaps the LLVM 68 | machine-code assembler is faster than GNU gas. Or perhaps my 69 | measurements are completely bogus (although I tried several times and 70 | got similar results each time). 71 | 72 | ### Disadvantages 73 | 74 | The biggest one is that the Windows GHC ecosystem is centered around GNU 75 | tools, so some packages that have important non-Haskell parts (C code 76 | etc) may need to be modified to work with native Microsoft CRT. The 77 | patches provided by this project are mainly related to this. 78 | 79 | If anyone who dares to try my toolset finds a package that don't 80 | compile out of the box and isn't covered by patches provided, I would 81 | be happy to develop the patches required to make the package work. Or I 82 | have the patches ready but forgot to publish them. 83 | 84 | Please, use [project's issue 85 | tracker](https://github.com/awson/ghc-nw/issues) for feedback. 86 | 87 | While the static workflow should be at least on par with stock GHC, 88 | there exists one known issue with the dynamic workflow related to 89 | handling foreign imported addresses (`foreign import ccall "&foo" :: Ptr a`). 90 | 91 | Microsoft and/or Miscrosoft ABI-targeted LLVM tools have no Mingw 92 | runtime pseudo-relocs support (automatic linking of *data*), and if 93 | "foo" resides in a DLL and we need to access it from outside of this 94 | DLL, we really need to declare `foreign import ccall "&__imp_foo" :: Ptr (Ptr a)` instead. 95 | 96 | I have some developments in the pipeline to address this issue in 97 | varying degrees of generality, including full port of runtime 98 | pseudo-relocs support to MS world. 99 | 100 | But for runtime pseudo-relocs to work either all the code must reside in 101 | the lower 2GBs, or all the relevant codegens must be aware of runtime 102 | pseudo-relocs and generate the appropriate code (any DSO which we can't 103 | prove is local must be accessed through variable stub). 104 | 105 | Mingw GCC and clang with Mingw target do this by default, but neither 106 | clang with MSVC target nor any other Visual C compatible compiler nor 107 | GHC itself do this. 108 | 109 | Its possible to introduce a separate switch to tell clang (and any other 110 | LLVM-based tool, e.g. GHC llvm backend) to do it even for the MSVC 111 | target (I have such a patch), and teach GHC native codegen to do this, 112 | but still all other tools in the MS world, notably Visual C itself, and 113 | any other compatible compiler *won't do this*, i.e. linking any 114 | third-party binary objects would be extremely dangerous. 115 | 116 | But it happens very rarely in a wild, so it may not be necessary to 117 | solve this problem in general, we may well get away with per-case 118 | workarounds at the moment. 119 | 120 | ### Installation 121 | 122 | First, install Visual Studio 2019 "Desktop development with C++" 123 | workload (see e.g. `install_vs.bat` in distro directory). 124 | 125 | Then just unpack the distro to any location, let the location be named 126 | 'selected_location' then add `selected_location\ghc-8.10.5\bin` 127 | (and also `selected_location\ghc-8.10.5\xtra\bin` if you want to 128 | use extra utilities, such as Happy, Alex etc) to you PATH. 129 | 130 | Long ago I tested if things work when 'selected_location' contain 131 | spaces and that worked, but a lot happened since then and it might be 132 | better to not put spaces in it. 133 | 134 | We ship no ghci executable, so please use `ghc --interactive` 135 | instead. 136 | 137 | For your convenience I include all the necessary stock LLVM tools into 138 | the distro, but you can use your own if want so. 139 | 140 | There exist 2 versions of this distro: "core" (GHC + 141 | cabal/alex/happy/stack) and "full", which also contains a (large) set of 142 | prebuilt packages and useful utilities, and even the entire Agda 143 | compiler (from the current git HEAD). 144 | 145 | [DOWNLOAD!](https://github.com/awson/ghc-nw/releases/tag/0.0.2) 146 | 147 | ### IMPORTANT 148 | 149 | I didn't bother to introduce different platform name for my toolset, 150 | reusing "mingw32" for it, so you *CAN'T* use exactly the same version 151 | of the stock GHC on the same machine without special care: either you 152 | have to set different package database and package directories locations 153 | using Cabal/Stack switches, or you need to switch between the toolsets 154 | using directory links or whatever. 155 | 156 | You can only use `cabal.exe` and `stack.exe` from this distro to work with 157 | our toolset. The stock `cabal.exe` and `stack.exe` *ARE INCOMPATIBLE* with 158 | our toolset. And our `cabal.exe` and `stack.exe` *ARE INCOMPATIBLE* with 159 | stock GHCs. 160 | 161 | I build everything using Cabal and it worked well, I almost use no 162 | stack, so there may be problems. But since *almost all* of modifications 163 | are in the Cabal *library*, which powers both tools, I expect Stack to 164 | be fine (if not, please let me know!). 165 | 166 | I haven't bothered to modify RTS linking scheme (a known, long standing 167 | issue), so all package DLLs are linked against nodebug, nolog, threaded 168 | RTS Dll (`HSrts-1.0.1_thr-ghc8.10.5.dll`). 169 | 170 | Thus if you ever want to build a dynamic executable (or DLL), e.g, doing 171 | `ghc -dynamic --make Foo`, *YOU SHALL ADD the `-threaded` flag to 172 | that*, i.e. do `ghc -dynamic -threaded --make Foo`. Otherwise you 173 | application will segfault immediately. 174 | 175 | If you manually build a dynamic executable or DLL, you must ensure your 176 | application has access to all the DLLs it depends on. 177 | 178 | Cabal automatically manages this when building Haskell packages. It just 179 | adds all the necessary paths to the environment when running GHC. 180 | 181 | Our toolset executables and DLLs use manually crafted driver executables 182 | and a couple of manifest files. 183 | 184 | Your experience may be different, but the easiest way is to do what 185 | cabal does: add necessary paths to your PATH env variable. 186 | 187 | All system package DLLs are accessible via 188 | `selected_location\ghc-8.10.5\lib\x86_64-windows-ghc-8.10.5`. 189 | 190 | Full distro also contains a large (438) set of prebuilt Haskell packages 191 | and utils (including haskell-language-server, linters, formatters, and 192 | even latest Agda compiled from git sources). These package DLLs are 193 | located at `selected_location\ghc-8.10.5\xtra\x86_64-windows-ghc-8.10.5`. 194 | 195 | `rundyn.bat` from distro's `bin` directory sets all the necessary paths 196 | to run dynamically linked programs for you, use `rundyn dynlinkedfoo`. 197 | 198 | If you want (like me) to create a large globally accessible package repo 199 | (e.g. using `cabal v1-install`) --- it's default location is 200 | `%APPDATA%\cabal\x86_64-windows-ghc-8.10.5` where all the package 201 | DLLs sit. 202 | 203 | Cabal `v2-build` (`v2-install`) puts anything package-related (including 204 | DLL) into the directory of that package. The default location for 205 | package files in the global store is 206 | `%APPDATA%\cabal\store\ghc-8.10.5\package_id\lib`, where 207 | `package_id` is a composition of package name version and hash. 208 | 209 | If you deploy your executables to another machine, the simplest way is to 210 | just copy all the necessary DLLs to the same location. 211 | 212 | ### Some Details 213 | 214 | I provide NO SOURCES at the moment other than the patches from this 215 | project. 216 | 217 | I'll try to release the patches that generally improve GHC and could be 218 | incorporated into the main GHC codebase. But I have neither time nor 219 | energy to clean up and release most of MSVC-specific patches. 220 | --------------------------------------------------------------------------------