mirror of
https://github.com/augustss/MicroCabal.git
synced 2024-11-22 09:02:49 +03:00
Include path directory
This commit is contained in:
parent
a59185d503
commit
6aaba927ab
2
Makefile
2
Makefile
@ -3,7 +3,7 @@ MHS=$(MHSDIR)/bin/mhs
|
||||
|
||||
bin/mcabal: src/MicroCabal/*.hs src/MicroCabal/*/*.hs
|
||||
@mkdir -p bin
|
||||
MHSDIR=$(MHSDIR) $(MHS) -C -isrc -obin/mcabal MicroCabal.Main
|
||||
MHSDIR=$(MHSDIR) $(MHS) -isrc -obin/mcabal MicroCabal.Main
|
||||
|
||||
bin/gmcabal: src/MicroCabal/*.hs src/MicroCabal/*/*.hs
|
||||
@mkdir -p bin
|
||||
|
@ -74,14 +74,19 @@ setupStdArgs env flds = do
|
||||
deps = getBuildDependsPkg flds
|
||||
lang = maybe [] (\ s -> ["-X" ++ s]) mlang
|
||||
buildDir <- getBuildDir env
|
||||
return $ [ "-package-env=-", "-package-db=" ++ db, "-outputdir=" ++ buildDir, "-w"] ++
|
||||
map ("-i" ++) srcDirs ++
|
||||
["-i" ++ pathModuleDir env] ++
|
||||
map ("-I" ++) incDirs ++
|
||||
map ("-X" ++) exts ++
|
||||
lang ++
|
||||
map ("-package " ++) deps ++
|
||||
opts ++ cppOpts
|
||||
return $
|
||||
[ "-package-env=-",
|
||||
"-package-db=" ++ db,
|
||||
"-outputdir=" ++ buildDir,
|
||||
"-w"] ++
|
||||
map ("-i" ++) srcDirs ++
|
||||
["-i" ++ pathModuleDir env] ++
|
||||
map ("-I" ++) incDirs ++
|
||||
map ("-X" ++) exts ++
|
||||
lang ++
|
||||
map ("-package " ++) deps ++
|
||||
opts ++
|
||||
cppOpts
|
||||
|
||||
binGhc :: FilePath
|
||||
binGhc = "bin" </> "ghc"
|
||||
|
@ -54,8 +54,9 @@ mhsExists env pkgname = do
|
||||
builtinPackages :: [String]
|
||||
builtinPackages = ["array", "base", "deepseq", "directory", "process", "bytestring", "text", "fail"]
|
||||
|
||||
setupStdArgs :: Env -> [Field] -> [String]
|
||||
setupStdArgs _env flds =
|
||||
setupStdArgs :: Env -> [Field] -> IO [String]
|
||||
setupStdArgs env flds = do
|
||||
db <- getMhsDir env
|
||||
let srcDirs = getFieldStrings flds ["."] "hs-source-dirs"
|
||||
defExts = getFieldStrings flds [] "default-extensions"
|
||||
exts = getFieldStrings flds defExts "extensions"
|
||||
@ -65,11 +66,13 @@ setupStdArgs _env flds =
|
||||
incs = getFieldStrings flds [] "include-dirs"
|
||||
exts' = filter (`elem` mhsX) (exts ++ oexts)
|
||||
mhsX = ["CPP"]
|
||||
in -- ["-i"] ++
|
||||
map ("-i" ++) srcDirs ++
|
||||
map ("-X" ++) exts' ++
|
||||
map ("-I" ++) incs ++
|
||||
opts ++ cppOpts
|
||||
return $ -- ["-i"] ++
|
||||
map ("-i" ++) srcDirs ++
|
||||
["-i" ++ pathModuleDir env] ++
|
||||
map ("-X" ++) exts' ++
|
||||
map ("-I" ++) incs ++
|
||||
opts ++
|
||||
cppOpts
|
||||
|
||||
binMhs :: String
|
||||
binMhs = "bin" </> "mhs"
|
||||
@ -82,7 +85,8 @@ mhsBuildExe env _ (Section _ name flds) = do
|
||||
bin = distDir env </> binMhs </> name
|
||||
mkdir env $ distDir env </> binMhs
|
||||
mainIs' <- findMainIs env srcDirs mainIs
|
||||
let args = unwords $ setupStdArgs env flds ++
|
||||
stdArgs <- setupStdArgs env flds
|
||||
let args = unwords $ stdArgs ++
|
||||
["-a."
|
||||
,"-o" ++ bin, mainIs']
|
||||
when (verbose env >= 0) $
|
||||
@ -112,13 +116,15 @@ findMainIs env (d:ds) fn = do
|
||||
mhsBuildLib :: Env -> Section -> Section -> IO ()
|
||||
mhsBuildLib env (Section _ _ glob) (Section _ name flds) = do
|
||||
initDB env
|
||||
stdArgs <- setupStdArgs env flds
|
||||
let mdls = getFieldStrings flds (error "no exposed-modules") "exposed-modules"
|
||||
omdls = getFieldStrings flds [] "other-modules"
|
||||
vers = getVersion glob "version"
|
||||
namever = name ++ "-" ++ showVersion vers
|
||||
pkgfn = namever ++ ".pkg"
|
||||
args = unwords $ ["-P" ++ namever, "-o" ++ pkgfn] ++
|
||||
setupStdArgs env flds ++
|
||||
args = unwords $ ["-P" ++ namever,
|
||||
"-o" ++ pkgfn] ++
|
||||
stdArgs ++
|
||||
["-a."] ++
|
||||
mdls
|
||||
isMdl (' ':_) = True -- Relies on -L output format
|
||||
|
Loading…
Reference in New Issue
Block a user