on iko/ghcjs-patch-master help sign in
Patched GHCJS 8.10
cc35ee6iko
compiler/ghcjs/ghcjs.nix+8−1
@@ -7,6 +7,7 @@
7 then "ghc884"
7 then "ghc884"
8 else "ghc865"
8 else "ghc865"
9, ghc ? pkgs.buildPackages.ghc
9, ghc ? pkgs.buildPackages.ghc
10+, overrideBootPackages ? [] # adds if not present, overrides if present.
10}:
11}:
11let
12let
12 isGhcjs88 = builtins.compareVersions ghcjsVersion "8.8.0.0" >= 0;
13 isGhcjs88 = builtins.compareVersions ghcjsVersion "8.8.0.0" >= 0;
@@ -14,8 +15,14 @@ let
14
15
15 project = pkgs.buildPackages.haskell-nix.ghcjsProject {
16 project = pkgs.buildPackages.haskell-nix.ghcjsProject {
16 src = ghcjsSrc;
17 src = ghcjsSrc;
17− inherit ghcjsVersion compiler-nix-name;
18+ inherit ghcjsVersion compiler-nix-name overrideBootPackages;
18 index-state = "2020-04-25T00:00:00Z";
19 index-state = "2020-04-25T00:00:00Z";
20+ patches = if isGhcjs810
21+ then [
22+ ./patches/810/fast-weak.patch
23+ ./patches/810/boot-optimization-flags.patch
24+ ]
25+ else [];
19# plan-sha256 = "1wy2lr08maxyi7r8jiwf2gj6pdayk5vxxwh42bj4s2gg4035z0yc";
26# plan-sha256 = "1wy2lr08maxyi7r8jiwf2gj6pdayk5vxxwh42bj4s2gg4035z0yc";
20# materialized = ../../materialized/ghcjs;
27# materialized = ../../materialized/ghcjs;
21 };
28 };
compiler/ghcjs/ghcjs810-patched-boot-packages/aeson.patchnew file+13
@@ -0,0 +1,13 @@
1+diff --git a/aeson.cabal b/aeson.cabal
2+index a0ebd59..552f160 100755
3+--- a/aeson.cabal
4++++ b/aeson.cabal
5+@@ -150,7 +150,7 @@ library
6+ dlist >= 0.8.0.4 && < 0.9,
7+ hashable >= 1.2.7.0 && < 1.4,
8+ scientific >= 0.3.6.2 && < 0.4,
9+- th-abstraction >= 0.2.8.0 && < 0.4,
10++ th-abstraction >= 0.2.8.0 && < 0.5,
11+ uuid-types >= 1.0.3 && < 1.1,
12+ vector >= 0.12.0.1 && < 0.13
13+
compiler/ghcjs/ghcjs810-patched-boot-packages/default.nixnew file+176
@@ -0,0 +1,176 @@
1+{ pkgs
2+, ...
3+}:
4+let
5+ patch = p: path: pkgs.runCommand "patched" { buildInputs = [ pkgs.gnupatch ]; } ''
6+ cp -r ${path} $out
7+ chmod -R +w $out
8+ cd $out
9+ patch -p1 <${p}
10+ '';
11+ getSubdir = d: path: pkgs.runCommand "subdir" { } ''
12+ cp -r ${path}/${d} $out
13+ '';
14+in
15+[
16+ {
17+ name = "primitive";
18+ src = pkgs.fetchgit {
19+ url = "https://github.com/haskell/primitive.git";
20+ rev = "11ff865fd2157a1dfd7dfd525b1cf27e1a300633";
21+ sha256 = "1skim1vlmf0v4ixm8h8ja3m1pz0h10xrfdh1rfzawsy8rvrp2cc0";
22+ };
23+ }
24+ {
25+ name = "dlist";
26+ src = pkgs.fetchgit {
27+ url = "https://github.com/spl/dlist.git";
28+ rev = "567cfeb2f5da30f2e5faf167895b3ee04c698ca0";
29+ sha256 = "0b8ij3ls7bccbp9rlm8dnflnf1wim9xsg42wmirvwxwmh2c0r0hg";
30+ };
31+ }
32+ {
33+ name = "vector";
34+ src = pkgs.fetchgit {
35+ url = "https://github.com/haskell/vector.git";
36+ rev = "de10fd281fa5d8beee3623e809a71385a5ef6864";
37+ sha256 = "09vhbvrkw90xgqfrybmhy120rwcy4snw2f97004alr3n96lwpg1q";
38+ };
39+ }
40+ {
41+ name = "ghcjs-base";
42+ src = patch ./ghcjs-base.patch (pkgs.fetchgit {
43+ url = "https://github.com/ghcjs/ghcjs-base.git";
44+ rev = "85e31beab9beffc3ea91b954b61a5d04e708b8f2";
45+ sha256 = "15fdkjv0l7hpbbsn5238xxgzfdg61g666nzbv2sgxkwryn5rycv0";
46+ });
47+ }
48+ {
49+ name = "text";
50+ src = pkgs.fetchgit {
51+ url = "https://github.com/dfordivam/text.git";
52+ rev = "126174753ea8e5f45df8fcbba609e3f1c453bf27";
53+ sha256 = "0l7nbln2w77s12fm4ybhi0jsfnxkyiwskfx3b682pfisa6n32rgm";
54+ };
55+ }
56+ {
57+ name = "hashable";
58+ src = patch ./hashable.patch (pkgs.fetchgit {
59+ url = "https://github.com/haskell-unordered-containers/hashable.git";
60+ rev = "819fdbeaeeb62ed1344fb057de17fa29b10fa3e1";
61+ sha256 = "0xnwfwnnh0bxq16wx0qmdakvgvj8i22km3bhvvki15rd9jil04cc";
62+ });
63+ }
64+ {
65+ name = "integer-logarithms";
66+ src = pkgs.fetchgit {
67+ url = "https://github.com/haskellari/integer-logarithms.git";
68+ rev = "df09cef2c8eb0d5899e2bcccee2a4fad413bdc11";
69+ sha256 = "1k17hjnjmy44dfywx9nr804qiqmjjhkpfpll5bsfvzvpnl5r75nj";
70+ };
71+ }
72+ {
73+ name = "scientific";
74+ src = pkgs.fetchgit {
75+ url = "https://github.com/basvandijk/scientific.git";
76+ rev = "1d049cdf04e2d92ab187754044b0df933c5e6b0d";
77+ sha256 = "1v4fmfq8hyhdb5ck5r2b45s1izr7hx97v4g7s597ajbv72ldvilq";
78+ };
79+ }
80+ {
81+ name = "attoparsec";
82+ src = pkgs.fetchgit {
83+ url = "https://github.com/dfordivam/attoparsec.git";
84+ rev = "cbfb944aeff61144059a28ada93c579e93ccf7d2";
85+ sha256 = "0bbr4943439sy3grwpwbna4mk7iv87ijaiv3jjfhxhp7y67z51h8";
86+ };
87+ }
88+ {
89+ name = "splitmix";
90+ src = pkgs.fetchgit {
91+ url = "https://github.com/haskellari/splitmix.git";
92+ rev = "d8c1b57bb75178675423f87b1ff58429f37bc9fe";
93+ sha256 = "1m8v439vlwqpqw28dbr04n6m0j2cfb169ly285lp0bjmzcwlr289";
94+ };
95+ }
96+ {
97+ name = "random";
98+ src = pkgs.fetchgit {
99+ url = "https://github.com/haskell/random.git";
100+ rev = "8c59bd0fda84fa581d53069b45100d810f5a778f";
101+ sha256 = "1drdipfbmpg2g2cdrnq1k8yysh86i7ljwm6zkrrs3g8l47n4ha4d";
102+ };
103+ }
104+ {
105+ name = "uuid-types";
106+ src = getSubdir "uuid-types" (pkgs.fetchgit {
107+ url = "https://github.com/haskell-hvr/uuid.git";
108+ rev = "e8dc7126582ba4d3abc5e0f26dc1d8477caab01e";
109+ sha256 = "037cnfz7rhkw383rn117b994jzs93i3bwdv47x5qiza5h5syd76f";
110+ });
111+ }
112+ {
113+ name = "unordered-containers";
114+ src = pkgs.fetchgit {
115+ url = "https://github.com/haskell-unordered-containers/unordered-containers.git";
116+ rev = "db9ddde2b243366976a1bdfbb12a5e257ca762c3";
117+ sha256 = "1wd5hxppj1gg9fa1ihcn3s2y0i70ykv2sf8sym6dlf3r4snda9zi";
118+ };
119+ }
120+ {
121+ name = "base-orphans";
122+ src = pkgs.fetchgit {
123+ url = "https://github.com/haskell-compat/base-orphans.git";
124+ rev = "1af3a3512efbcc12e0c34637a0e433ab6e195932";
125+ sha256 = "14b6qwc3dbnmrhqk66a2cn4pvv3nf6kb3h7ym1hjn5xs7n62zhw1";
126+ };
127+ }
128+ {
129+ name = "time-compat";
130+ src = pkgs.fetchgit {
131+ url = "https://github.com/haskellari/time-compat.git";
132+ rev = "67b8b063295601fb1db185baad363a3f33ed63a9";
133+ sha256 = "0nbjsn7yrygv4i1fd8x90mnf4janq536ffvkjd5zsnyzm8qk8k3j";
134+ };
135+ }
136+ {
137+ name = "th-abstraction";
138+ src = pkgs.fetchgit {
139+ url = "https://github.com/glguy/th-abstraction.git";
140+ rev = "d75761bc5a0f912aeeb508e2c227b9fd830153fd";
141+ sha256 = "070ihxncymzsbrgvwmrm717n0qq5bf9nvc2k210nkil1cwrsnhvc";
142+ };
143+ }
144+ {
145+ name = "tagged";
146+ src = pkgs.fetchgit {
147+ url = "https://github.com/ekmett/tagged.git";
148+ rev = "15fcfe90c779efea951ecf4d451d709aed5f7d32";
149+ sha256 = "1x1wr4zf7k1kvd6rj06h9shw7p5di1jra9fysyw0jx7riiq0v3ch";
150+ };
151+ }
152+ {
153+ name = "base-compat";
154+ src = getSubdir "base-compat" (pkgs.fetchgit {
155+ url = "https://github.com/haskell-compat/base-compat.git";
156+ rev = "e8dbac72251e898fc4b1c1abb34d6578da12f476";
157+ sha256 = "1gs15g8h7p8gab9j5fjvjlhrfv112w91plraf9chq80c5slvk016";
158+ });
159+ }
160+ {
161+ name = "base-compat-batteries";
162+ src = getSubdir "base-compat-batteries" (pkgs.fetchgit {
163+ url = "https://github.com/haskell-compat/base-compat.git";
164+ rev = "e8dbac72251e898fc4b1c1abb34d6578da12f476";
165+ sha256 = "1gs15g8h7p8gab9j5fjvjlhrfv112w91plraf9chq80c5slvk016";
166+ });
167+ }
168+ {
169+ name = "aeson";
170+ src = patch ./aeson.patch (pkgs.fetchgit {
171+ url = "https://github.com/dfordivam/aeson.git";
172+ rev = "9a8f57a52eb748a030bc2bcf5c3159a5e2e696b2";
173+ sha256 = "1y8j3ddxxddpnb7c0vi73ijb08sr09z1gdzfg1rfyzn82d6i38zv";
174+ });
175+ }
176+]
compiler/ghcjs/ghcjs810-patched-boot-packages/ghcjs-base.patchnew file+471
@@ -0,0 +1,471 @@
1+diff --git a/Data/JSString.hs b/Data/JSString.hs
2+index 176aad4..9ca6693 100644
3+--- a/Data/JSString.hs
4++++ b/Data/JSString.hs
5+@@ -99,6 +99,7 @@ module Data.JSString ( JSString
6+ , breakOnEnd
7+ , break
8+ , span
9++ , span_
10+ , group
11+ , group'
12+ , groupBy
13+@@ -1231,19 +1232,23 @@ splitAt (I# n) x = case js_splitAt n x of (# y, z #) -> (y, z)
14+ -- of @t@ of elements that satisfy @p@, and whose second is the
15+ -- remainder of the list.
16+ span :: (Char -> Bool) -> JSString -> (JSString, JSString)
17+-span p x = case js_length x of
18+- 0# -> (empty, empty)
19+- l -> let c0 = js_uncheckedIndex 0# x
20+- in if p (C# (chr# c0)) then loop 0# l else (empty, x)
21++span p x = let (# a, b #) = span_ p x in (a, b)
22++{-# INLINE span #-}
23++
24++span_ :: (Char -> Bool) -> JSString -> (# JSString, JSString #)
25++span_ p x = case js_length x of
26++ 0# -> (# empty, empty #)
27++ l -> let c0 = js_uncheckedIndex 0# x
28++ in if p (C# (chr# c0)) then loop 0# l else (# empty, x #)
29+ where
30+ loop i l
31+- | isTrue# (i >=# l) = (x, empty)
32++ | isTrue# (i >=# l) = (# x, empty #)
33+ | otherwise =
34+ let c = js_uncheckedIndex i x
35+ in if p (C# (chr# c))
36+ then loop (i +# charWidth c) l
37+- else (js_substr 0# i x, js_substr1 i x)
38+-{-# INLINE span #-}
39++ else (# js_substr 0# i x, js_substr1 i x #)
40++{-# INLINE span_ #-}
41+
42+ -- | /O(n)/ 'break' is like 'span', but the prefix returned is
43+ -- over elements that fail the predicate @p@.
44+diff --git a/GHCJS/Foreign.hs b/GHCJS/Foreign.hs
45+index 5bbc5c5..b128f24 100644
46+--- a/GHCJS/Foreign.hs
47++++ b/GHCJS/Foreign.hs
48+@@ -82,7 +82,7 @@ import GHCJS.Marshal
49+ import GHCJS.Marshal.Pure
50+ -}
51+ import Data.String (IsString(..))
52+-import qualified Data.Text as T
53++-- import qualified Data.Text as T
54+
55+
56+ class ToJSString a where
57+diff --git a/GHCJS/Foreign/Internal.hs b/GHCJS/Foreign/Internal.hs
58+index 5ac81f0..449bfe4 100644
59+--- a/GHCJS/Foreign/Internal.hs
60++++ b/GHCJS/Foreign/Internal.hs
61+@@ -100,10 +100,10 @@ import Data.Typeable (Typeable)
62+ import Data.ByteString (ByteString)
63+ import Data.ByteString.Unsafe (unsafePackAddressLen)
64+
65+-import qualified Data.Text.Array as A
66+-import qualified Data.Text as T
67+-import qualified Data.Text.Internal as T
68+-import qualified Data.Text.Lazy as TL (Text, toStrict, fromStrict)
69++-- import qualified Data.Text.Array as A
70++-- import qualified Data.Text as T
71++-- import qualified Data.Text.Internal as T
72++-- import qualified Data.Text.Lazy as TL (Text, toStrict, fromStrict)
73+
74+ import Unsafe.Coerce
75+
76+diff --git a/GHCJS/Marshal.hs b/GHCJS/Marshal.hs
77+index a36aca2..6256a73 100644
78+--- a/GHCJS/Marshal.hs
79++++ b/GHCJS/Marshal.hs
80+@@ -16,7 +16,7 @@
81+
82+ module GHCJS.Marshal ( FromJSVal(..)
83+ , ToJSVal(..)
84+- , toJSVal_aeson
85++ -- , toJSVal_aeson
86+ , toJSVal_pure
87+ ) where
88+
89+@@ -24,17 +24,17 @@ import Control.Applicative
90+ import Control.Monad
91+ import Control.Monad.Trans.Maybe (MaybeT(..), runMaybeT)
92+
93+-import qualified Data.Aeson as AE
94+-import Data.Attoparsec.Number (Number(..))
95++-- import qualified Data.Aeson as AE
96++-- import Data.Attoparsec.Number (Number(..))
97+ import Data.Bits ((.&.))
98+ import Data.Char (chr, ord)
99+-import qualified Data.HashMap.Strict as H
100++-- import qualified Data.HashMap.Strict as H
101+ import Data.Int (Int8, Int16, Int32)
102+ import qualified Data.JSString as JSS
103+-import qualified Data.JSString.Text as JSS
104++-- import qualified Data.JSString.Text as JSS
105+ import Data.Maybe
106+-import Data.Scientific (Scientific, scientific, fromFloatDigits)
107+-import Data.Text (Text)
108++-- import Data.Scientific (Scientific, scientific, fromFloatDigits)
109++-- import Data.Text (Text)
110+ import qualified Data.Vector as V
111+ import Data.Word (Word8, Word16, Word32, Word)
112+ import Data.Primitive.ByteArray
113+@@ -85,11 +85,11 @@ instance FromJSVal JSString where
114+ {-# INLINE fromJSValUnchecked #-}
115+ fromJSVal = fromJSVal_pure
116+ {-# INLINE fromJSVal #-}
117+-instance FromJSVal Text where
118+- fromJSValUnchecked = fromJSValUnchecked_pure
119+- {-# INLINE fromJSValUnchecked #-}
120+- fromJSVal = fromJSVal_pure
121+- {-# INLINE fromJSVal #-}
122++-- instance FromJSVal Text where
123++-- fromJSValUnchecked = fromJSValUnchecked_pure
124++-- {-# INLINE fromJSValUnchecked #-}
125++-- fromJSVal = fromJSVal_pure
126++-- {-# INLINE fromJSVal #-}
127+ instance FromJSVal Char where
128+ fromJSValUnchecked = fromJSValUnchecked_pure
129+ {-# INLINE fromJSValUnchecked #-}
130+@@ -154,24 +154,24 @@ instance FromJSVal Double where
131+ {-# INLINE fromJSValUnchecked #-}
132+ fromJSVal = fromJSVal_pure
133+ {-# INLINE fromJSVal #-}
134+-instance FromJSVal AE.Value where
135+- fromJSVal r = case jsonTypeOf r of
136+- JSONNull -> return (Just AE.Null)
137+- JSONInteger -> liftM (AE.Number . flip scientific 0 . (toInteger :: Int -> Integer))
138+- <$> fromJSVal r
139+- JSONFloat -> liftM (AE.Number . (fromFloatDigits :: Double -> Scientific))
140+- <$> fromJSVal r
141+- JSONBool -> liftM AE.Bool <$> fromJSVal r
142+- JSONString -> liftM AE.String <$> fromJSVal r
143+- JSONArray -> liftM (AE.Array . V.fromList) <$> fromJSVal r
144+- JSONObject -> do
145+- props <- OI.listProps (OI.Object r)
146+- runMaybeT $ do
147+- propVals <- forM props $ \p -> do
148+- v <- MaybeT (fromJSVal =<< OI.getProp p (OI.Object r))
149+- return (JSS.textFromJSString p, v)
150+- return (AE.Object (H.fromList propVals))
151+- {-# INLINE fromJSVal #-}
152++-- instance FromJSVal AE.Value where
153++-- fromJSVal r = case jsonTypeOf r of
154++-- JSONNull -> return (Just AE.Null)
155++-- JSONInteger -> liftM (AE.Number . flip scientific 0 . (toInteger :: Int -> Integer))
156++-- <$> fromJSVal r
157++-- JSONFloat -> liftM (AE.Number . (fromFloatDigits :: Double -> Scientific))
158++-- <$> fromJSVal r
159++-- JSONBool -> liftM AE.Bool <$> fromJSVal r
160++-- JSONString -> liftM AE.String <$> fromJSVal r
161++-- JSONArray -> liftM (AE.Array . V.fromList) <$> fromJSVal r
162++-- JSONObject -> do
163++-- props <- OI.listProps (OI.Object r)
164++-- runMaybeT $ do
165++-- propVals <- forM props $ \p -> do
166++-- v <- MaybeT (fromJSVal =<< OI.getProp p (OI.Object r))
167++-- return (JSS.textFromJSString p, v)
168++-- return (AE.Object (H.fromList propVals))
169++-- {-# INLINE fromJSVal #-}
170+ instance (FromJSVal a, FromJSVal b) => FromJSVal (a,b) where
171+ fromJSVal r = runMaybeT $ (,) <$> jf r 0 <*> jf r 1
172+ {-# INLINE fromJSVal #-}
173+@@ -204,15 +204,15 @@ jf r n = MaybeT $ do
174+ instance ToJSVal JSVal where
175+ toJSVal = toJSVal_pure
176+ {-# INLINE toJSVal #-}
177+-instance ToJSVal AE.Value where
178+- toJSVal = toJSVal_aeson
179+- {-# INLINE toJSVal #-}
180++-- instance ToJSVal AE.Value where
181++-- toJSVal = toJSVal_aeson
182++-- {-# INLINE toJSVal #-}
183+ instance ToJSVal JSString where
184+ toJSVal = toJSVal_pure
185+ {-# INLINE toJSVal #-}
186+-instance ToJSVal Text where
187+- toJSVal = toJSVal_pure
188+- {-# INLINE toJSVal #-}
189++-- instance ToJSVal Text where
190++-- toJSVal = toJSVal_pure
191++-- {-# INLINE toJSVal #-}
192+ instance ToJSVal Char where
193+ toJSVal = return . pToJSVal
194+ {-# INLINE toJSVal #-}
195+@@ -285,21 +285,21 @@ foreign import javascript unsafe "[$1,$2,$3,$4,$5]" arr5 :: JSVal -> J
196+ foreign import javascript unsafe "[$1,$2,$3,$4,$5,$6]" arr6 :: JSVal -> JSVal -> JSVal -> JSVal -> JSVal -> JSVal -> IO JSVal
197+ foreign import javascript unsafe "[$1,$2,$3,$4,$5,$6,$7]" arr7 :: JSVal -> JSVal -> JSVal -> JSVal -> JSVal -> JSVal -> JSVal -> IO JSVal
198+
199+-toJSVal_aeson :: AE.ToJSON a => a -> IO JSVal
200+-toJSVal_aeson x = cv (AE.toJSON x)
201+- where
202+- cv = convertValue
203++-- toJSVal_aeson :: AE.ToJSON a => a -> IO JSVal
204++-- toJSVal_aeson x = cv (AE.toJSON x)
205++-- where
206++-- cv = convertValue
207+
208+- convertValue :: AE.Value -> IO JSVal
209+- convertValue AE.Null = return jsNull
210+- convertValue (AE.String t) = return (pToJSVal t)
211+- convertValue (AE.Array a) = (\(AI.SomeJSArray x) -> x) <$>
212+- (AI.fromListIO =<< mapM convertValue (V.toList a))
213+- convertValue (AE.Number n) = toJSVal (realToFrac n :: Double)
214+- convertValue (AE.Bool b) = return (toJSBool b)
215+- convertValue (AE.Object o) = do
216+- obj@(OI.Object obj') <- OI.create
217+- mapM_ (\(k,v) -> convertValue v >>= \v' -> OI.setProp (JSS.textToJSString k) v' obj) (H.toList o)
218+- return obj'
219++-- convertValue :: AE.Value -> IO JSVal
220++-- convertValue AE.Null = return jsNull
221++-- convertValue (AE.String t) = return (pToJSVal t)
222++-- convertValue (AE.Array a) = (\(AI.SomeJSArray x) -> x) <$>
223++-- (AI.fromListIO =<< mapM convertValue (V.toList a))
224++-- convertValue (AE.Number n) = toJSVal (realToFrac n :: Double)
225++-- convertValue (AE.Bool b) = return (toJSBool b)
226++-- convertValue (AE.Object o) = do
227++-- obj@(OI.Object obj') <- OI.create
228++-- mapM_ (\(k,v) -> convertValue v >>= \v' -> OI.setProp (JSS.textToJSString k) v' obj) (H.toList o)
229++-- return obj'
230+
231+
232+diff --git a/GHCJS/Marshal/Pure.hs b/GHCJS/Marshal/Pure.hs
233+index 902fa20..268489d 100644
234+--- a/GHCJS/Marshal/Pure.hs
235++++ b/GHCJS/Marshal/Pure.hs
236+@@ -28,11 +28,11 @@ import Data.Data
237+ import Data.Int (Int8, Int16, Int32)
238+ import Data.JSString.Internal.Type
239+ import Data.Maybe
240+-import Data.Text (Text)
241++-- import Data.Text (Text)
242+ import Data.Typeable
243+ import Data.Word (Word8, Word16, Word32, Word)
244+ import Data.JSString
245+-import Data.JSString.Text
246++-- import Data.JSString.Text
247+ import Data.Bits ((.&.))
248+ import Unsafe.Coerce (unsafeCoerce)
249+ import GHC.Int
250+@@ -65,8 +65,8 @@ instance PFromJSVal JSString where pFromJSVal = JSString
251+ {-# INLINE pFromJSVal #-}
252+ instance PFromJSVal [Char] where pFromJSVal = Prim.fromJSString
253+ {-# INLINE pFromJSVal #-}
254+-instance PFromJSVal Text where pFromJSVal = textFromJSVal
255+- {-# INLINE pFromJSVal #-}
256++-- instance PFromJSVal Text where pFromJSVal = textFromJSVal
257++-- {-# INLINE pFromJSVal #-}
258+ instance PFromJSVal Char where pFromJSVal x = C# (jsvalToChar x)
259+ {-# INLINE pFromJSVal #-}
260+ instance PFromJSVal Bool where pFromJSVal = isTruthy
261+@@ -103,8 +103,8 @@ instance PToJSVal JSString where pToJSVal = jsval
262+ {-# INLINE pToJSVal #-}
263+ instance PToJSVal [Char] where pToJSVal = Prim.toJSString
264+ {-# INLINE pToJSVal #-}
265+-instance PToJSVal Text where pToJSVal = jsval . textToJSString
266+- {-# INLINE pToJSVal #-}
267++-- instance PToJSVal Text where pToJSVal = jsval . textToJSString
268++-- {-# INLINE pToJSVal #-}
269+ instance PToJSVal Char where pToJSVal (C# c) = charToJSVal c
270+ {-# INLINE pToJSVal #-}
271+ instance PToJSVal Bool where pToJSVal True = jsTrue
272+diff --git a/JavaScript/JSON/Types/Instances.hs b/JavaScript/JSON/Types/Instances.hs
273+index 2b288ec..6d7074c 100644
274+--- a/JavaScript/JSON/Types/Instances.hs
275++++ b/JavaScript/JSON/Types/Instances.hs
276+@@ -57,7 +57,7 @@ import Control.Applicative ((<$>), (<*>), (<|>), pure, empty)
277+
278+ import Data.JSString (JSString)
279+ import qualified Data.JSString as JSS
280+-import qualified Data.JSString.Text as JSS
281++-- import qualified Data.JSString.Text as JSS
282+
283+ import JavaScript.Array (JSArray)
284+ import qualified JavaScript.Array as JSA
285+@@ -335,21 +335,21 @@ instance FromJSON JSString where
286+ parseJSON = withJSString "JSString" pure
287+ {-# INLINE parseJSON #-}
288+
289+-instance ToJSON Text where
290+- toJSON = stringValue . JSS.textToJSString
291+- {-# INLINE toJSON #-}
292++-- instance ToJSON Text where
293++-- toJSON = stringValue . JSS.textToJSString
294++-- {-# INLINE toJSON #-}
295+
296+-instance FromJSON Text where
297+- parseJSON = withJSString "Text" ( pure . JSS.textFromJSString )
298+- {-# INLINE parseJSON #-}
299++-- instance FromJSON Text where
300++-- parseJSON = withJSString "Text" ( pure . JSS.textFromJSString )
301++-- {-# INLINE parseJSON #-}
302+
303+-instance ToJSON LT.Text where
304+- toJSON = stringValue . JSS.textToJSString . LT.toStrict
305+- {-# INLINE toJSON #-}
306++-- instance ToJSON LT.Text where
307++-- toJSON = stringValue . JSS.textToJSString . LT.toStrict
308++-- {-# INLINE toJSON #-}
309+
310+-instance FromJSON LT.Text where
311+- parseJSON = withJSString "Lazy Text" $ pure . LT.fromStrict . JSS.textFromJSString
312+- {-# INLINE parseJSON #-}
313++-- instance FromJSON LT.Text where
314++-- parseJSON = withJSString "Lazy Text" $ pure . LT.fromStrict . JSS.textFromJSString
315++-- {-# INLINE parseJSON #-}
316+
317+ instance (ToJSON a) => ToJSON [a] where
318+ toJSON = arrayValue . arrayValueList . map toJSON
319+diff --git a/JavaScript/Web/Canvas.hs b/JavaScript/Web/Canvas.hs
320+index 0a7684c..74490c2 100644
321+--- a/JavaScript/Web/Canvas.hs
322++++ b/JavaScript/Web/Canvas.hs
323+@@ -69,7 +69,7 @@ import Control.Monad
324+
325+ import Data.Data
326+ import Data.Maybe (fromJust)
327+-import Data.Text (Text)
328++-- import Data.Text (Text)
329+ import Data.Typeable
330+
331+ import GHCJS.Foreign
332+diff --git a/ghcjs-base.cabal b/ghcjs-base.cabal
333+index 4a64694..acf8806 100644
334+--- a/ghcjs-base.cabal
335++++ b/ghcjs-base.cabal
336+@@ -55,7 +55,7 @@ library
337+ Data.JSString.RealFloat
338+ Data.JSString.RegExp
339+ Data.JSString.Internal
340+- Data.JSString.Text
341++ -- Data.JSString.Text
342+ Data.JSString.Internal.Fusion
343+ Data.JSString.Internal.Fusion.Types
344+ Data.JSString.Internal.Fusion.Common
345+@@ -78,12 +78,12 @@ library
346+ JavaScript.Array.Internal
347+ JavaScript.Array.ST
348+ JavaScript.Cast
349+- JavaScript.JSON
350+- JavaScript.JSON.Types
351+- JavaScript.JSON.Types.Class
352+- JavaScript.JSON.Types.Generic
353+- JavaScript.JSON.Types.Instances
354+- JavaScript.JSON.Types.Internal
355++ -- JavaScript.JSON
356++ -- JavaScript.JSON.Types
357++ -- JavaScript.JSON.Types.Class
358++ -- JavaScript.JSON.Types.Generic
359++ -- JavaScript.JSON.Types.Instances
360++ -- JavaScript.JSON.Types.Internal
361+ JavaScript.Number
362+ JavaScript.Object
363+ JavaScript.Object.Internal
364+@@ -115,11 +115,11 @@ library
365+ JavaScript.Web.Storage
366+ JavaScript.Web.Storage.Internal
367+ JavaScript.Web.StorageEvent
368+- JavaScript.Web.XMLHttpRequest
369++ -- JavaScript.Web.XMLHttpRequest
370+ JavaScript.Web.WebSocket
371+ JavaScript.Web.Worker
372+- other-modules: GHCJS.Internal.Types
373+ Data.JSString.Internal.Type
374++ other-modules: GHCJS.Internal.Types
375+ JavaScript.TypedArray.Internal.Types
376+ JavaScript.TypedArray.ArrayBuffer.Internal
377+ JavaScript.TypedArray.DataView.Internal
378+@@ -144,15 +144,15 @@ library
379+ integer-gmp,
380+ binary >= 0.8 && < 0.11,
381+ bytestring >= 0.10 && < 0.11,
382+- text >= 1.1 && < 1.3,
383+- aeson >= 0.8 && < 1.6,
384+- scientific >= 0.3 && < 0.4,
385++ -- text >= 1.1 && < 1.3,
386++ -- aeson >= 0.8 && < 1.6,
387++ -- scientific >= 0.3 && < 0.4,
388+ vector >= 0.10 && < 0.13,
389+ containers >= 0.5 && < 0.7,
390+ time >= 1.5 && < 1.10,
391+- hashable >= 1.2 && < 1.4,
392+- unordered-containers >= 0.2 && < 0.3,
393+- attoparsec >= 0.11 && < 0.15,
394++ -- hashable >= 1.2 && < 1.4,
395++ -- unordered-containers >= 0.2 && < 0.3,
396++ -- attoparsec >= 0.11 && < 0.15,
397+ transformers >= 0.3 && < 0.6,
398+ primitive >= 0.5 && < 0.8,
399+ deepseq >= 1.3 && < 1.5,
400+@@ -161,37 +161,37 @@ library
401+ if !impl(ghcjs) && !os(ghcjs)
402+ buildable: False
403+
404+-test-suite tests
405+- type: exitcode-stdio-1.0
406+- hs-source-dirs: test
407+- main-is: Tests.hs
408+- other-modules: Tests.Marshal
409+- Tests.Properties
410+- Tests.Properties.Numeric
411+- Tests.SlowFunctions
412+- Tests.QuickCheckUtils
413+- Tests.Regressions
414+- Tests.Utils
415+- ghc-options:
416+- -Wall -rtsopts
417+- build-depends:
418+- HUnit >= 1.2,
419+- QuickCheck >= 2.7,
420+- array,
421+- text,
422+- base,
423+- bytestring,
424+- deepseq,
425+- directory,
426+- ghc-prim,
427+- ghcjs-prim,
428+- ghcjs-base,
429+- primitive,
430+- quickcheck-unicode,
431+- random,
432+- test-framework >= 0.4,
433+- test-framework-hunit >= 0.2,
434+- test-framework-quickcheck2 >= 0.2
435+- default-language: Haskell2010
436+- if !impl(ghcjs) && !os(ghcjs)
437+- buildable: False
438++-- test-suite tests
439++-- type: exitcode-stdio-1.0
440++-- hs-source-dirs: test
441++-- main-is: Tests.hs
442++-- other-modules: Tests.Marshal
443++-- Tests.Properties
444++-- Tests.Properties.Numeric
445++-- Tests.SlowFunctions
446++-- Tests.QuickCheckUtils
447++-- Tests.Regressions
448++-- Tests.Utils
449++-- ghc-options:
450++-- -Wall -rtsopts
451++-- build-depends:
452++-- HUnit >= 1.2,
453++-- QuickCheck >= 2.7,
454++-- array,
455++-- text,
456++-- base,
457++-- bytestring,
458++-- deepseq,
459++-- directory,
460++-- ghc-prim,
461++-- ghcjs-prim,
462++-- ghcjs-base,
463++-- primitive,
464++-- quickcheck-unicode,
465++-- random,
466++-- test-framework >= 0.4,
467++-- test-framework-hunit >= 0.2,
468++-- test-framework-quickcheck2 >= 0.2
469++-- default-language: Haskell2010
470++-- if !impl(ghcjs) && !os(ghcjs)
471++-- buildable: False
compiler/ghcjs/ghcjs810-patched-boot-packages/hashable.patchnew file+99
@@ -0,0 +1,99 @@
1+diff --git a/hashable.cabal b/hashable.cabal
2+index 4197060..8c339b1 100755
3+--- a/hashable.cabal
4++++ b/hashable.cabal
5+@@ -88,6 +88,8 @@ library
6+ build-depends: ghc-bignum ==1.0.* || ==1.2.*
7+
8+ else
9++ if impl(ghcjs)
10++ build-depends: ghcjs-base
11+ if flag(integer-gmp)
12+ build-depends: integer-gmp >=0.4 && <1.1
13+
14+diff --git a/src/Data/Hashable/Class.hs b/src/Data/Hashable/Class.hs
15+index c7dd8c5..0e3bbe7 100755
16+--- a/src/Data/Hashable/Class.hs
17++++ b/src/Data/Hashable/Class.hs
18+@@ -5,6 +5,10 @@
19+
20+ {-# LANGUAGE Trustworthy #-}
21+
22++#ifdef __GHCJS__
23++{-# LANGUAGE JavaScriptFFI, UnboxedTuples, GHCForeignImportPrim #-}
24++#endif
25++
26+ #if __GLASGOW_HASKELL__ >= 801
27+ {-# LANGUAGE PolyKinds #-} -- For TypeRep instances
28+ #endif
29+@@ -72,7 +76,9 @@ import Data.Int (Int8, Int16, Int32, Int64)
30+ import Data.List (foldl')
31+ import Data.Ratio (Ratio, denominator, numerator)
32+ import qualified Data.Text as T
33++#ifndef __GHCJS__
34+ import qualified Data.Text.Array as TA
35++#endif
36+ import qualified Data.Text.Internal as T
37+ import qualified Data.Text.Lazy as TL
38+ import Data.Version (Version(..))
39+@@ -152,7 +158,11 @@ import GHC.Exts (Int (..), sizeofByteArray#)
40+ # define MIN_VERSION_integer_gmp_1_0_0
41+ # endif
42+
43++#ifndef __GHCJS__
44+ import GHC.Exts (Int(..))
45++#else
46++import GHC.Exts (Int(..), Int#)
47++#endif
48+ import GHC.Integer.GMP.Internals (Integer(..))
49+ # if defined(MIN_VERSION_integer_gmp_1_0_0)
50+ import GHC.Exts (sizeofByteArray#)
51+@@ -195,6 +205,10 @@ import Data.Kind (Type)
52+ import Data.Hashable.Imports
53+ import Data.Hashable.LowLevel
54+
55++#ifdef __GHCJS__
56++import Data.JSString (JSString)
57++#endif
58++
59+ #include "MachDeps.h"
60+
61+ infixl 0 `hashWithSalt`
62+@@ -676,17 +690,18 @@ instance Hashable BSI.ShortByteString where
63+ #endif
64+
65+ instance Hashable T.Text where
66++#ifndef __GHCJS__
67+ hashWithSalt salt (T.Text arr off len) =
68+ hashByteArrayWithSalt (TA.aBA arr) (off `shiftL` 1) (len `shiftL` 1)
69+ (hashWithSalt salt len)
70++#else
71++ hashWithSalt salt (T.Text txt) =
72++ let (# ba, len #) = js_textFromJSString txt
73++ in hashByteArrayWithSalt ba (0 `shiftL` 1) (I# len `shiftL` 1) salt
74++#endif
75+
76+ instance Hashable TL.Text where
77+- hashWithSalt salt = finalise . TL.foldlChunks step (SP salt 0)
78+- where
79+- finalise (SP s l) = hashWithSalt s l
80+- step (SP s l) (T.Text arr off len) = SP
81+- (hashByteArrayWithSalt (TA.aBA arr) (off `shiftL` 1) (len `shiftL` 1) s)
82+- (l + len)
83++ hashWithSalt = TL.foldlChunks hashWithSalt
84+
85+ -- | Compute the hash of a ThreadId.
86+ hashThreadId :: ThreadId -> Int
87+@@ -880,6 +895,12 @@ instance Hashable1 Option where liftHashWithSalt h salt (Option a) = liftHashWit
88+ #endif
89+ #endif
90+
91++#ifdef __GHCJS__
92++foreign import javascript unsafe
93++ "h$textFromString"
94++ js_textFromJSString :: JSString -> (# ByteArray#, Int# #)
95++#endif
96++
97+ -- instances for @Data.Functor.{Product,Sum,Compose}@, present
98+ -- in base-4.9 and onward.
99+ #if MIN_VERSION_base(4,9,0)
compiler/ghcjs/patches/810/boot-optimization-flags.patchnew file+13
@@ -0,0 +1,13 @@
1+diff --git a/src-bin/Boot.hs b/src-bin/Boot.hs
2+index 2e35a26..1f4ff98 100755
3+--- a/src-bin/Boot.hs
4++++ b/src-bin/Boot.hs
5+@@ -721,6 +721,8 @@ cabalConfigureFlags = do
6+ , "--prefix", T.pack (locs ^. blGhcjsTopDir)
7+ , "--configure-option", "--host=js-unknown-ghcjs"
8+ , "--ghcjs-options=-fwrite-ide-info"
9++ , "--ghcjs-options=-O2"
10++ , "--ghcjs-options=-fexpose-all-unfoldings"
11+ , "--enable-debug-info"
12+ , "--disable-library-stripping"
13+ , "--disable-executable-stripping"
compiler/ghcjs/patches/810/fast-weak.patchnew file+87
@@ -0,0 +1,87 @@
1+diff --git a/lib/boot/shims/src/gc.js.pp b/lib/boot/shims/src/gc.js.pp
2+index 76321b2..a2cf416 100644
3+--- a/lib/boot/shims/src/gc.js.pp
4++++ b/lib/boot/shims/src/gc.js.pp
5+@@ -444,6 +444,50 @@ function h$follow(obj, sp) {
6+ } else if(typeof c.len === 'number' && c.buf instanceof ArrayBuffer) {
7+ TRACE_GC("marking ByteArray");
8+ MARK_OBJ(c);
9++ } else if(c instanceof h$FastWeak) {
10++ MARK_OBJ(c);
11++ if(c.ticket !== null && !IS_MARKED(c.ticket)) {
12++ c.ticket = null; // If the ticket isn't reachable, this will let it get cleaned up by the JS gc; if it is reachable, it'll fill this back in
13++ }
14++ } else if(c instanceof h$FastWeakTicket) {
15++ MARK_OBJ(c);
16++ if(!IS_MARKED(c.val)) {
17++ ADDW(c.val);
18++ }
19++ if(IS_MARKED(c.weak)) {
20++ // In this case, the weak side has been marked first, which means it's been cleared; restore it
21++ c.weak.ticket = c;
22++ }
23++ } else if(c instanceof h$FastWeakBag) {
24++ MARK_OBJ(c);
25++ var j = 0; // j should always be equal to the number of not-yet-necessarily-dead tickets that have been traversed; this should always be less than or equal to i
26++ for(i = 0; i < c.tickets.length; i++) {
27++ // Any nulls left in the array prior to checking on the tickets must be tickets that died in the last GC, so we ignore them
28++ if(c.tickets[i] !== null) {
29++ if(j !== i) {
30++ c.tickets[i].pos = j;
31++ }
32++ if(!IS_MARKED(c.tickets[i])) {
33++ // If the ticket isn't reachable, this will let it get cleaned up by the JS gc; if it is reachable, it'll fill this back in
34++ c.tickets[j] = null;
35++ } else if(j !== i) {
36++ // We need to move the item
37++ c.tickets[j] = c.tickets[i];
38++ } // If it's marked and not moving, don't do anything
39++ j++;
40++ }
41++ }
42++ c.tickets.length = j; // Shrink the array if any nulls have been dropped
43++ } else if(c instanceof h$FastWeakBagTicket) {
44++ MARK_OBJ(c);
45++ if(!IS_MARKED(c.val)) {
46++ ADDW(c.val);
47++ }
48++ if(IS_MARKED(c.bag)) {
49++ // In this case, the weak side has been marked first, which means it's been cleared; restore it
50++ c.bag.tickets[c.pos] = c;
51++ }
52++
53+ } else if(c instanceof h$Weak) {
54+ MARK_OBJ(c);
55+ } else if(c instanceof h$MVar) {
56+diff --git a/lib/boot/shims/src/weak.js.pp b/lib/boot/shims/src/weak.js.pp
57+index 8df313b..d537027 100644
58+--- a/lib/boot/shims/src/weak.js.pp
59++++ b/lib/boot/shims/src/weak.js.pp
60+@@ -87,3 +87,27 @@ function h$finalizeWeak(w) {
61+ RETURN_UBX_TUP2(r, 1);
62+ }
63+ }
64++
65++function h$FastWeak(ticket) {
66++ this.ticket = ticket;
67++ this.m = 0;
68++}
69++
70++function h$FastWeakTicket(val) {
71++ this.val = val;
72++ this.weak = new h$FastWeak(this);
73++ this.m = 0;
74++}
75++
76++function h$FastWeakBag() {
77++ this.tickets = [];
78++ this.m = 0;
79++}
80++
81++function h$FastWeakBagTicket(bag, val) {
82++ this.val = val;
83++ this.bag = bag;
84++ this.pos = bag.tickets.length;
85++ bag.tickets.push(this);
86++ this.m = 0;
87++};
lib/ghcjs-project.nix+26−2
@@ -52,6 +52,8 @@
52 '';
52 '';
53 materialized = ../materialized/ghcjs/cabal + "/${compiler-nix-name}";
53 materialized = ../materialized/ghcjs/cabal + "/${compiler-nix-name}";
54 }
54 }
55+, overrideBootPackages ? []
56+, patches ? []
55, ...
57, ...
56}@args:
58}@args:
57let
59let
@@ -89,7 +91,7 @@ let
89 # Configured the GHCJS source
91 # Configured the GHCJS source
90 configured-src = (pkgs.runCommandCC "configured-ghcjs-src" {
92 configured-src = (pkgs.runCommandCC "configured-ghcjs-src" {
91 buildInputs = configureInputs;
93 buildInputs = configureInputs;
92− inherit src;
94+ inherit src patches;
93 } ''
95 } ''
94 export HOME=$(pwd)
96 export HOME=$(pwd)
95 mkdir $HOME/.cabal
97 mkdir $HOME/.cabal
@@ -98,6 +100,11 @@ let
98 chmod -R +w "$out"
100 chmod -R +w "$out"
99 cd "$out"
101 cd "$out"
100
102
103+ for p in $patches
104+ do
105+ patch -p1 <$p
106+ done
107+
101 # TODO: Find a better way to avoid impure version numbers
108 # TODO: Find a better way to avoid impure version numbers
102 sed -i 's/RELEASE=NO/RELEASE=YES/' ghc/configure.ac
109 sed -i 's/RELEASE=NO/RELEASE=YES/' ghc/configure.ac
103 sed -i 's/${ghcjsVersion}/${ghcVersion}/' ghcjs.cabal
110 sed -i 's/${ghcjsVersion}/${ghcVersion}/' ghcjs.cabal
@@ -130,6 +137,21 @@ let
130 for a in integer-gmp base unix; do
137 for a in integer-gmp base unix; do
131 cp ${../overlays/patches/config.sub} lib/boot/pkg/$a/config.sub
138 cp ${../overlays/patches/config.sub} lib/boot/pkg/$a/config.sub
132 done
139 done
140+ ${ # it just so happens that all existing uses of overriding boot packages
141+ # need to be installed right after template-haskell
142+ # if at some point we would need to insert them at different points
143+ # then we will have gto come up with something more clever
144+ builtins.concatStringsSep "\n" (map ({name, src}: ''
145+ rm -rf $out/lib/boot/pkg/${name}
146+ cp -r ${src} $out/lib/boot/pkg/${name}
147+ sed -i 's/^ - ${name}$//g' $out/lib/boot/boot.yaml
148+ sed -i 's/^ - template-haskell$/ - template-haskell\n - ${name}/g' $out/lib/boot/boot.yaml
149+ echo "Added ${name} to boot.yaml"
150+ ''
151+ ) (pkgs.lib.reverseList overrideBootPackages))
152+ }
153+
154+ chmod -R +w $out/lib/boot/pkg
133 '') // {
155 '') // {
134 # The configured source includes /nix/store paths and so filtering can fail.
156 # The configured source includes /nix/store paths and so filtering can fail.
135 filterPath = { path, ... }: path;
157 filterPath = { path, ... }: path;
@@ -139,7 +161,8 @@ let
139 ghcjsProject = pkgs.haskell-nix.cabalProject' (
161 ghcjsProject = pkgs.haskell-nix.cabalProject' (
140 (pkgs.lib.filterAttrs
162 (pkgs.lib.filterAttrs
141 (n: _: !(builtins.any (x: x == n)
163 (n: _: !(builtins.any (x: x == n)
142− ["src" "ghcjsVersion" "ghcVersion" "happy" "alex" "cabal-install"])) args) // {
164+ [ "src" "ghcjsVersion" "ghcVersion" "happy" "alex" "cabal-install"
165+ "overrideBootPackages" "patches"])) args) // {
143 src = configured-src;
166 src = configured-src;
144 index-state = "2021-03-20T00:00:00Z";
167 index-state = "2021-03-20T00:00:00Z";
145 inherit compiler-nix-name;
168 inherit compiler-nix-name;
@@ -163,6 +186,7 @@ let
163 packages.Cabal.patches = [ ./../overlays/patches/Cabal/fix-data-dir.patch ];
186 packages.Cabal.patches = [ ./../overlays/patches/Cabal/fix-data-dir.patch ];
164 })
187 })
165 {
188 {
189+ ghcOptions = ["-O2"];
166 packages.ghcjs.doHaddock = false;
190 packages.ghcjs.doHaddock = false;
167 packages.haddock-ghcjs.doHaddock = false;
191 packages.haddock-ghcjs.doHaddock = false;
168 packages.haddock-api-ghcjs.doHaddock = false;
192 packages.haddock-api-ghcjs.doHaddock = false;
overlays/bootstrap.nix+3
@@ -795,6 +795,7 @@ in {
795 ghc = buildGHC;
795 ghc = buildGHC;
796 ghcVersion = "8.10.5";
796 ghcVersion = "8.10.5";
797 compiler-nix-name = "ghc8105";
797 compiler-nix-name = "ghc8105";
798+ overrideBootPackages = final.callPackage ../compiler/ghcjs/ghcjs810-patched-boot-packages {};
798 }; in let targetPrefix = "js-unknown-ghcjs-"; in final.runCommand "${targetPrefix}ghc-8.10.5" {
799 }; in let targetPrefix = "js-unknown-ghcjs-"; in final.runCommand "${targetPrefix}ghc-8.10.5" {
799 nativeBuildInputs = [ final.xorg.lndir ];
800 nativeBuildInputs = [ final.xorg.lndir ];
800 passthru = {
801 passthru = {
@@ -829,6 +830,7 @@ in {
829 ghc = buildGHC;
830 ghc = buildGHC;
830 ghcVersion = "8.10.6";
831 ghcVersion = "8.10.6";
831 compiler-nix-name = "ghc8106";
832 compiler-nix-name = "ghc8106";
833+ overrideBootPackages = final.callPackage ../compiler/ghcjs/ghcjs810-patched-boot-packages {};
832 }; in let targetPrefix = "js-unknown-ghcjs-"; in final.runCommand "${targetPrefix}ghc-8.10.6" {
834 }; in let targetPrefix = "js-unknown-ghcjs-"; in final.runCommand "${targetPrefix}ghc-8.10.6" {
833 nativeBuildInputs = [ final.xorg.lndir ];
835 nativeBuildInputs = [ final.xorg.lndir ];
834 passthru = {
836 passthru = {
@@ -863,6 +865,7 @@ in {
863 ghc = buildGHC;
865 ghc = buildGHC;
864 ghcVersion = "8.10.7";
866 ghcVersion = "8.10.7";
865 compiler-nix-name = "ghc8107";
867 compiler-nix-name = "ghc8107";
868+ overrideBootPackages = final.callPackage ../compiler/ghcjs/ghcjs810-patched-boot-packages {};
866 }; in let targetPrefix = "js-unknown-ghcjs-"; in final.runCommand "${targetPrefix}ghc-8.10.7" {
869 }; in let targetPrefix = "js-unknown-ghcjs-"; in final.runCommand "${targetPrefix}ghc-8.10.7" {
867 nativeBuildInputs = [ final.xorg.lndir ];
870 nativeBuildInputs = [ final.xorg.lndir ];
868 passthru = {
871 passthru = {
overlays/ghcjs.nix+4−3
@@ -1,6 +1,6 @@
1final: prev:
1final: prev:
2{
2{
3− haskell-nix = prev.haskell-nix // ({
3+ haskell-nix = prev.haskell-nix // {
4 defaultModules = prev.haskell-nix.defaultModules ++ final.lib.optional final.stdenv.hostPlatform.isGhcjs (
4 defaultModules = prev.haskell-nix.defaultModules ++ final.lib.optional final.stdenv.hostPlatform.isGhcjs (
5 ({ pkgs, buildModules, config, lib, ... }: {
5 ({ pkgs, buildModules, config, lib, ... }: {
6 # Allow Cabal to be reinstalled so that custom setups will use a Cabal
6 # Allow Cabal to be reinstalled so that custom setups will use a Cabal
@@ -17,7 +17,8 @@ final: prev:
17 "hpc"
17 "hpc"
18 "mtl" "parsec" "process" "text" "time" "transformers"
18 "mtl" "parsec" "process" "text" "time" "transformers"
19 "unix" "xhtml" "terminfo"
19 "unix" "xhtml" "terminfo"
20− ];
20+ ] ++ lib.optionals (builtins.compareVersions config.compiler.version "8.10.0.0" >= 0)
21+ (map ({name, ...}: name) (import ../compiler/ghcjs/ghcjs810-patched-boot-packages { inherit pkgs; }));
21 testWrapper = [((final.writeScriptBin "node-wrapper" ''
22 testWrapper = [((final.writeScriptBin "node-wrapper" ''
22 set -euo pipefail
23 set -euo pipefail
23 exe=$1
24 exe=$1
@@ -55,5 +56,5 @@ final: prev:
55 });
56 });
56 })
57 })
57 );
58 );
58− });
59+ };
59}
60}
overlays/haskell.nix+5−1
@@ -145,8 +145,12 @@ final: prev: {
145 if compiler-nix-name != null
145 if compiler-nix-name != null
146 then compiler-nix-name
146 then compiler-nix-name
147 else ((plan-pkgs.extras hackage).compiler or (plan-pkgs.pkgs hackage).compiler).nix-name;
147 else ((plan-pkgs.extras hackage).compiler or (plan-pkgs.pkgs hackage).compiler).nix-name;
148+ compiler-nix-name-with-js-prefix =
149+ if final.stdenv.hostPlatform.isGhcjs
150+ then "js-" + compiler-nix-name'
151+ else compiler-nix-name';
148 pkg-def = excludeBootPackages compiler-nix-name plan-pkgs.pkgs;
152 pkg-def = excludeBootPackages compiler-nix-name plan-pkgs.pkgs;
149− patchesModule = ghcHackagePatches.${compiler-nix-name'} or {};
153+ patchesModule = ghcHackagePatches.${compiler-nix-name-with-js-prefix} or {};
150 package.compiler-nix-name.version = final.buildPackages.haskell-nix.compiler.${compiler-nix-name'}.version;
154 package.compiler-nix-name.version = final.buildPackages.haskell-nix.compiler.${compiler-nix-name'}.version;
151 plan.compiler-nix-name.version = final.buildPackages.haskell-nix.compiler.${(plan-pkgs.pkgs hackage).compiler.nix-name}.version;
155 plan.compiler-nix-name.version = final.buildPackages.haskell-nix.compiler.${(plan-pkgs.pkgs hackage).compiler.nix-name}.version;
152 withMsg = final.lib.assertMsg;
156 withMsg = final.lib.assertMsg;
patches/default.nix+1
@@ -8,4 +8,5 @@
8 ghc863 = import ./ghc863;
8 ghc863 = import ./ghc863;
9 ghc864 = import ./ghc864;
9 ghc864 = import ./ghc864;
10 ghc865 = import ./ghc865;
10 ghc865 = import ./ghc865;
11+ js-ghc8107 = import ./js-ghc8107;
11}
12}
patches/ghc862/default.nix+1−1
@@ -4,8 +4,8 @@
4 packages.hpc.patches = [ ({ version, revision }: if version == "0.6.0.3" && revision == 0 then ./hpc-0.6.0.3.patch else null) ];
4 packages.hpc.patches = [ ({ version, revision }: if version == "0.6.0.3" && revision == 0 then ./hpc-0.6.0.3.patch else null) ];
5 packages.parsec.patches = [ ({ version, revision }: if version == "3.1.13.0" && revision == 0 then ./parsec-3.1.13.0.patch else null) ];
5 packages.parsec.patches = [ ({ version, revision }: if version == "3.1.13.0" && revision == 0 then ./parsec-3.1.13.0.patch else null) ];
6 packages.process.patches = [ ({ version, revision }: if version == "1.6.3.0" && revision == 0 then ./process-1.6.3.0.patch else null) ];
6 packages.process.patches = [ ({ version, revision }: if version == "1.6.3.0" && revision == 0 then ./process-1.6.3.0.patch else null) ];
7+ packages.singletons.patches = [ ({ version, revision }: if version == "2.5.1" && revision == 0 then ./singletons-2.5.1.patch else null) ];
7 packages.time.patches = [ ({ version, revision }: if version == "1.8.0.2" && revision == 0 then ./time-1.8.0.2.patch else null) ];
8 packages.time.patches = [ ({ version, revision }: if version == "1.8.0.2" && revision == 0 then ./time-1.8.0.2.patch else null) ];
8 packages.transformers.patches = [ ({ version, revision }: if version == "0.5.5.0" && revision == 0 then ./transformers-0.5.5.0.patch else null) ];
9 packages.transformers.patches = [ ({ version, revision }: if version == "0.5.5.0" && revision == 0 then ./transformers-0.5.5.0.patch else null) ];
9 packages.unix.patches = [ ({ version, revision }: if version == "2.7.2.2" && revision == 0 then ./unix-2.7.2.2.patch else null) ];
10 packages.unix.patches = [ ({ version, revision }: if version == "2.7.2.2" && revision == 0 then ./unix-2.7.2.2.patch else null) ];
10− packages.singletons.patches = [ ({ version, revision }: if version == "2.5.1" && revision == 0 then ./singletons-2.5.1.patch else null) ];
11}
11}
patches/ghc863/default.nix+1−1
@@ -4,8 +4,8 @@
4 packages.hpc.patches = [ ({ version, revision }: if version == "0.6.0.3" && revision == 0 then ./hpc-0.6.0.3.patch else null) ];
4 packages.hpc.patches = [ ({ version, revision }: if version == "0.6.0.3" && revision == 0 then ./hpc-0.6.0.3.patch else null) ];
5 packages.parsec.patches = [ ({ version, revision }: if version == "3.1.13.0" && revision == 0 then ./parsec-3.1.13.0.patch else null) ];
5 packages.parsec.patches = [ ({ version, revision }: if version == "3.1.13.0" && revision == 0 then ./parsec-3.1.13.0.patch else null) ];
6 packages.process.patches = [ ({ version, revision }: if version == "1.6.3.0" && revision == 0 then ./process-1.6.3.0.patch else null) ];
6 packages.process.patches = [ ({ version, revision }: if version == "1.6.3.0" && revision == 0 then ./process-1.6.3.0.patch else null) ];
7+ packages.singletons.patches = [ ({ version, revision }: if version == "2.5.1" && revision == 0 then ./singletons-2.5.1.patch else null) ];
7 packages.time.patches = [ ({ version, revision }: if version == "1.8.0.2" && revision == 0 then ./time-1.8.0.2.patch else null) ];
8 packages.time.patches = [ ({ version, revision }: if version == "1.8.0.2" && revision == 0 then ./time-1.8.0.2.patch else null) ];
8 packages.transformers.patches = [ ({ version, revision }: if version == "0.5.5.0" && revision == 0 then ./transformers-0.5.5.0.patch else null) ];
9 packages.transformers.patches = [ ({ version, revision }: if version == "0.5.5.0" && revision == 0 then ./transformers-0.5.5.0.patch else null) ];
9 packages.unix.patches = [ ({ version, revision }: if version == "2.7.2.2" && revision == 0 then ./unix-2.7.2.2.patch else null) ];
10 packages.unix.patches = [ ({ version, revision }: if version == "2.7.2.2" && revision == 0 then ./unix-2.7.2.2.patch else null) ];
10− packages.singletons.patches = [ ({ version, revision }: if version == "2.5.1" && revision == 0 then ./singletons-2.5.1.patch else null) ];
11}
11}
patches/ghc864/default.nix+1−1
@@ -3,6 +3,6 @@
3 packages.containers.patches = [ ({ version, revision }: if version == "0.6.0.1" && revision == 0 then ./containers-0.6.0.1.patch else null) ];
3 packages.containers.patches = [ ({ version, revision }: if version == "0.6.0.1" && revision == 0 then ./containers-0.6.0.1.patch else null) ];
4 packages.hpc.patches = [ ({ version, revision }: if version == "0.6.0.3" && revision == 0 then ./hpc-0.6.0.3.patch else null) ];
4 packages.hpc.patches = [ ({ version, revision }: if version == "0.6.0.3" && revision == 0 then ./hpc-0.6.0.3.patch else null) ];
5 packages.parsec.patches = [ ({ version, revision }: if version == "3.1.13.0" && revision == 0 then ./parsec-3.1.13.0.patch else null) ];
5 packages.parsec.patches = [ ({ version, revision }: if version == "3.1.13.0" && revision == 0 then ./parsec-3.1.13.0.patch else null) ];
6− packages.unix.patches = [ ({ version, revision }: if version == "2.7.2.2" && revision == 0 then ./unix-2.7.2.2.patch else null) ];
7 packages.singletons.patches = [ ({ version, revision }: if version == "2.5.1" && revision == 0 then ./singletons-2.5.1.patch else null) ];
6 packages.singletons.patches = [ ({ version, revision }: if version == "2.5.1" && revision == 0 then ./singletons-2.5.1.patch else null) ];
7+ packages.unix.patches = [ ({ version, revision }: if version == "2.7.2.2" && revision == 0 then ./unix-2.7.2.2.patch else null) ];
8}
8}
patches/ghc865/default.nix+1−1
@@ -3,6 +3,6 @@
3 packages.containers.patches = [ ({ version, revision }: if version == "0.6.0.1" && revision == 0 then ./containers-0.6.0.1.patch else null) ];
3 packages.containers.patches = [ ({ version, revision }: if version == "0.6.0.1" && revision == 0 then ./containers-0.6.0.1.patch else null) ];
4 packages.hpc.patches = [ ({ version, revision }: if version == "0.6.0.3" && revision == 0 then ./hpc-0.6.0.3.patch else null) ];
4 packages.hpc.patches = [ ({ version, revision }: if version == "0.6.0.3" && revision == 0 then ./hpc-0.6.0.3.patch else null) ];
5 packages.parsec.patches = [ ({ version, revision }: if version == "3.1.13.0" && revision == 0 then ./parsec-3.1.13.0.patch else null) ];
5 packages.parsec.patches = [ ({ version, revision }: if version == "3.1.13.0" && revision == 0 then ./parsec-3.1.13.0.patch else null) ];
6− packages.unix.patches = [ ({ version, revision }: if version == "2.7.2.2" && revision == 0 then ./unix-2.7.2.2.patch else null) ];
7 packages.singletons.patches = [ ({ version, revision }: if version == "2.5.1" && revision == 0 then ./singletons-2.5.1.patch else null) ];
6 packages.singletons.patches = [ ({ version, revision }: if version == "2.5.1" && revision == 0 then ./singletons-2.5.1.patch else null) ];
7+ packages.unix.patches = [ ({ version, revision }: if version == "2.7.2.2" && revision == 0 then ./unix-2.7.2.2.patch else null) ];
8}
8}
patches/js-ghc8107/buffer-builder.patchnew file+79
@@ -0,0 +1,79 @@
1+From ece29d689b56e51b22b39c8d0b8740e325830f23 Mon Sep 17 00:00:00 2001
2+From: Luigy Leon <luigy@outlook.com>
3+Date: Fri, 6 Oct 2017 18:39:35 -0400
4+Subject: [PATCH] text-jsstring
5+
6+---
7+ buffer-builder.cabal | 3 +++
8+ src/Data/BufferBuilder.hs | 25 +++++++++++++++++++++++--
9+ 2 files changed, 26 insertions(+), 2 deletions(-)
10+
11+diff --git a/buffer-builder.cabal b/buffer-builder.cabal
12+index fe24f73..868d3c1 100644
13+--- a/buffer-builder.cabal
14++++ b/buffer-builder.cabal
15+@@ -65,6 +65,9 @@ library
16+ if !impl(ghc >= 8.0)
17+ build-depends: semigroups
18+
19++ if impl(ghcjs)
20++ build-depends: ghcjs-base
21++
22+ default-language: Haskell2010
23+ ghc-options: -O2 -Wall
24+ --ghc-options: -ddump-ds -ddump-simpl -ddump-stg -ddump-opt-cmm -ddump-asm -ddump-to-file
25+diff --git a/src/Data/BufferBuilder.hs b/src/Data/BufferBuilder.hs
26+index 30b39ce..0468afb 100644
27+--- a/src/Data/BufferBuilder.hs
28++++ b/src/Data/BufferBuilder.hs
29+@@ -1,4 +1,7 @@
30+-{-# LANGUAGE OverloadedStrings, MagicHash, BangPatterns, RecordWildCards, DeriveDataTypeable #-}
31++{-# LANGUAGE OverloadedStrings, MagicHash, BangPatterns, RecordWildCards, DeriveDataTypeable, CPP #-}
32++#ifdef ghcjs_HOST_OS
33++{-# LANGUAGE UnboxedTuples, ForeignFunctionInterface, UnliftedFFITypes #-}
34++#endif
35+
36+ {-|
37+ A library for efficiently building up a buffer of data. When given data
38+@@ -71,6 +74,9 @@ import Data.Typeable (Typeable)
39+ import Data.Text () -- Show
40+ import Data.Text.Internal (Text (..))
41+ import Data.Text.Array (Array (..))
42++#ifdef ghcjs_HOST_OS
43++import Data.JSString
44++#endif
45+
46+ data Handle'
47+ type Handle = Ptr Handle'
48+@@ -349,8 +355,17 @@ appendEscapedJsonLiteral addr =
49+ {-# INLINE appendEscapedJsonLiteral #-}
50+
51+ appendEscapedJsonText :: Text -> BufferBuilder ()
52++#ifndef ghcjs_HOST_OS
53+ appendEscapedJsonText !(Text arr ofs len) =
54+- let byteArray = aBA arr
55++ let
56++#else
57++appendEscapedJsonText !(Text t) =
58++ let (# ba#, len# #) = js_fromString t
59++ len = I# len#
60++ arr = Array ba#
61++ ofs = 0
62++#endif
63++ byteArray = aBA arr
64+ in withHandle $ \h ->
65+ bw_append_json_escaped_utf16 h len (Ptr (byteArrayContents# byteArray) `plusPtr` (2 * ofs))
66+ {-# INLINE appendEscapedJsonText #-}
67+@@ -364,3 +379,9 @@ appendUrlEncoded !(BS.PS (ForeignPtr addr _) offset len) =
68+ withHandle $ \h ->
69+ bw_append_url_encoded h len (plusPtr (Ptr addr) offset)
70+ {-# INLINE appendUrlEncoded #-}
71++
72++#ifdef ghcjs_HOST_OS
73++foreign import javascript unsafe
74++ "h$textFromString"
75++ js_fromString :: JSString -> (# ByteArray#, Int# #)
76++#endif
77+--
78+2.31.1
79+
patches/js-ghc8107/conduit-extra.patchnew file+48
@@ -0,0 +1,48 @@
1+diff --git a/Data/Conduit/Attoparsec.hs b/Data/Conduit/Attoparsec.hs
2+index bd889f8..a620675 100644
3+--- a/Data/Conduit/Attoparsec.hs
4++++ b/Data/Conduit/Attoparsec.hs
5+@@ -1,4 +1,5 @@
6+ {-# LANGUAGE BangPatterns #-}
7++{-# LANGUAGE CPP #-}
8+ {-# LANGUAGE DeriveDataTypeable #-}
9+ {-# LANGUAGE FlexibleContexts #-}
10+ {-# LANGUAGE RankNTypes #-}
11+@@ -33,6 +34,9 @@ import qualified Data.Text as T
12+ import qualified Data.Text.Internal as TI
13+ import Data.Typeable (Typeable)
14+ import Prelude hiding (lines)
15++#ifdef __GHCJS__
16++import qualified Data.JSString.Raw as JSS
17++#endif
18+
19+ import qualified Data.Attoparsec.ByteString
20+ import qualified Data.Attoparsec.Text
21+@@ -105,8 +109,13 @@ instance AttoparsecInput T.Text where
22+ f (Position l c o) ch
23+ | ch == '\n' = Position (l + 1) 0 (o + 1)
24+ | otherwise = Position l (c + 1) (o + 1)
25++#ifndef __GHCJS__
26+ stripFromEnd (TI.Text arr1 off1 len1) (TI.Text _ _ len2) =
27+ TI.text arr1 off1 (len1 - len2)
28++#else
29++ stripFromEnd (TI.Text str1) (TI.Text str2) =
30++ TI.Text $ JSS.rawDropEnd (JSS.rawLength str1 - JSS.rawLength str2) str1
31++#endif
32+
33+ -- | Convert an Attoparsec 'A.Parser' into a 'Sink'. The parser will
34+ -- be streamed bytes until it returns 'A.Done' or 'A.Fail'.
35+diff --git a/conduit-extra.cabal b/conduit-extra.cabal
36+index f6dfe7a..b5b2515 100644
37+--- a/conduit-extra.cabal
38++++ b/conduit-extra.cabal
39+@@ -58,6 +58,9 @@ Library
40+ , unliftio-core
41+ , typed-process >= 0.2
42+
43++ if impl(ghcjs)
44++ Build-depends: ghcjs-base
45++
46+ ghc-options: -Wall
47+
48+ test-suite test
patches/js-ghc8107/default.nixnew file+7
@@ -0,0 +1,7 @@
1+{
2+ packages.buffer-builder.patches = [ ({ version, revision }: ./buffer-builder.patch) ];
3+ packages.conduit-extra.patches = [ ({ version, revision }: ./conduit-extra.patch) ];
4+ packages.double-conversion.patches = [ ({ version, revision }: ./double-conversion.patch) ];
5+ packages.network.patches = [ ({ version, revision }: ./network.patch) ];
6+ packages.say.patches = [ ({ version, revision }: ./say.patch) ];
7+}
patches/js-ghc8107/double-conversion.patchnew file+64
@@ -0,0 +1,64 @@
1+From 0f9ddde468687d25fa6c4c9accb02a034bc2f9c3 Mon Sep 17 00:00:00 2001
2+From: Luigy Leon <luigy@outlook.com>
3+Date: Thu, 1 Dec 2016 12:43:59 -0500
4+Subject: [PATCH] Add text jsstring support for ghcjs.
5+
6+---
7+ Data/Double/Conversion/Text.hs | 17 +++++++++++++++--
8+ double-conversion.cabal | 4 ++++
9+ 2 files changed, 19 insertions(+), 2 deletions(-)
10+
11+diff --git a/Data/Double/Conversion/Text.hs b/Data/Double/Conversion/Text.hs
12+index 2e89705..3b315a7 100644
13+--- a/Data/Double/Conversion/Text.hs
14++++ b/Data/Double/Conversion/Text.hs
15+@@ -1,4 +1,4 @@
16+-{-# LANGUAGE CPP, MagicHash, Rank2Types #-}
17++{-# LANGUAGE CPP, MagicHash, Rank2Types, ForeignFunctionInterface, UnliftedFFITypes #-}
18+
19+ -- |
20+ -- Module : Data.Double.Conversion.Text
21+@@ -33,7 +33,12 @@ import Control.Monad.ST (runST)
22+ import Data.Double.Conversion.FFI
23+ import Data.Text.Internal (Text(Text))
24+ import Foreign.C.Types (CDouble, CInt)
25+-import GHC.Prim (MutableByteArray#)
26++#ifndef __GHCJS__
27++import GHC.Prim (MutableByteArray#, ByteArray#)
28++#else
29++import GHC.Prim (MutableByteArray#, Int#, ByteArray#)
30++import Data.JSString
31++#endif
32+ import qualified Data.Text.Array as A
33+
34+ -- | Compute a representation in exponential format with the requested
35+@@ -81,4 +86,12 @@ convert func len act val = runST go
36+ fail $ "Data.Double.Conversion.Text." ++ func ++
37+ ": conversion failed (invalid precision requested)"
38+ frozen <- A.unsafeFreeze buf
39++#ifndef __GHCJS__
40+ return $ Text frozen 0 (fromIntegral size)
41++#else
42++ return $ Text $ js_toString (A.aBA frozen) 0# (fromIntegral size)
43++
44++foreign import javascript unsafe
45++ "h$textToString"
46++ js_toString :: ByteArray# -> Int# -> Int -> JSString
47++#endif
48+diff --git a/double-conversion.cabal b/double-conversion.cabal
49+index d177d3f..5f0527f 100644
50+--- a/double-conversion.cabal
51++++ b/double-conversion.cabal
52+@@ -90,6 +90,10 @@ library
53+ ghc-prim,
54+ text >= 0.11.0.8
55+
56++ if impl(ghcjs)
57++ build-depends:
58++ ghcjs-base
59++
60+ if flag(developer)
61+ ghc-options: -Werror
62+ ghc-prof-options: -auto-all
63+--
64+2.31.1
patches/js-ghc8107/network.patchnew file+16
@@ -0,0 +1,16 @@
1+diff --git a/Network/Socket.hsc b/Network/Socket.hsc
2+index 4edebd4..43ecdb7 100644
3+--- a/Network/Socket.hsc
4++++ b/Network/Socket.hsc
5+@@ -479,11 +479,7 @@ setNonBlockIfNeeded fd =
6+ --
7+ -- Since 2.7.0.0.
8+ setCloseOnExecIfNeeded :: CInt -> IO ()
9+-#if defined(mingw32_HOST_OS)
10+ setCloseOnExecIfNeeded _ = return ()
11+-#else
12+-setCloseOnExecIfNeeded fd = System.Posix.Internals.setCloseOnExec fd
13+-#endif
14+
15+ #if !defined(mingw32_HOST_OS)
16+ foreign import ccall unsafe "fcntl"
patches/js-ghc8107/say.patchnew file+22
@@ -0,0 +1,22 @@
1+diff --git a/src/Say.hs b/src/Say.hs
2+index a1f6802..fd9145d 100644
3+--- a/src/Say.hs
4++++ b/src/Say.hs
5+@@ -146,7 +146,7 @@ hSay h msg =
6+ return new_buf
7+
8+ writeBlocksRaw :: Buffer CharBufElem -> Stream Char -> IO ()
9+- writeBlocksRaw buf0 (Stream next0 s0 _len) =
10++ writeBlocksRaw buf0 (Stream next0 s0) =
11+ outer s0 buf0
12+ where
13+ outer s1 Buffer{bufRaw=raw, bufSize=len} =
14+@@ -168,7 +168,7 @@ hSay h msg =
15+ flush = commit n True{-needs flush-} False{-don't release-} >>= outer s
16+
17+ writeBlocksCRLF :: Buffer CharBufElem -> Stream Char -> IO ()
18+- writeBlocksCRLF buf0 (Stream next0 s0 _len) =
19++ writeBlocksCRLF buf0 (Stream next0 s0) =
20+ outer s0 buf0
21+ where
22+ outer s1 Buffer{bufRaw=raw, bufSize=len} =
patches/update-patches.sh+6−2
@@ -1,11 +1,15 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2−for ghc in $(find . -name "ghc*" -type d | sort); do
2+for ghc in $(find . -maxdepth 1 -mindepth 1 -type d | sort); do
3 (cd $ghc
3 (cd $ghc
4 echo "{" > default.nix
4 echo "{" > default.nix
5 (for a in $(find . -name "*.patch" -type f | sort); do
5 (for a in $(find . -name "*.patch" -type f | sort); do
6 b=${a%%.patch};
6 b=${a%%.patch};
7 b=${b##./};
7 b=${b##./};
8+ if [[ "$ghc" =~ js- ]]; then
9+ echo " packages.$b.patches = [ ({ version, revision }: $a) ];" >> default.nix
10+ else
8− echo " packages.${b%%-*}.patches = [ ({ version, revision }: if version == \"${b##*-}\" && revision == 0 then $a else null) ];" >> default.nix
11+ echo " packages.${b%%-*}.patches = [ ({ version, revision }: if version == \"${b##*-}\" && revision == 0 then $a else null) ];" >> default.nix
12+ fi
9 done) || true
13 done) || true
10 echo "}" >> default.nix)
14 echo "}" >> default.nix)
11done
15done