summaryrefslogtreecommitdiff
path: root/lakefile.lean
diff options
context:
space:
mode:
Diffstat (limited to 'lakefile.lean')
-rw-r--r--lakefile.lean46
1 files changed, 32 insertions, 14 deletions
diff --git a/lakefile.lean b/lakefile.lean
index 660403d..271a216 100644
--- a/lakefile.lean
+++ b/lakefile.lean
@@ -11,30 +11,48 @@ def evalPkgConfig (args : Array String) : IO (Array String) := do
|>.filter (· != "")
|>.toArray
-package «CWayland» {
- moreLinkArgs := #["-L.lake/build/lib", "-lLibCWayland"] ++ (run_io evalPkgConfig #["--libs", "wayland-client"]).filter (· != "-lm")
- extraDepTargets := #[Lean.Name.mkStr1 "LibCWayland"]
-}
+package «Waylean» where
+ moreLinkArgs := #["-L.lake/build/lib", "-lCWayland"] ++ (run_io evalPkgConfig #["--libs", "wayland-client"]).filter (· != "-lm")
+ extraDepTargets := #[`CWayland]
-target «LibCWayland.o» pkg : System.FilePath := do
- let objectFile := pkg.buildDir / "LibCWayland.o"
+lean_lib «WaylandScannerLib» where
+ srcDir := "tools"
+ roots := #[`Scanner]
+
+lean_exe «WaylandScanner» where
+ srcDir := "tools"
+ root := `Scanner
+
+target «WaylandProtocolsSources» pkg : Unit := do
+ let scannerJob ← «WaylandScanner».fetch
+ let outPath := pkg.dir / "lib"
+ let srcPath := pkg.dir / "lib" / "Wayland" / "Protocols" / "xml"
+ let rootModule := "Wayland.Protocols"
+ scannerJob.bindM fun scannerFile ↦
+ Job.sync do
+ proc {
+ cmd := scannerFile.toString
+ args := #[rootModule, outPath.toString, srcPath.toString]
+ }
+
+target «CWayland.o» pkg : System.FilePath := do
+ let objectFile := pkg.buildDir / "CWayland.o"
let srcJob ← inputFile (text := .true) <| pkg.dir / "lib" / "CWayland" / "CWayland.cc"
let cFlags ← evalPkgConfig #["--cflags", "wayland-client"]
buildFileAfterDep objectFile srcJob (fun srcFile ↦ do
let cFlags := cFlags ++ #["-I", (← getLeanIncludeDir).toString, "-I", (← IO.getEnv "C_INCLUDE_PATH").getD "", "-fPIC"]
compileO objectFile srcFile cFlags)
-target «LibCWayland» pkg : System.FilePath := do
- let name := nameToStaticLib "LibCWayland"
- let objectFile ← fetch <| pkg.target (Lean.Name.mkStr1 "LibCWayland.o")
- buildStaticLib (pkg.buildDir / "lib" / name) #[objectFile]
+target «CWayland» pkg : System.FilePath := do
+ let objectFile ← «CWayland.o».fetch
+ let libFile := pkg.buildDir / "lib" / nameToStaticLib "CWayland"
+ buildStaticLib libFile #[objectFile]
-lean_lib «Wayland» {
+lean_lib «Wayland» where
srcDir := "lib"
roots := #[`Wayland]
-}
+ extraDepTargets := #[`WaylandProtocolsSources]
-lean_exe «Waylean» {
+lean_exe «Waylean» where
srcDir := "src"
root := `Waylean
-}