summaryrefslogtreecommitdiff
path: root/Biz/Bild.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Biz/Bild.hs')
-rw-r--r--Biz/Bild.hs35
1 files changed, 7 insertions, 28 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs
index 81947ed..2db5ccc 100644
--- a/Biz/Bild.hs
+++ b/Biz/Bild.hs
@@ -423,7 +423,6 @@ analyze hmap ns = case Map.lookup ns hmap of
user <- Env.getEnv "USER" /> Text.pack
host <- HostName.getHostName /> Text.pack
Log.info ["bild", "analyze", str path]
- let runw cmd args = Process.readProcess cmd args "" /> Text.pack /> Text.words
contentLines <-
withFile absPath ReadMode <| \h ->
IO.hSetEncoding h IO.utf8_bom
@@ -466,20 +465,6 @@ analyze hmap ns = case Map.lookup ns hmap of
Namespace.Sh -> pure Nothing
Namespace.C ->
Meta.detectAll "//" contentLines |> \Meta.Parsed {..} -> do
- nixCFlags <-
- Env.getEnv "NIX_CFLAGS_COMPILE"
- /> Text.pack
- /> Text.words
- langdepFlags <-
- null pdep
- ?. ( runw "pkg-config" ("--cflags" : Set.toList pdep),
- pure []
- )
- sysdepFlags <-
- null psys
- ?. ( runw "pkg-config" ("--libs" : Set.toList psys),
- pure []
- )
Target
{ langdeps = pdep,
sysdeps = psys,
@@ -487,18 +472,11 @@ analyze hmap ns = case Map.lookup ns hmap of
compiler = Gcc,
builder = Local user host,
out = pout,
- packageSet = "", -- none, or maybe I should make cPackages?
- compilerFlags =
- concat
- [ [o, dir, str absPath]
- ++ langdepFlags
- ++ sysdepFlags
- ++ nixCFlags
- ++ (map Text.pack <| Set.toList parg)
- | let outable = pout /= Meta.None,
- o <- outable ?: (["-o"], []),
- dir <- outable ?: ([Text.pack <| root </> outToPath pout], [])
- ],
+ packageSet = "cPackages",
+ compilerFlags = case pout of
+ Meta.Bin o ->
+ ["-o", o, path] <> Set.toList parg |> map Text.pack
+ _ -> panic "can only bild C exes, not libs",
outPath = outToPath pout,
srcs = Set.singleton absPath,
..
@@ -756,7 +734,7 @@ build andTest loud analysis =
>> nixBuild loud target
Gcc ->
Log.info ["bild", label, "gcc", nschunk namespace]
- >> proc loud namespace (toNixFlag compiler) compilerFlags
+ >> nixBuild loud target
where
label = case out of
Meta.Bin _ -> "bin"
@@ -977,4 +955,5 @@ selectBuilder = \case
Namespace _ Namespace.Hs -> "haskell"
Namespace _ Namespace.Py -> "python"
Namespace _ Namespace.Rs -> "base"
+ Namespace _ Namespace.C -> "c"
Namespace _ ext -> panic <| "no builder for " <> show ext