summaryrefslogtreecommitdiff
path: root/Biz/Bild.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Biz/Bild.hs')
-rw-r--r--Biz/Bild.hs79
1 files changed, 57 insertions, 22 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs
index d1d3d78..58bf8e6 100644
--- a/Biz/Bild.hs
+++ b/Biz/Bild.hs
@@ -202,6 +202,7 @@ type Out = String
data Compiler
= Copy
+ | Gcc
| GhcLib
| GhcExe
| Guile
@@ -230,20 +231,29 @@ data Target = Target
-- | We can't build everything yet...
isBuildableNs :: Namespace -> Bool
-isBuildableNs (Namespace _ Namespace.Hs) = True
-isBuildableNs (Namespace _ Namespace.Lisp) = True
-isBuildableNs (Namespace _ Namespace.Scm) = True
-isBuildableNs (Namespace _ Namespace.Rs) = True
-isBuildableNs ns
- | ns `elem` nixTargets = True
- | otherwise = False
+isBuildableNs = \case
+ (Namespace _ Namespace.C) -> True
+ (Namespace _ Namespace.Css) -> False
+ (Namespace _ Namespace.Hs) -> True
+ (Namespace _ Namespace.Json) -> False
+ (Namespace _ Namespace.Keys) -> False
+ (Namespace _ Namespace.Lisp) -> True
+ (Namespace _ Namespace.Md) -> False
+ (Namespace _ Namespace.None) -> False
+ (Namespace _ Namespace.Py) -> False
+ (Namespace _ Namespace.Sh) -> False
+ (Namespace _ Namespace.Scm) -> True
+ (Namespace _ Namespace.Rs) -> True
+ (Namespace path Namespace.Nix)
+ | path `elem` nixTargets -> True
+ | otherwise -> False
where
nixTargets =
- [ Namespace ["Biz", "Pie"] Namespace.Nix,
- Namespace ["Biz", "Que"] Namespace.Nix,
- Namespace ["Biz", "Cloud"] Namespace.Nix,
- Namespace ["Biz", "Dev"] Namespace.Nix,
- Namespace ["Biz", "Dragons", "Analysis"] Namespace.Nix
+ [ ["Biz", "Pie"],
+ ["Biz", "Que"],
+ ["Biz", "Cloud"],
+ ["Biz", "Dev"],
+ ["Biz", "Dragons", "Analysis"]
]
-- | Emulate the *nix hierarchy in the cabdir.
@@ -318,7 +328,39 @@ analyze path = do
Just </ do
user <- Env.getEnv "USER" /> Text.pack
host <- Text.pack </ fromMaybe "interactive" </ Env.lookupEnv "HOSTNAME"
+ let nada =
+ Target
+ { langdeps = Set.empty,
+ sysdeps = Set.empty,
+ compiler = Copy,
+ out = Nothing,
+ builder = user <> "@localhost",
+ ..
+ }
case ext of
+ -- basically we don't support building these
+ Namespace.Css -> pure nada
+ Namespace.Json -> pure nada
+ Namespace.Keys -> pure nada
+ Namespace.Md -> pure nada
+ Namespace.None -> pure nada
+ Namespace.Py -> pure nada
+ Namespace.Sh -> pure nada
+ Namespace.C -> do
+ pure
+ Target
+ { langdeps = Set.empty,
+ sysdeps = Set.empty,
+ compiler = Gcc,
+ out =
+ contentLines
+ /> Text.unpack
+ /> Regex.match (metaOut "//")
+ |> catMaybes
+ |> head,
+ builder = user <> "@localhost",
+ ..
+ }
Namespace.Hs -> do
langdeps <- detectImports namespace contentLines
let out =
@@ -404,16 +446,6 @@ analyze path = do
builder = user <> "@localhost",
..
}
- _ ->
- pure
- Target
- { langdeps = Set.empty,
- sysdeps = Set.empty,
- compiler = Copy,
- out = Nothing,
- builder = user <> "@localhost",
- ..
- }
ghcPkgFindModule :: Set String -> String -> IO (Set String)
ghcPkgFindModule acc m = do
@@ -463,6 +495,9 @@ build :: Bool -> Bool -> Target -> IO Exit.ExitCode
build andTest loud target@Target {..} = do
root <- Env.getEnv "BIZ_ROOT"
case compiler of
+ Gcc -> do
+ Log.info ["bild", "dev", "gcc", nschunk namespace]
+ proc loud namespace "gcc" ["-o", root </> bindir </> Maybe.fromJust out, path]
GhcExe -> do
Log.info ["bild", "dev", "ghc-exe", nschunk namespace]
exitcode <-