@@ -523,7 +523,8 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do
523
523
comp = compiler lbi
524
524
ghcVersion = compilerVersion comp
525
525
implInfo = getImplInfo comp
526
- platform@ (Platform _hostArch hostOS) = hostPlatform lbi
526
+ platform@ (Platform hostArch hostOS) = hostPlatform lbi
527
+ hasJsSupport = hostArch == JavaScript
527
528
has_code = not (componentIsIndefinite clbi)
528
529
529
530
relLibTargetDir <- makeRelativeToCurrentDirectory libTargetDir
@@ -567,11 +568,13 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do
567
568
, toNubListR (cxxSources libBi)
568
569
, toNubListR (cmmSources libBi)
569
570
, toNubListR (asmSources libBi)
570
- , toNubListR (jsSources libBi)
571
+ , if hasJsSupport
571
572
-- JS files are C-like with GHC's JS backend: they are
572
573
-- "compiled" into `.o` files (renamed with a header).
573
574
-- This is a difference from GHCJS, for which we only
574
575
-- pass the JS files at link time.
576
+ then toNubListR (jsSources libBi)
577
+ else mempty
575
578
]
576
579
cLikeObjs = map (`replaceExtension` objExtension) cLikeSources
577
580
baseOpts = componentGhcOptions verbosity lbi libBi clbi libTargetDir
@@ -730,7 +733,7 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do
730
733
| filename <- cSources libBi]
731
734
732
735
-- build any JS sources
733
- unless (not has_code || null (jsSources libBi)) $ do
736
+ unless (not has_code || not hasJsSupport || null (jsSources libBi)) $ do
734
737
info verbosity " Building JS Sources..."
735
738
sequence_
736
739
[ do let vanillaJsOpts = Internal. componentJsGhcOptions verbosity implInfo
@@ -2087,7 +2090,10 @@ installLib verbosity lbi targetDir dynlibTargetDir _builtDir pkg lib clbi = do
2087
2090
&& null (cxxSources (libBuildInfo lib))
2088
2091
&& null (cmmSources (libBuildInfo lib))
2089
2092
&& null (asmSources (libBuildInfo lib))
2090
- && null (jsSources (libBuildInfo lib))
2093
+ && (null (jsSources (libBuildInfo lib)) || not hasJsSupport)
2094
+ hasJsSupport = case hostPlatform lbi of
2095
+ Platform JavaScript _ -> True
2096
+ _ -> False
2091
2097
has_code = not (componentIsIndefinite clbi)
2092
2098
whenHasCode = when has_code
2093
2099
whenVanilla = when (hasLib && withVanillaLib lbi)
0 commit comments