packages feed

dib 0.5.0 → 0.6.0

raw patch · 6 files changed

+53/−15 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Dib.Builders.C: CTargetInfo :: Text -> Text -> Text -> BuildLocation -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> [Text] -> [Text] -> [Text] -> [Text] -> Bool -> CTargetInfo
+ Dib.Builders.C: CTargetInfo :: Text -> Text -> Text -> BuildLocation -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> Text -> [Text] -> [Text] -> [Text] -> [Text] -> Bool -> CTargetInfo

Files

Main.hs view
@@ -74,7 +74,9 @@   ++ "  outputName = \"" ++ name ++ "\",\n"   ++ "  targetName = \"" ++ name ++ "\",\n"   ++ "  srcDir = \"" ++ srcDir ++ "\",\n"-  ++ "  compileFlags = \"\",\n"+  ++ "  commonCompileFlags = \"\",\n"+  ++ "  cCompileFlags = \"\",\n"+  ++ "  cxxCompileFlags = \"\",\n"   ++ "  linkFlags = \"\",\n"   ++ "  outputLocation = ObjAndBinDirs \"obj\" \".\",\n"   ++ "  includeDirs = [\"" ++ srcDir ++ "\"]\n"@@ -189,7 +191,8 @@   D.createDirectoryIfMissing False ".dib"   needToRebuild <- checkDibTimestamps   rebuild needToRebuild-  system $ correctExe ++ " +RTS -N -RTS " ++ args+  let quotes = if os =="mingw32" then "\"\"" else "" +  system $ quotes ++ correctExe ++ quotes ++ " +RTS -N -RTS " ++ args  shouldHandleInit :: [String] -> Bool shouldHandleInit args = not (null args) && head args == "--init"
dib.cabal view
@@ -1,5 +1,5 @@ name:           dib-version:        0.5.0+version:        0.6.0 cabal-version:  >= 1.6 category:		Development build-type:     Simple
src/Dib.hs view
@@ -41,15 +41,35 @@ -- through the use of @dib --init@. Run the dib executable with no options for more -- information on the available templates. ----- The most trivial, do nothing build script looks like the following:---+-- An example of using the C Builder to build an executable called "myProject" with+-- its source code in the "src/" directory is as follows:+--  -- @ -- module Main where+--  -- import Dib------ targets = []+-- import Dib.Builders.C+-- import qualified Data.Text as T+-- +-- projectInfo = defaultGCCConfig {+--   outputName = "myProject",+--   targetName = "myProject",+--   srcDir = "src",+--   compileFlags = "",+--   linkFlags = "",+--   outputLocation = ObjAndBinDirs "obj" ".",+--   includeDirs = ["src"]+-- }+-- +-- project = makeCTarget projectInfo+-- clean = makeCleanTarget projectInfo+-- +-- targets = [project, clean]+--  -- main = dib targets -- @+-- +-- This was generated with @dib --init c myProject gcc src@.  -- -- A build script is expected to declare the available 'Target's and then pass them -- to the 'dib' function. Only the top-level 'Target's need to be passed to 'dib';
src/Dib/Builders/C.hs view
@@ -3,7 +3,7 @@  -- | A builder for C/C++ code. module Dib.Builders.C (-  CTargetInfo(CTargetInfo, outputName, targetName, srcDir, outputLocation, compiler, linker, archiver, inFileOption, outFileOption, compileFlags, linkFlags, archiverFlags, includeDirs, extraCompileDeps, extraLinkDeps, exclusions, staticLibrary),+  CTargetInfo(CTargetInfo, outputName, targetName, srcDir, outputLocation, compiler, linker, archiver, inFileOption, outFileOption, commonCompileFlags, cCompileFlags, cxxCompileFlags, linkFlags, archiverFlags, includeDirs, extraCompileDeps, extraLinkDeps, exclusions, staticLibrary),   BuildLocation(InPlace, BuildDir, ObjAndBinDirs),   makeCTarget,   makeCleanTarget,@@ -52,8 +52,12 @@   outFileOption :: T.Text,   -- | The compiler's include option   includeOption :: T.Text,-  -- | Compiler flags.-  compileFlags :: T.Text,+  -- | Common compiler flags.+  commonCompileFlags :: T.Text,+  -- | C compiler flags.+  cCompileFlags :: T.Text,+  -- | C++ compiler flags.+  cxxCompileFlags :: T.Text,   -- | Linker flags.   linkFlags :: T.Text,   -- | Archiver flags.@@ -89,8 +93,12 @@         outFileOption info,         "includeOption",         includeOption info,-        "compileFlags",-        compileFlags info,+        "commonCompileFlags",+        commonCompileFlags info,+        "cCompileFlags",+        cCompileFlags info,+        "cxxCompileFlags",+        cxxCompileFlags info,         "linkFlags",         linkFlags info,         "archiverFlags",@@ -133,7 +141,9 @@   inFileOption = "",   outFileOption = "",   includeOption = "",-  compileFlags = "",+  commonCompileFlags = "",+  cCompileFlags = "",+  cxxCompileFlags = "",   linkFlags = "",   archiverFlags = "",   includeDirs = [],@@ -158,7 +168,7 @@ -- | A default configuration for g++. defaultGXXConfig :: CTargetInfo defaultGXXConfig = defaultGCCConfig {-  compiler = "g++",+  compiler = "gcc",   linker = "g++"   } @@ -194,11 +204,14 @@ excludeFiles :: [T.Text] -> T.Text -> Bool excludeFiles excl file = L.any (`T.isSuffixOf` file) excl +getCorrectCompileFlags :: CTargetInfo -> T.Text -> T.Text+getCorrectCompileFlags info s = if ".c" `T.isSuffixOf` s then cCompileFlags info else cxxCompileFlags info+ -- | Given a 'CTargetInfo', produces a 'Target' makeCTarget :: CTargetInfo -> Target makeCTarget info =   let includeDirString = includeOption info `T.append` T.intercalate (" " `T.append` includeOption info) (includeDirs info)-      makeBuildString s t = T.unpack $ T.concat [compiler info, " ", inFileOption info, " ", s, " ", outFileOption info, " ", t, " ", includeDirString, " ", compileFlags info]+      makeBuildString s t = T.unpack $ T.concat [compiler info, " ", inFileOption info, " ", s, " ", outFileOption info, " ", t, " ", includeDirString, " ", commonCompileFlags info, " ", getCorrectCompileFlags info s]       makeLinkString ss t = T.unpack $ T.concat [linker info, " ", T.unwords ss, " ", outFileOption info, " ", t, " ", linkFlags info]       makeArchiveString ss t = T.unpack $ T.concat [archiver info, " ", archiverFlags info, " ", t, " ", T.unwords ss] 
src/Dib/Scanners/CDepScanner.hs view
@@ -13,6 +13,7 @@ import qualified Data.Text as T import qualified System.Directory as Dir import qualified System.FilePath as F+import Control.Applicative import Control.Monad.State.Lazy  data Dependency = Dependency String String
src/Dib/Types.hs view
@@ -9,6 +9,7 @@ -- not export any of these types directly; other modules do. module Dib.Types where +import Control.Applicative import Control.Monad.State as S import qualified Data.Map as Map import qualified Data.Serialize as Serialize