Andreas Klebinger pushed to branch wip/andreask/cygpath at Glasgow Haskell Compiler / GHC

Commits:

5 changed files:

Changes:

  • configure.ac
    ... ... @@ -833,6 +833,9 @@ dnl ** check for installed alex binary + version
    833 833
     AC_ARG_VAR(ALEX,[Use as the path to alex [default=autodetect]])
    
    834 834
     FPTOOLS_ALEX
    
    835 835
     
    
    836
    +dnl ** check for cygpath on windows
    
    837
    +FP_PROG_CYGPATH
    
    838
    +
    
    836 839
     dnl --------------------------------------------------
    
    837 840
     dnl ### program checking section ends here ###
    
    838 841
     dnl --------------------------------------------------
    

  • hadrian/cfg/system.config.in
    ... ... @@ -23,6 +23,7 @@ makeinfo = @MAKEINFO@
    23 23
     bourne-shell   = @SH@
    
    24 24
     git            = @GIT@
    
    25 25
     cabal          = @CABAL@
    
    26
    +cygpath        = @CYGPATH@
    
    26 27
     
    
    27 28
     # Python 3 is required to run test driver.
    
    28 29
     # See: https://github.com/ghc/ghc/blob/master/testsuite/mk/boilerplate.mk#L220
    

  • hadrian/src/Builder.hs
    ... ... @@ -163,6 +163,7 @@ data Builder = Alex
    163 163
                  | Cabal ConfigurationInfo Stage
    
    164 164
                  | Cc CcMode Stage
    
    165 165
                  | Configure FilePath
    
    166
    +             | Cygpath
    
    166 167
                  | DeriveConstants
    
    167 168
                  | GenApply (Maybe Int) -- ^ vector size, or Nothing for non-vectors
    
    168 169
                  | GenPrimopCode
    

  • hadrian/src/Hadrian/Oracles/Path.hs
    ... ... @@ -13,6 +13,8 @@ import System.Directory
    13 13
     import System.Info.Extra
    
    14 14
     
    
    15 15
     import Hadrian.Utilities
    
    16
    +import Hadrian.Oracles.TextFile
    
    17
    +import Base
    
    16 18
     
    
    17 19
     -- | Lookup a specified 'FilePath' in the system @PATH@.
    
    18 20
     lookupInPath :: FilePath -> Action FilePath
    
    ... ... @@ -45,7 +47,8 @@ type instance RuleResult WindowsPath = String
    45 47
     pathOracle :: Rules ()
    
    46 48
     pathOracle = do
    
    47 49
         void $ addOracleCache $ \(WindowsPath path) -> do
    
    48
    -        Stdout out <- quietly $ cmd ["cygpath", "-m", path]
    
    50
    +        cygpath <- fromMaybe (error "cygpath not set by configure") <$> lookupValue configFile "cygpath"
    
    51
    +        Stdout out <- quietly $ cmd [cygpath, "-m", path]
    
    49 52
             let windowsPath = unifyPath $ dropWhileEnd isSpace out
    
    50 53
             putVerbose $ "| Windows path mapping: " ++ path ++ " => " ++ windowsPath
    
    51 54
             return windowsPath
    

  • m4/fp_prog_cygpath.m4
    1
    +# FP_PROG_CYGPATH
    
    2
    +# ----------------
    
    3
    +# Record cygpath path for later use by hls on windows.
    
    4
    +AC_DEFUN([FP_PROG_CYGPATH],
    
    5
    +[
    
    6
    +  if test "$HostOS" == "mingw32"; then
    
    7
    +    AC_PATH_PROG([CYGPATH_POSIX], [cygpath])
    
    8
    +
    
    9
    +    if test -z "$CYGPATH_POSIX"; then
    
    10
    +      AC_MSG_ERROR([cygpath not found; Windows path conversion unavailable])
    
    11
    +      CYGPATH=""
    
    12
    +    else
    
    13
    +      # Convert the POSIX path of the cygpath executable into a Windows path
    
    14
    +      CYGPATH=`"$CYGPATH_POSIX" -m "$CYGPATH_POSIX"`
    
    15
    +      AC_MSG_RESULT([using cygpath at $CYGPATH])
    
    16
    +    fi
    
    17
    +
    
    18
    +    AC_SUBST([CYGPATH])
    
    19
    +  fi
    
    20
    +])
    \ No newline at end of file