Skip to content

Commit 03becbd

Browse files
committed
Enable ghcjs' -build-runner explicitly for exe/test/benches
This way, we automatically gain *some* level of support for `build-tools-depends` as well as for `v2-install` for applications which are executed via nodejs For instance, the following now works: $ cabal v2-install -w /opt/ghcjs/8.4/bin/ghcjs --ghcjs alex --symlink-bindir=/tmp/bin Resolving dependencies... Build profile: -w ghcjs-8.4.0.1 -O1 In order, the following will be built (use -v for more details): - alex-3.2.4 (exe:alex) (requires build) Starting alex-3.2.4 (exe:alex) Building alex-3.2.4 (exe:alex) Installing alex-3.2.4 (exe:alex) Completed alex-3.2.4 (exe:alex) Symlinking 'alex' $ file - < /tmp/bin/alex /dev/stdin: a /usr/bin/nodejs script, UTF-8 Unicode text executable $ /tmp/bin/alex --version Alex version 3.2.4, (c) 2003 Chris Dornan and Simon Marlow This is the best we can without teaching cabal about cross-compilation and distinguishing local native executables (build by a native-targetting haskell compiler) for build-tools/custom-setup vs the main compilation goals for the target platform (which is build with a haskell cross-compiler).
1 parent decec31 commit 03becbd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Cabal/Distribution/Simple/GHCJS.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,11 @@ buildOrReplExe mReplFlags verbosity numJobs _pkg_descr lbi
563563
let isGhcjsDynamic = isDynamic comp
564564
dynamicTooSupported = supportsDynamicToo comp
565565
buildRunner = case clbi of
566-
ExeComponentLocalBuildInfo {} -> False
567-
_ -> True
566+
LibComponentLocalBuildInfo {} -> False
567+
FLibComponentLocalBuildInfo {} -> False
568+
ExeComponentLocalBuildInfo {} -> True
569+
TestComponentLocalBuildInfo {} -> True
570+
BenchComponentLocalBuildInfo {} -> True
568571
isHaskellMain = elem (takeExtension srcMainFile) [".hs", ".lhs"]
569572
jsSrcs = jsSources exeBi
570573
cSrcs = cSources exeBi ++ [srcMainFile | not isHaskellMain]

0 commit comments

Comments
 (0)