diff options
-rw-r--r-- | package.yaml | 1 | ||||
-rw-r--r-- | src/Build.hs | 28 |
2 files changed, 21 insertions, 8 deletions
diff --git a/package.yaml b/package.yaml index ece47c9..7cf11c6 100644 --- a/package.yaml +++ b/package.yaml @@ -25,6 +25,7 @@ dependencies: - directory - extra - filepath +- MissingH - optparse-applicative - process - shake diff --git a/src/Build.hs b/src/Build.hs index 7646ed6..c7519e5 100644 --- a/src/Build.hs +++ b/src/Build.hs @@ -15,6 +15,7 @@ import Data.Char ( isAsciiLower import Data.List ( intercalate , isSuffixOf ) +import Data.List.Utils ( replace ) import qualified Data.Map as Map import Data.Maybe ( fromMaybe , mapMaybe @@ -383,11 +384,17 @@ buildWithScript script projectDirectory buildDirectory compiler flags libraryNam absoluteBuildDirectory <- makeAbsolute buildDirectory createDirectoryIfMissing True absoluteBuildDirectory absoluteLibraryDirectories <- mapM makeAbsolute otherLibraryDirectories - setEnv "FC" compiler - setEnv "FFLAGS" (intercalate " " flags) - setEnv "BUILD_DIR" $ removeDriveLetter absoluteBuildDirectory - setEnv "INCLUDE_DIRS" (intercalate " " (map removeDriveLetter absoluteLibraryDirectories)) - let archiveFile = (removeDriveLetter absoluteBuildDirectory) </> "lib" ++ libraryName <.> "a" + setEnv "FC" compiler + setEnv "FFLAGS" (intercalate " " flags) + setEnv "BUILD_DIR" $ unWindowsPath absoluteBuildDirectory + setEnv + "INCLUDE_DIRS" + (intercalate " " (map unWindowsPath absoluteLibraryDirectories)) + let archiveFile = + (removeDriveLetter absoluteBuildDirectory) + </> "lib" + ++ libraryName + <.> "a" withCurrentDirectory projectDirectory if @@ -402,7 +409,12 @@ isMakefile script | script == "Makefile" = True | ".mk" `isSuffixOf` script = True | otherwise = False +unWindowsPath :: String -> String +unWindowsPath = changeSeparators . removeDriveLetter + removeDriveLetter :: String -> String -removeDriveLetter path - | ':' `elem` path = (tail . dropWhile (/= ':')) path - | otherwise = path +removeDriveLetter path | ':' `elem` path = (tail . dropWhile (/= ':')) path + | otherwise = path + +changeSeparators :: String -> String +changeSeparators = replace "\\" "/" |