@@ -809,49 +809,46 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do
809
809
whenProfLib (runGhcProg profOpts)
810
810
811
811
let
812
- buildExtraSources mkSrcOpts wantDyn srcs =
813
- sequence_
814
- [ do
815
- let baseSrcOpts =
816
- mkSrcOpts
817
- verbosity
818
- implInfo
819
- lbi
820
- libBi
821
- clbi
822
- relLibTargetDir
823
- filename
824
- vanillaSrcOpts
825
- -- Dynamic GHC requires C sources to be built
826
- -- with -fPIC for REPL to work. See #2207.
827
- | isGhcDynamic && wantDyn = baseSrcOpts{ghcOptFPic = toFlag True }
828
- | otherwise = baseSrcOpts
829
- runGhcProgIfNeeded opts = do
830
- needsRecomp <- checkNeedsRecompilation filename opts
831
- when needsRecomp $ runGhcProg opts
832
- profSrcOpts =
833
- vanillaSrcOpts
834
- `mappend` mempty
835
- { ghcOptProfilingMode = toFlag True
836
- , ghcOptObjSuffix = toFlag " p_o"
837
- }
838
- sharedSrcOpts =
839
- vanillaSrcOpts
840
- `mappend` mempty
841
- { ghcOptFPic = toFlag True
842
- , ghcOptDynLinkMode = toFlag GhcDynamicOnly
843
- , ghcOptObjSuffix = toFlag " dyn_o"
844
- }
845
- odir = fromFlag (ghcOptObjDir vanillaSrcOpts)
846
-
847
- createDirectoryIfMissingVerbose verbosity True odir
848
- runGhcProgIfNeeded vanillaSrcOpts
849
- unless (forRepl || not wantDyn) $
850
- whenSharedLib forceSharedLib (runGhcProgIfNeeded sharedSrcOpts)
851
- unless forRepl $
852
- whenProfLib (runGhcProgIfNeeded profSrcOpts)
853
- | filename <- srcs
854
- ]
812
+ buildExtraSources mkSrcOpts wantDyn = traverse_ $ buildExtraSource mkSrcOpts wantDyn
813
+ buildExtraSource mkSrcOpts wantDyn filename = do
814
+ let baseSrcOpts =
815
+ mkSrcOpts
816
+ verbosity
817
+ implInfo
818
+ lbi
819
+ libBi
820
+ clbi
821
+ relLibTargetDir
822
+ filename
823
+ vanillaSrcOpts
824
+ -- Dynamic GHC requires C sources to be built
825
+ -- with -fPIC for REPL to work. See #2207.
826
+ | isGhcDynamic && wantDyn = baseSrcOpts{ghcOptFPic = toFlag True }
827
+ | otherwise = baseSrcOpts
828
+ runGhcProgIfNeeded opts = do
829
+ needsRecomp <- checkNeedsRecompilation filename opts
830
+ when needsRecomp $ runGhcProg opts
831
+ profSrcOpts =
832
+ vanillaSrcOpts
833
+ `mappend` mempty
834
+ { ghcOptProfilingMode = toFlag True
835
+ , ghcOptObjSuffix = toFlag " p_o"
836
+ }
837
+ sharedSrcOpts =
838
+ vanillaSrcOpts
839
+ `mappend` mempty
840
+ { ghcOptFPic = toFlag True
841
+ , ghcOptDynLinkMode = toFlag GhcDynamicOnly
842
+ , ghcOptObjSuffix = toFlag " dyn_o"
843
+ }
844
+ odir = fromFlag (ghcOptObjDir vanillaSrcOpts)
845
+
846
+ createDirectoryIfMissingVerbose verbosity True odir
847
+ runGhcProgIfNeeded vanillaSrcOpts
848
+ unless (forRepl || not wantDyn) $
849
+ whenSharedLib forceSharedLib (runGhcProgIfNeeded sharedSrcOpts)
850
+ unless forRepl $
851
+ whenProfLib (runGhcProgIfNeeded profSrcOpts)
855
852
856
853
-- Build any C++ sources separately.
857
854
unless (not has_code || null (cxxSources libBi)) $ do
@@ -1762,50 +1759,48 @@ gbuild verbosity numJobs pkg_descr lbi bm clbi = do
1762
1759
}
1763
1760
1764
1761
let
1765
- buildExtraSources mkSrcOpts wantDyn srcs =
1766
- sequence_
1767
- [ do
1768
- let baseSrcOpts =
1769
- mkSrcOpts
1770
- verbosity
1771
- implInfo
1772
- lbi
1773
- bnfo
1774
- clbi
1775
- tmpDir
1776
- filename
1777
- vanillaSrcOpts =
1778
- if isGhcDynamic && wantDyn
1779
- then -- Dynamic GHC requires C/C++ sources to be built
1780
- -- with -fPIC for REPL to work. See #2207.
1781
- baseSrcOpts{ghcOptFPic = toFlag True }
1782
- else baseSrcOpts
1783
- profSrcOpts =
1784
- vanillaSrcOpts
1785
- `mappend` mempty
1786
- { ghcOptProfilingMode = toFlag True
1787
- }
1788
- sharedSrcOpts =
1789
- vanillaSrcOpts
1790
- `mappend` mempty
1791
- { ghcOptFPic = toFlag True
1792
- , ghcOptDynLinkMode = toFlag GhcDynamicOnly
1793
- }
1794
- opts
1795
- | needProfiling = profSrcOpts
1796
- | needDynamic && wantDyn = sharedSrcOpts
1797
- | otherwise = vanillaSrcOpts
1798
- -- TODO: Placing all Haskell, C, & C++ objects in a single directory
1799
- -- Has the potential for file collisions. In general we would
1800
- -- consider this a user error. However, we should strive to
1801
- -- add a warning if this occurs.
1802
- odir = fromFlag (ghcOptObjDir opts)
1803
- createDirectoryIfMissingVerbose verbosity True odir
1804
- needsRecomp <- checkNeedsRecompilation filename opts
1805
- when needsRecomp $
1806
- runGhcProg opts
1807
- | filename <- srcs
1808
- ]
1762
+ buildExtraSources mkSrcOpts wantDyn = traverse_ $ buildExtraSource mkSrcOpts wantDyn
1763
+ buildExtraSource mkSrcOpts wantDyn filename = do
1764
+ let baseSrcOpts =
1765
+ mkSrcOpts
1766
+ verbosity
1767
+ implInfo
1768
+ lbi
1769
+ bnfo
1770
+ clbi
1771
+ tmpDir
1772
+ filename
1773
+ vanillaSrcOpts =
1774
+ if isGhcDynamic && wantDyn
1775
+ then -- Dynamic GHC requires C/C++ sources to be built
1776
+ -- with -fPIC for REPL to work. See #2207.
1777
+ baseSrcOpts{ghcOptFPic = toFlag True }
1778
+ else baseSrcOpts
1779
+ profSrcOpts =
1780
+ vanillaSrcOpts
1781
+ `mappend` mempty
1782
+ { ghcOptProfilingMode = toFlag True
1783
+ }
1784
+ sharedSrcOpts =
1785
+ vanillaSrcOpts
1786
+ `mappend` mempty
1787
+ { ghcOptFPic = toFlag True
1788
+ , ghcOptDynLinkMode = toFlag GhcDynamicOnly
1789
+ }
1790
+ opts
1791
+ | needProfiling = profSrcOpts
1792
+ | needDynamic && wantDyn = sharedSrcOpts
1793
+ | otherwise = vanillaSrcOpts
1794
+ -- TODO: Placing all Haskell, C, & C++ objects in a single directory
1795
+ -- Has the potential for file collisions. In general we would
1796
+ -- consider this a user error. However, we should strive to
1797
+ -- add a warning if this occurs.
1798
+ odir = fromFlag (ghcOptObjDir opts)
1799
+
1800
+ createDirectoryIfMissingVerbose verbosity True odir
1801
+ needsRecomp <- checkNeedsRecompilation filename opts
1802
+ when needsRecomp $
1803
+ runGhcProg opts
1809
1804
1810
1805
-- build any C++ sources
1811
1806
unless (null cxxSrcs) $ do
@@ -1818,17 +1813,17 @@ gbuild verbosity numJobs pkg_descr lbi bm clbi = do
1818
1813
buildExtraSources Internal. componentCcGhcOptions True cSrcs
1819
1814
1820
1815
-- build any JS sources
1821
- unless (not hasJsSupport || null (jsSourceFiles buildSources) ) $ do
1816
+ unless (not hasJsSupport || null jsSrcs ) $ do
1822
1817
info verbosity " Building JS Sources..."
1823
1818
buildExtraSources Internal. componentJsGhcOptions False jsSrcs
1824
1819
1825
1820
-- build any ASM sources
1826
- unless (null $ asmSourceFiles buildSources ) $ do
1821
+ unless (null asmSrcs ) $ do
1827
1822
info verbosity " Building Assembler Sources..."
1828
1823
buildExtraSources Internal. componentAsmGhcOptions True asmSrcs
1829
1824
1830
1825
-- build any Cmm sources
1831
- unless (null $ cmmSourceFiles buildSources ) $ do
1826
+ unless (null cmmSrcs ) $ do
1832
1827
info verbosity " Building C-- Sources..."
1833
1828
buildExtraSources Internal. componentCmmGhcOptions True cmmSrcs
1834
1829
0 commit comments