@@ -523,7 +523,8 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do
523523 comp = compiler lbi
524524 ghcVersion = compilerVersion comp
525525 implInfo = getImplInfo comp
526- platform@ (Platform _hostArch hostOS) = hostPlatform lbi
526+ platform@ (Platform hostArch hostOS) = hostPlatform lbi
527+ hasJsSupport = hostArch == JavaScript
527528 has_code = not (componentIsIndefinite clbi)
528529
529530 relLibTargetDir <- makeRelativeToCurrentDirectory libTargetDir
@@ -567,11 +568,13 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do
567568 , toNubListR (cxxSources libBi)
568569 , toNubListR (cmmSources libBi)
569570 , toNubListR (asmSources libBi)
570- , toNubListR (jsSources libBi)
571+ , if hasJsSupport
571572 -- JS files are C-like with GHC's JS backend: they are
572573 -- "compiled" into `.o` files (renamed with a header).
573574 -- This is a difference from GHCJS, for which we only
574575 -- pass the JS files at link time.
576+ then toNubListR (jsSources libBi)
577+ else mempty
575578 ]
576579 cLikeObjs = map (`replaceExtension` objExtension) cLikeSources
577580 baseOpts = componentGhcOptions verbosity lbi libBi clbi libTargetDir
@@ -730,7 +733,7 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do
730733 | filename <- cSources libBi]
731734
732735 -- build any JS sources
733- unless (not has_code || null (jsSources libBi)) $ do
736+ unless (not has_code || not hasJsSupport || null (jsSources libBi)) $ do
734737 info verbosity " Building JS Sources..."
735738 sequence_
736739 [ do let vanillaJsOpts = Internal. componentJsGhcOptions verbosity implInfo
@@ -2087,7 +2090,10 @@ installLib verbosity lbi targetDir dynlibTargetDir _builtDir pkg lib clbi = do
20872090 && null (cxxSources (libBuildInfo lib))
20882091 && null (cmmSources (libBuildInfo lib))
20892092 && 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
20912097 has_code = not (componentIsIndefinite clbi)
20922098 whenHasCode = when has_code
20932099 whenVanilla = when (hasLib && withVanillaLib lbi)
0 commit comments