Skip to content
Snippets Groups Projects
Commit db954955 authored by Cheng Shao's avatar Cheng Shao Committed by Zubin
Browse files

hadrian: fix bindist executable wrapper logic for cross targets

This commit fixes an oversight of hadrian wrapper generation logic:
when doing cross compilation, `wrapper` is called on executable names
with cross prefix, therefore we must use `isSuffixOf` when matching to
take the cross prefix into account. Also add missing cross prefix to
ghci wrapper content and fix hsc2hs wrapper logic.

(cherry picked from commit edc02197)
parent 6509bb40
No related branches found
No related tags found
No related merge requests found
...@@ -243,7 +243,7 @@ install_wrappers: install_bin_libdir install_hsc2hs_wrapper ...@@ -243,7 +243,7 @@ install_wrappers: install_bin_libdir install_hsc2hs_wrapper
.PHONY: install_hsc2hs_wrapper .PHONY: install_hsc2hs_wrapper
install_hsc2hs_wrapper: install_hsc2hs_wrapper:
@echo Copying hsc2hs wrapper @echo Copying hsc2hs wrapper
cp mk/hsc2hs wrappers/hsc2hs-ghc-$(ProjectVersion) cp mk/hsc2hs wrappers/$(CrossCompilePrefix)hsc2hs-ghc-$(ProjectVersion)
PKG_CONFS = $(shell find "$(DESTDIR)$(ActualLibsDir)/package.conf.d" -name '*.conf' | sed "s: :\0xxx\0:g") PKG_CONFS = $(shell find "$(DESTDIR)$(ActualLibsDir)/package.conf.d" -name '*.conf' | sed "s: :\0xxx\0:g")
.PHONY: update_package_db .PHONY: update_package_db
......
...@@ -437,13 +437,14 @@ pkgToWrappers pkg = do ...@@ -437,13 +437,14 @@ pkgToWrappers pkg = do
| otherwise -> pure [] | otherwise -> pure []
wrapper :: FilePath -> Action String wrapper :: FilePath -> Action String
wrapper "ghc" = ghcWrapper wrapper wrapper_name
wrapper "ghc-pkg" = ghcPkgWrapper | "runghc" `isSuffixOf` wrapper_name = runGhcWrapper
wrapper "ghci" = ghciScriptWrapper | "ghc" `isSuffixOf` wrapper_name = ghcWrapper
wrapper "haddock" = haddockWrapper | "ghc-pkg" `isSuffixOf` wrapper_name = ghcPkgWrapper
wrapper "hsc2hs" = hsc2hsWrapper | "ghci" `isSuffixOf` wrapper_name = ghciScriptWrapper
wrapper "runghc" = runGhcWrapper | "haddock" `isSuffixOf` wrapper_name = haddockWrapper
wrapper "runhaskell" = runGhcWrapper | "hsc2hs" `isSuffixOf` wrapper_name = hsc2hsWrapper
| "runhaskell" `isSuffixOf` wrapper_name = runGhcWrapper
wrapper _ = commonWrapper wrapper _ = commonWrapper
-- | Wrapper scripts for different programs. Common is default wrapper. -- | Wrapper scripts for different programs. Common is default wrapper.
...@@ -473,9 +474,10 @@ runGhcWrapper = pure $ "exec \"$executablename\" -f \"$exedir/ghc\" ${1+\"$@\"}\ ...@@ -473,9 +474,10 @@ runGhcWrapper = pure $ "exec \"$executablename\" -f \"$exedir/ghc\" ${1+\"$@\"}\
-- | --interactive flag. -- | --interactive flag.
ghciScriptWrapper :: Action String ghciScriptWrapper :: Action String
ghciScriptWrapper = do ghciScriptWrapper = do
prefix <- crossPrefix
version <- setting ProjectVersion version <- setting ProjectVersion
pure $ unlines pure $ unlines
[ "executable=\"$bindir/ghc-" ++ version ++ "\"" [ "executable=\"$bindir/" ++ prefix ++ "ghc-" ++ version ++ "\""
, "exec $executable --interactive \"$@\"" ] , "exec $executable --interactive \"$@\"" ]
-- | When not on Windows, we want to ship the 3 flavours of the iserv program -- | When not on Windows, we want to ship the 3 flavours of the iserv program
...@@ -548,4 +550,3 @@ createGhcii outDir = do ...@@ -548,4 +550,3 @@ createGhcii outDir = do
[ "#!/bin/sh" [ "#!/bin/sh"
, "exec \"$(dirname \"$0\")\"/ghc --interactive \"$@\"" , "exec \"$(dirname \"$0\")\"/ghc --interactive \"$@\""
] ]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment