[commit: packages/Cabal] ghc-head: Add a configure --extra-prog-path flag (046c086)

git at git.haskell.org git at git.haskell.org
Mon Aug 26 23:29:36 CEST 2013


Repository : ssh://git@git.haskell.org/Cabal

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=046c086694f0596b938f99d515c0ef19b84ba401

>---------------------------------------------------------------

commit 046c086694f0596b938f99d515c0ef19b84ba401
Author: Duncan Coutts <duncan at community.haskell.org>
Date:   Sat Aug 10 21:55:52 2013 +0100

    Add a configure --extra-prog-path flag
    
    Can be used to add extra dirs to the end of the program search path.
    This in mainly useful as a config file entry rather than a command line
    flag, but it'll exists as both.


>---------------------------------------------------------------

046c086694f0596b938f99d515c0ef19b84ba401
 Cabal/Distribution/Simple/Configure.hs |   14 +++++++++++---
 Cabal/Distribution/Simple/Setup.hs     |    9 +++++++++
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/Cabal/Distribution/Simple/Configure.hs b/Cabal/Distribution/Simple/Configure.hs
index ee83b70..b71bea5 100644
--- a/Cabal/Distribution/Simple/Configure.hs
+++ b/Cabal/Distribution/Simple/Configure.hs
@@ -98,6 +98,7 @@ import Distribution.Simple.Hpc ( enableCoverage )
 import Distribution.Simple.Program
     ( Program(..), ProgramLocation(..), ConfiguredProgram(..)
     , ProgramConfiguration, defaultProgramConfiguration
+    , ProgramSearchPathEntry(..), getProgramSearchPath, setProgramSearchPath
     , configureAllKnownPrograms, knownPrograms, lookupKnownProgram
     , userSpecifyArgss, userSpecifyPaths
     , requireProgram, requireProgramVersion
@@ -295,9 +296,13 @@ configure (pkg_descr0, pbi) cfg
 
         createDirectoryIfMissingVerbose (lessVerbose verbosity) True distPref
 
-        let programsConfig = userSpecifyArgss (configProgramArgs cfg)
-                           . userSpecifyPaths (configProgramPaths cfg)
-                           $ configPrograms cfg
+        let programsConfig =
+               userSpecifyArgss (configProgramArgs cfg)
+             . userSpecifyPaths (configProgramPaths cfg)
+             . setProgramSearchPath searchpath
+             $ configPrograms cfg
+            searchpath  = getProgramSearchPath (configPrograms cfg)
+                       ++ map ProgramSearchPathDir (configProgramPathExtra cfg)
             userInstall = fromFlag (configUserInstall cfg)
             packageDbs  = interpretPackageDbFlags userInstall
                             (configPackageDBs cfg)
@@ -853,7 +858,10 @@ configCompilerAux cfg = configCompiler (flagToMaybe $ configHcFlavor cfg)
   where
     programsConfig = userSpecifyArgss (configProgramArgs cfg)
                    . userSpecifyPaths (configProgramPaths cfg)
+                   . setProgramSearchPath searchpath
                    $ defaultProgramConfiguration
+    searchpath     = getProgramSearchPath (defaultProgramConfiguration)
+                  ++ map ProgramSearchPathDir (configProgramPathExtra cfg)
 
 configCompiler :: Maybe CompilerFlavor -> Maybe FilePath -> Maybe FilePath
                -> ProgramConfiguration -> Verbosity
diff --git a/Cabal/Distribution/Simple/Setup.hs b/Cabal/Distribution/Simple/Setup.hs
index e65a04c..d363c6a 100644
--- a/Cabal/Distribution/Simple/Setup.hs
+++ b/Cabal/Distribution/Simple/Setup.hs
@@ -275,6 +275,7 @@ data ConfigFlags = ConfigFlags {
 
     configProgramPaths  :: [(String, FilePath)], -- ^user specifed programs paths
     configProgramArgs   :: [(String, [String])], -- ^user specifed programs args
+    configProgramPathExtra :: [FilePath],        -- ^Extend the $PATH
     configHcFlavor      :: Flag CompilerFlavor, -- ^The \"flavor\" of the
                                                 -- compiler, sugh as GHC or
                                                 -- Hugs.
@@ -488,6 +489,12 @@ configureOptions showOrParseArgs =
          "A list of directories to search for external libraries"
          configExtraLibDirs (\v flags -> flags {configExtraLibDirs = v})
          (reqArg' "PATH" (\x -> [x]) id)
+
+      ,option "" ["extra-prog-path"]
+         "A list of directories to search for required programs (in addition to the normal search locations)"
+         configProgramPathExtra (\v flags -> flags {configProgramPathExtra = v})
+         (reqArg' "PATH" (\x -> [x]) id)
+
       ,option "" ["constraint"]
          "A list of additional constraints on the dependencies."
          configConstraints (\v flags -> flags { configConstraints = v})
@@ -603,6 +610,7 @@ instance Monoid ConfigFlags where
     configPrograms      = error "FIXME: remove configPrograms",
     configProgramPaths  = mempty,
     configProgramArgs   = mempty,
+    configProgramPathExtra = mempty,
     configHcFlavor      = mempty,
     configHcPath        = mempty,
     configHcPkg         = mempty,
@@ -636,6 +644,7 @@ instance Monoid ConfigFlags where
     configPrograms      = configPrograms b,
     configProgramPaths  = combine configProgramPaths,
     configProgramArgs   = combine configProgramArgs,
+    configProgramPathExtra = combine configProgramPathExtra,
     configHcFlavor      = combine configHcFlavor,
     configHcPath        = combine configHcPath,
     configHcPkg         = combine configHcPkg,





More information about the ghc-commits mailing list