on iko/ghcjs-patch-master help sign in
Try to fix qAddDependentFile for windows (#1116)

Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com>

commit986a8007139a1d596ffd685d3c974569fe6df5f2 authorHamish Mackenzie <Hamish.Mackenzie@iohk.io> dateSat 22 May 2021, 06:54 (5 years ago) parent0cf8b89
7 files changed+24−152
overlays/bootstrap.nix+1 overlays/patches/file-embed-lzma-0.patch−44 overlays/patches/file-embed.patch−52 overlays/patches/ghc/ghc-8.10-windows-add-dependent-file.patch+22 overlays/patches/th-utilities.patch−52 overlays/windows.nix−3 release.nix+1−1
overlays/bootstrap.nix+1
@@ -158,6 +158,7 @@ in {
158158
159159 ++ fromUntil "8.10.3" "8.10.5" ./patches/ghc/ghc-8.10.3-rts-make-markLiveObject-thread-safe.patch
160160 ++ final.lib.optional (versionAtLeast "8.10.4" && final.targetPlatform.isWindows) ./patches/ghc/ghc-8.10-z-drive-fix.patch
161+ ++ final.lib.optional (versionAtLeast "8.6.5") ./patches/ghc/ghc-8.10-windows-add-dependent-file.patch
161162 ;
162163 in ({
163164 ghc844 = final.callPackage ../compiler/ghc {
overlays/patches/file-embed-lzma-0.patchdeleted−44
@@ -1,44 +0,0 @@
1−diff --git a/src/FileEmbedLzma.hs b/src/FileEmbedLzma.hs
2−index ca0c394..bc1960f 100644
3−--- a/src/FileEmbedLzma.hs
4−+++ b/src/FileEmbedLzma.hs
5−@@ -36,7 +36,6 @@ import Data.Foldable (for_)
6− import Data.Functor.Compose (Compose (..))
7− import Data.Int (Int64)
8− import Language.Haskell.TH
9−-import Language.Haskell.TH.Syntax (qAddDependentFile)
10− import System.Directory
11− (doesDirectoryExist, getDirectoryContents)
12− import System.FilePath (makeRelative, (</>))
13−@@ -124,7 +123,6 @@ concatEntries xs = (bslEndo BSL.empty, ys)
14− embedDir :: FilePath -> Q Exp
15− embedDir topdir = do
16− pairs' <- runIO $ listDirectoryFiles topdir
17−- for_ pairs' $ qAddDependentFile . fst
18− let pairs = makeAllRelative topdir pairs'
19− embedPairs pairs
20−
21−@@ -151,7 +149,6 @@ embedPairs pairs = do
22− embedRecursiveDir :: FilePath -> Q Exp
23− embedRecursiveDir topdir = do
24− pairs' <- runIO $ listRecursiveDirectoryFiles topdir
25−- for_ pairs' $ qAddDependentFile . fst
26− let pairs = makeAllRelative topdir pairs'
27− embedPairs pairs
28−
29−@@ -162,7 +159,6 @@ embedRecursiveDir topdir = do
30− -- | Embed a lazy 'Data.ByteString.Lazy.ByteString' from a file.
31− embedLazyByteString :: FilePath -> Q Exp
32− embedLazyByteString fp = do
33−- qAddDependentFile fp
34− bsl <- runIO $ BSL.readFile fp
35− lazyBytestringE bsl
36−
37−@@ -173,7 +169,6 @@ embedByteString fp = [| BSL.toStrict $(embedLazyByteString fp) :: BS.ByteString
38− -- | Embed a lazy 'Data.Text.Lazy.Text' from a UTF8-encoded file.
39− embedLazyText :: FilePath -> Q Exp
40− embedLazyText fp = do
41−- qAddDependentFile fp
42− bsl <- runIO $ BSL.readFile fp
43− case TLE.decodeUtf8' bsl of
44− Left e -> reportError (show e)
overlays/patches/file-embed.patchdeleted−52
@@ -1,52 +0,0 @@
1−diff --git a/Data/FileEmbed.hs b/Data/FileEmbed.hs
2−index ca796c0..21c5835 100644
3−--- a/Data/FileEmbed.hs
4−+++ b/Data/FileEmbed.hs
5−@@ -51,7 +51,6 @@ import Language.Haskell.TH.Syntax
6− , runIO
7− , qLocation, loc_filename
8− #if MIN_VERSION_template_haskell(2,7,0)
9−- , Quasi(qAddDependentFile)
10− #endif
11− )
12− #if MIN_VERSION_template_haskell(2,16,0)
13−@@ -83,7 +82,6 @@ import Data.Ord (comparing)
14− embedFile :: FilePath -> Q Exp
15− embedFile fp =
16− #if MIN_VERSION_template_haskell(2,7,0)
17−- qAddDependentFile fp >>
18− #endif
19− (runIO $ B.readFile fp) >>= bsToExp
20−
21−@@ -98,7 +96,6 @@ embedOneFileOf :: [FilePath] -> Q Exp
22− embedOneFileOf ps =
23− (runIO $ readExistingFile ps) >>= \ ( path, content ) -> do
24− #if MIN_VERSION_template_haskell(2,7,0)
25−- qAddDependentFile path
26− #endif
27− bsToExp content
28− where
29−@@ -142,7 +139,6 @@ getDir = fileList
30− pairToExp :: FilePath -> (FilePath, B.ByteString) -> Q Exp
31− pairToExp _root (path, bs) = do
32− #if MIN_VERSION_template_haskell(2,7,0)
33−- qAddDependentFile $ _root ++ '/' : path
34− #endif
35− exp' <- bsToExp bs
36− return $! TupE
37−@@ -187,7 +183,6 @@ stringToBs = B8.pack
38− embedStringFile :: FilePath -> Q Exp
39− embedStringFile fp =
40− #if MIN_VERSION_template_haskell(2,7,0)
41−- qAddDependentFile fp >>
42− #endif
43− (runIO $ P.readFile fp) >>= strToExp
44−
45−@@ -199,7 +194,6 @@ embedOneStringFileOf :: [FilePath] -> Q Exp
46− embedOneStringFileOf ps =
47− (runIO $ readExistingFile ps) >>= \ ( path, content ) -> do
48− #if MIN_VERSION_template_haskell(2,7,0)
49−- qAddDependentFile path
50− #endif
51− strToExp content
52− where
overlays/patches/ghc/ghc-8.10-windows-add-dependent-file.patchnew file+22
@@ -0,0 +1,22 @@
1+diff --git a/utils/iserv-proxy/src/Main.hs b/utils/iserv-proxy/src/Main.hs
2+index 5901ffe562..364a2affeb 100644
3+--- a/utils/iserv-proxy/src/Main.hs
4++++ b/utils/iserv-proxy/src/Main.hs
5+@@ -141,8 +141,15 @@ hook = return
6+ --
7+ fwdTHMsg :: (Binary a) => Pipe -> THMessage a -> IO a
8+ fwdTHMsg local msg = do
9+- writePipe local (putTHMessage msg)
10+- readPipe local get
11++ writePipe local (putTHMessage (fixAddDep msg))
12++ readPipe local get
13++ where
14++ fixAddDep (AddDependentFile fp) = AddDependentFile $ fixZ (map fixSlash fp)
15++ fixAddDep m = m
16++ fixZ ('Z':':':rest) = rest
17++ fixZ fp = fp
18++ fixSlash '\\' = '/'
19++ fixSlash c = c
20+
21+ -- | Fowarard a @Message@ call and handle @THMessages@.
22+ fwdTHCall :: (Binary a) => Bool -> Pipe -> Pipe -> Message a -> IO a
overlays/patches/th-utilities.patchdeleted−52
@@ -1,52 +0,0 @@
1−diff --git a/src/TH/RelativePaths.hs b/src/TH/RelativePaths.hs
2−index e74a5fc..ca7d209 100644
3−--- a/src/TH/RelativePaths.hs
4−+++ b/src/TH/RelativePaths.hs
5−@@ -25,7 +25,6 @@ import qualified Data.Text.IO as T
6− import qualified Data.Text.Lazy as LT
7− import qualified Data.Text.Lazy.IO as LT
8− import Language.Haskell.TH (Q, Loc(loc_filename), location, runIO, reportWarning)
9−-import Language.Haskell.TH.Syntax (addDependentFile)
10− import System.Directory (getDirectoryContents, getCurrentDirectory, setCurrentDirectory, canonicalizePath)
11− import System.FilePath
12−
13−@@ -35,7 +34,6 @@ import System.FilePath
14− qReadFileBS :: FilePath -> Q BS.ByteString
15− qReadFileBS fp = do
16− fp' <- pathRelativeToCabalPackage fp
17−- addDependentFile fp'
18− runIO $ BS.readFile fp'
19−
20− -- | Reads a file as a lazy ByteString. The path is specified relative
21−@@ -44,7 +42,6 @@ qReadFileBS fp = do
22− qReadFileLBS :: FilePath -> Q LBS.ByteString
23− qReadFileLBS fp = do
24− fp' <- pathRelativeToCabalPackage fp
25−- addDependentFile fp'
26− runIO $ LBS.readFile fp'
27−
28− -- | Reads a file as a strict Text. The path is specified relative
29−@@ -53,7 +50,6 @@ qReadFileLBS fp = do
30− qReadFileText :: FilePath -> Q T.Text
31− qReadFileText fp = do
32− fp' <- pathRelativeToCabalPackage fp
33−- addDependentFile fp'
34− runIO $ T.readFile fp'
35−
36− -- | Reads a file as a lazy Text. The path is specified relative
37−@@ -62,7 +58,6 @@ qReadFileText fp = do
38− qReadFileLazyText :: FilePath -> Q LT.Text
39− qReadFileLazyText fp = do
40− fp' <- pathRelativeToCabalPackage fp
41−- addDependentFile fp'
42− runIO $ LT.readFile fp'
43−
44− -- | Reads a file as a String. The path is specified relative
45−@@ -71,7 +66,6 @@ qReadFileLazyText fp = do
46− qReadFileString :: FilePath -> Q String
47− qReadFileString fp = do
48− fp' <- pathRelativeToCabalPackage fp
49−- addDependentFile fp'
50− runIO $ readFile fp'
51−
52− -- | Runs the 'Q' action, temporarily setting the current working
overlays/windows.nix−3
@@ -110,9 +110,6 @@ final: prev:
110110 conduit.patches = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isWindows [ ({ version, revision }: if builtins.compareVersions version "1.3.1.1" < 0 then ./patches/conduit-1.3.0.2.patch else null) ];
111111 streaming-commons.patches = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isWindows [ ./patches/streaming-commons-0.2.0.0.patch ];
112112 x509-system.patches = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isWindows [ ./patches/x509-system-1.6.6.patch ];
113− file-embed.patches = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isWindows [ ./patches/file-embed.patch ];
114− file-embed-lzma.patches = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isWindows [ ./patches/file-embed-lzma-0.patch ];
115− th-utilities.patches = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isWindows [ ./patches/th-utilities.patch ];
116113
117114 # Set all of these to [], as these form the
118115 # dependency graph of the libiserv, iserv-proxy, and iserv-remote
release.nix+1−1
@@ -1,7 +1,7 @@
11# 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating
22# on a machine with e.g. no way to build the Darwin IFDs you need!
33{ supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ]
4−, ifdLevel ? 1
4+, ifdLevel ? 3
55, checkMaterialization ? false }:
66
77let