@@ -629,14 +629,36 @@ configureOptsNoDir econfig bco deps isLocal package = concat
629
629
flagNameString name)
630
630
(Map. toList flags)
631
631
, map T. unpack $ packageCabalConfigOpts package
632
- , concatMap ( \ x -> [compilerOptionsCabalFlag wc, T. unpack x]) (packageGhcOptions package)
632
+ , processGhcOptions (packageGhcOptions package)
633
633
, map (" --extra-include-dirs=" ++ ) (configExtraIncludeDirs config)
634
634
, map (" --extra-lib-dirs=" ++ ) (configExtraLibDirs config)
635
635
, maybe [] (\ customGcc -> [" --with-gcc=" ++ toFilePath customGcc]) (configOverrideGccPath config)
636
636
, [" --exact-configuration" ]
637
637
, [" --ghc-option=-fhide-source-paths" | hideSourcePaths cv]
638
638
]
639
639
where
640
+ processGhcOptions :: [Text ] -> [String ]
641
+ processGhcOptions (" +RTS" : xs) =
642
+ let
643
+ (rtsArgs, rest) =
644
+ takeRtsArgs xs
645
+ in
646
+ (" --ghc-options=+RTS " ++ rtsArgs) : processGhcOptions rest
647
+ processGhcOptions (x : xs) =
648
+ [compilerOptionsCabalFlag wc, T. unpack x] ++ processGhcOptions xs
649
+ processGhcOptions [] =
650
+ []
651
+ takeRtsArgs :: [Text ] -> (String , [Text ])
652
+ takeRtsArgs (" -RTS" : xs) =
653
+ (" -RTS" , xs)
654
+ takeRtsArgs (x : xs) =
655
+ let
656
+ (other, rest) =
657
+ takeRtsArgs xs
658
+ in
659
+ (T. unpack x ++ " " ++ other, rest)
660
+ takeRtsArgs [] =
661
+ ([] , [] )
640
662
wc = view (actualCompilerVersionL. to whichCompiler) econfig
641
663
cv = view (actualCompilerVersionL. to getGhcVersion) econfig
642
664
0 commit comments