diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-07-07 08:53:40 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-07-27 12:01:51 -0400 |
commit | 8e43dc90e775f18b6c3d4e6630936ecdbb352e78 (patch) | |
tree | d759ca821051c1cfd5aa881f0920f919a7e32811 | |
parent | e4c252619ebb0b10db9061b052ddce6f8f2b5c72 (diff) | |
download | haskell-8e43dc90e775f18b6c3d4e6630936ecdbb352e78.tar.gz |
hadrian: Update hsc2hs wrapper to match current master
-rw-r--r-- | hadrian/src/Rules/BinaryDist.hs | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/hadrian/src/Rules/BinaryDist.hs b/hadrian/src/Rules/BinaryDist.hs index d0d98aba3c..9a52b0cec0 100644 --- a/hadrian/src/Rules/BinaryDist.hs +++ b/hadrian/src/Rules/BinaryDist.hs @@ -325,26 +325,12 @@ hsc2hsWrapper :: Action String hsc2hsWrapper = do ccArgs <- map ("--cflag=" <>) <$> settingList (ConfCcArgs Stage1) ldFlags <- map ("--lflag=" <>) <$> settingList (ConfGccLinkerArgs Stage1) + wrapper <- drop 4 . lines <$> liftIO (readFile "utils/hsc2hs/hsc2hs.wrapper") return $ unlines - [ "HSC2HS_EXTRA=\"" <> unwords ccArgs <> unwords ldFlags <> "\"" - , "tflag=\"--template=$libdir/template-hsc.h\"" - , "Iflag=\"-I$includedir/\"" - , "for arg do" - , " case \"$arg\" in" - , "# On OS X, we need to specify -m32 or -m64 in order to get gcc to" - , "# build binaries for the right target. We do that by putting it in" - , "# HSC2HS_EXTRA. When cabal runs hsc2hs, it passes a flag saying which" - , "# gcc to use, so if we set HSC2HS_EXTRA= then we don't get binaries" - , "# for the right platform. So for now we just don't set HSC2HS_EXTRA=" - , "# but we probably want to revisit how this works in the future." - , "# -c*) HSC2HS_EXTRA=;;" - , "# --cc=*) HSC2HS_EXTRA=;;" - , " -t*) tflag=;;" - , " --template=*) tflag=;;" - , " --) break;;" - , " esac" - , "done" - , "exec \"$executablename\" ${tflag:+\"$tflag\"} $HSC2HS_EXTRA ${1+\"$@\"} \"$Iflag\"" ] + ( "HSC2HS_EXTRA=\"" <> unwords ccArgs <> unwords ldFlags <> "\"" + : "tflag=\"--template=$libdir/template-hsc.h\"" + : "Iflag=\"-I$includedir/\"" + : wrapper ) runGhcWrapper :: Action String runGhcWrapper = pure $ "exec \"$executablename\" -f \"$exedir/ghc\" ${1+\"$@\"}\n" |