shake-ats 1.3.0.2 → 1.3.0.3
raw patch · 2 files changed
+10/−4 lines, 2 files
Files
- shake-ats.cabal +1/−1
- src/Development/Shake/ATS.hs +9/−3
shake-ats.cabal view
@@ -1,5 +1,5 @@ name: shake-ats-version: 1.3.0.2+version: 1.3.0.3 synopsis: Utilities for building ATS projects with shake description: Various helper functions for building [ATS](http://www.ats-lang.org/) with the [shake](http://shakebuild.com/) library homepage: https://github.com/vmchale/shake-ats#readme
src/Development/Shake/ATS.hs view
@@ -38,6 +38,7 @@ import Development.Shake.ATS.Rules import Development.Shake.ATS.Type import Development.Shake.FilePath+import Development.Shake.Version import Language.ATS import System.Directory (copyFile, createDirectoryIfMissing) import System.Exit (ExitCode (ExitSuccess))@@ -92,11 +93,15 @@ -> String -- ^ GHC version -> Bool -- ^ Whether to use the Garbage collector -> [String]-makeCFlags ss fc ghcVersion b = gcFlag' : (hsExtra <> ss) where+makeCFlags ss fc ghcV b = gcFlag' : (hsExtra <> ss) where gcFlag' = bool ("-optc" <>) id noHs $ gcFlag b- hsExtra = bool ["--make", "-odir", ".atspkg", "-no-hs-main", "-package-db", "~/.cabal/store/ghc-" ++ ghcVersion ++ "/package.db/"] mempty noHs+ hsExtra = bool (["--make", "-odir", ".atspkg", "-no-hs-main", "-package-db", "~/.cabal/store/ghc-" ++ ghcV ++ "/package.db/"] ++ packageDbs) mempty noHs noHs = null fc+ packageDbs = (\x -> ["-package-db", x ++ "/dist-newstyle/packagedb/ghc-" ++ ghcV]) =<< libToDirs fc +libToDirs :: [ForeignCabal] -> [String]+libToDirs = fmap (takeDirectory . TL.unpack . cabalFile)+ -- TODO libraries should be linked against *cross-compiled* versions!! atsBin :: BinaryTarget -> Rules () atsBin BinaryTarget{..} = do@@ -122,12 +127,13 @@ path <- fromMaybe "" <$> getEnv "PATH" let toLibs = fmap ("-l" <>) let libs' = ("atslib" :) $ bool libs ("gc" : libs) gc+ ghcV <- ghcVersion -- FIXME call on ghc specified? command [EchoStderr False, AddEnv "PATSHOME" home, AddEnv "PATH" (home ++ "/bin:" ++ path), AddEnv "PATSHOMELOCS" $ patsHomeLocs 5] (home ++ "/bin/patscc") (mconcat [ [src, "-atsccomp", ccommand, "-o", binTarget, "-cleanaft"]- , makeCFlags cFlags hsLibs "8.2.2" gc+ , makeCFlags cFlags hsLibs ghcV gc , toLibs libs' ])