diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2019-07-31 17:07:39 +0200 |
---|---|---|
committer | Daniel Gröber (dxld) <dxld@darkboxed.org> | 2019-09-17 17:48:26 +0200 |
commit | a93ed8c7d93df1860d2e56b400b724ac47edf470 (patch) | |
tree | 85360f0ca82a0e920ffd38b0aaa0318555d9b072 /src/CabalHelper/Compiletime/Program | |
parent | 5ab34761ed8789286cd382273503129cc7a7134f (diff) |
Merge CompPrograms back into Programs
We need to support passing down the path to ghc to new-build/stack in order
to support using a non-default 'ghc' executable.
Diffstat (limited to 'src/CabalHelper/Compiletime/Program')
-rw-r--r-- | src/CabalHelper/Compiletime/Program/CabalInstall.hs | 14 | ||||
-rw-r--r-- | src/CabalHelper/Compiletime/Program/GHC.hs | 18 | ||||
-rw-r--r-- | src/CabalHelper/Compiletime/Program/Stack.hs | 6 |
3 files changed, 19 insertions, 19 deletions
diff --git a/src/CabalHelper/Compiletime/Program/CabalInstall.hs b/src/CabalHelper/Compiletime/Program/CabalInstall.hs index 4411bc3..2af1cdc 100644 --- a/src/CabalHelper/Compiletime/Program/CabalInstall.hs +++ b/src/CabalHelper/Compiletime/Program/CabalInstall.hs @@ -180,7 +180,7 @@ compileSetupHs (GhcVersion ghcVer) db srcdir = do file = srcdir </> "Setup" - callProcessStderr (Just srcdir) (ghcProgram ?cprogs) $ concat + callProcessStderr (Just srcdir) (ghcProgram ?progs) $ concat [ [ "--make" , "-package-conf", db ] @@ -193,11 +193,11 @@ compileSetupHs (GhcVersion ghcVer) db srcdir = do cabalWithGHCProgOpts :: Progs => [String] cabalWithGHCProgOpts = concat - [ [ "--with-ghc=" ++ ghcProgram ?cprogs ] + [ [ "--with-ghc=" ++ ghcProgram ?progs ] -- Only pass ghc-pkg if it was actually set otherwise we -- might break cabal's guessing logic - , if ghcPkgProgram ?cprogs /= ghcPkgProgram defaultCompPrograms - then [ "--with-ghc-pkg=" ++ ghcPkgProgram ?cprogs ] + , if ghcPkgProgram ?progs /= ghcPkgProgram defaultPrograms + then [ "--with-ghc-pkg=" ++ ghcPkgProgram ?progs ] else [] ] @@ -238,9 +238,9 @@ installCabalLibV2 _ghcVer cv (PackageEnvFile env_file) = do cabalV2WithGHCProgOpts :: Progs => [String] cabalV2WithGHCProgOpts = concat - [ [ "--with-compiler=" ++ ghcProgram ?cprogs ] - , if ghcPkgProgram ?cprogs /= ghcPkgProgram defaultCompPrograms - then [ "--with-hc-pkg=" ++ ghcPkgProgram ?cprogs ] + [ [ "--with-compiler=" ++ ghcProgram ?progs ] + , if ghcPkgProgram ?progs /= ghcPkgProgram defaultPrograms + then [ "--with-hc-pkg=" ++ ghcPkgProgram ?progs ] else [] ] diff --git a/src/CabalHelper/Compiletime/Program/GHC.hs b/src/CabalHelper/Compiletime/Program/GHC.hs index 547911f..e45d921 100644 --- a/src/CabalHelper/Compiletime/Program/GHC.hs +++ b/src/CabalHelper/Compiletime/Program/GHC.hs @@ -66,25 +66,25 @@ newtype GhcVersion = GhcVersion { unGhcVersion :: Version } showGhcVersion :: GhcVersion -> String showGhcVersion (GhcVersion v) = showVersion v -ghcVersion :: (Verbose, CProgs) => IO GhcVersion +ghcVersion :: (Verbose, Progs) => IO GhcVersion ghcVersion = GhcVersion . - parseVer . trim <$> readProcess' (ghcProgram ?cprogs) ["--numeric-version"] "" + parseVer . trim <$> readProcess' (ghcProgram ?progs) ["--numeric-version"] "" -ghcPkgVersion :: (Verbose, CProgs) => IO Version +ghcPkgVersion :: (Verbose, Progs) => IO Version ghcPkgVersion = parseVer . trim . dropWhile (not . isDigit) - <$> readProcess' (ghcPkgProgram ?cprogs) ["--version"] "" + <$> readProcess' (ghcPkgProgram ?progs) ["--version"] "" -createPkgDb :: (Verbose, CProgs) => UnpackedCabalVersion -> IO PackageDbDir +createPkgDb :: (Verbose, Progs) => UnpackedCabalVersion -> IO PackageDbDir createPkgDb cabalVer = do db@(PackageDbDir db_path) <- getPrivateCabalPkgDb $ unpackedToResolvedCabalVersion cabalVer exists <- doesDirectoryExist db_path when (not exists) $ - callProcessStderr Nothing (ghcPkgProgram ?cprogs) ["init", db_path] + callProcessStderr Nothing (ghcPkgProgram ?progs) ["init", db_path] return db -getPrivateCabalPkgDb :: (Verbose, CProgs) => ResolvedCabalVersion -> IO PackageDbDir +getPrivateCabalPkgDb :: (Verbose, Progs) => ResolvedCabalVersion -> IO PackageDbDir getPrivateCabalPkgDb cabalVer = do appdir <- appCacheDir ghcVer <- ghcVersion @@ -113,7 +113,7 @@ listCabalVersions mdb = do let mdbopt = ("--package-conf="++) <$> mdb_path args = ["list", "--simple-output", "Cabal"] ++ maybeToList mdbopt catMaybes . map (fmap snd . parsePkgId) . words - <$> readProcess' (ghcPkgProgram ?cprogs) args "" + <$> readProcess' (ghcPkgProgram ?progs) args "" _ -> mzero cabalVersionExistsInPkgDb @@ -136,7 +136,7 @@ cabalVersionExistsInPkgDb cabalVer db@(PackageDbDir db_path) = do invokeGhc :: Env => GhcInvocation -> IO (Either ExitCode FilePath) invokeGhc GhcInvocation {..} = do - rv <- callProcessStderr' Nothing (ghcProgram ?cprogs) $ concat + rv <- callProcessStderr' Nothing (ghcProgram ?progs) $ concat [ [ "-outputdir", giOutDir , "-o", giOutput ] diff --git a/src/CabalHelper/Compiletime/Program/Stack.hs b/src/CabalHelper/Compiletime/Program/Stack.hs index 353e8f1..3cdf87b 100644 --- a/src/CabalHelper/Compiletime/Program/Stack.hs +++ b/src/CabalHelper/Compiletime/Program/Stack.hs @@ -127,6 +127,6 @@ callStackCmd :: QueryEnvI c 'Stack -> Maybe FilePath -> [String] -> IO () readStackCmd = doStackCmd (\qe -> qeReadProcess qe "") callStackCmd = doStackCmd qeCallProcess -patchCompPrograms :: StackProjPaths -> CompPrograms -> CompPrograms -patchCompPrograms StackProjPaths{sppCompExe} cprogs = - cprogs { ghcProgram = sppCompExe } +patchCompPrograms :: StackProjPaths -> Programs -> Programs +patchCompPrograms StackProjPaths{sppCompExe} progs = + progs { ghcProgram = sppCompExe } |