on de4cdad help sign in
haskell.nix/examples/Cabal-install-folder.diff
41 lines 1.8 kB history raw
1diff --git a/Distribution/Simple/GHC.hs b/Distribution/Simple/GHC.hs
2index 547776046..176e59111 100644
3--- a/Distribution/Simple/GHC.hs
4+++ b/Distribution/Simple/GHC.hs
5@@ -1,6 +1,7 @@
6 {-# LANGUAGE FlexibleContexts #-}
7 {-# LANGUAGE RankNTypes #-}
8 {-# LANGUAGE TupleSections #-}
9+{-# LANGUAGE LambdaCase #-}
10 {-# LANGUAGE CPP #-}
12 -----------------------------------------------------------------------------
13@@ -1755,13 +1756,27 @@ installExe verbosity lbi binDir buildPref
14 let exeName' = unUnqualComponentName $ exeName exe
15 exeFileName = exeTargetName (hostPlatform lbi) exe
16 fixedExeBaseName = progprefix ++ exeName' ++ progsuffix
17- installBinary dest = do
18+ exePath = buildPref </> exeName' </> exeFileName
19+ installBinary dest = doesFileExist exePath >>= \case
20+ True -> do
21 installExecutableFile verbosity
22 (buildPref </> exeName' </> exeFileName)
23 (dest <.> exeExtension (hostPlatform lbi))
24 when (stripExes lbi) $
25 Strip.stripExe verbosity (hostPlatform lbi) (withPrograms lbi)
26 (dest <.> exeExtension (hostPlatform lbi))
27+ False -> do
28+ putStrLn "Hello!"
29+ -- The executable exists but is not a simple file.
30+ -- Deligate installation to the compiler
31+ runDbProgram verbosity ghcProgram (withPrograms lbi) $
32+ [ "--install-executable"
33+ , buildPref </> exeName' </> exeFileName
34+ , "-o", dest
35+ ] ++
36+ case (stripExes lbi, lookupProgram stripProgram $ withPrograms lbi) of
37+ (True, Just strip) -> ["-strip-program", programPath strip]
38+ _ -> []
39 installBinary (binDir </> fixedExeBaseName)
41 -- |Install foreign library for GHC.