-
Notifications
You must be signed in to change notification settings - Fork 1
Description
GHC has been a single-target compiler for now. This has meant that we needed to compile a new compiler for each target; over time this becomes increasingly complicated, and annoying as we rebuild the same code multiple times. @hsyl20 has been working on lifting GHC defines, and other hard coded conditionals in GHC to be able to introduce a target selction flag to GHC, based on a separate settings file.
-target
was implemented in: fbdb38d- Listing targets was implemented in: a9a88e5
- We can also get the target from the executable prefix: 814aadb, 8df59de, 14bbfb8, 66ee4f8
The easiest cross compiler is the JavaScript cross compiler for now (doesn't need extensive iserv logic).
- Build GHC.
- Symlink javascript-unknown-ghcjs-ghc to ghc executable.
- Test that javascript-unknown-ghcjs-ghc compiles Hello.hs properly.
- Try a more involved example that requires our cabal-install build, and using javascript-unknown-ghcjs-ghc-pkg, and javascript-unknown-ghcjs-ghc. There are bugs here, we probably need to teach ghc-pkg about -target (as well as the symlink logic as well, to find the proper settings).
- Discover all issues, catalogue them, and fix them.
EDIT: Generally we want to follow existing conventions of -. This will also make integration into cabal-install easier for now. Having an explicit -target flag is good to have though!
NOTE: We do want to get rid of the whole -B nonsense as well. Yes this will still be required for OSs that can't figure out the location of an executable, but for windows, linux, macos, and bsd the current logic where bin/ghc can figure out it's location and locate ../lib/settings, ... without an annoying wrapper script is the preferred way to go.
See #34 for the pull request that includes all the necessary commits (see above) from https://github.com/hsyl20/ghc/tree/hsyl20/multi-target.