diff options
| author | Hannes Schulze <haschu0103@outlook.de> | 2026-04-03 21:40:46 +0200 |
|---|---|---|
| committer | Hannes Schulze <haschu0103@outlook.de> | 2026-04-03 21:40:46 +0200 |
| commit | 09be9fb2701f0560aeb714f89fe0d1e750915ae0 (patch) | |
| tree | 3d05703751e8cd4308cd1a02876ee4baf1cb61f9 /lakefile.lean | |
| parent | 54d62ad2f3eb72d57683780b55dad2a97b1e2dcb (diff) | |
parse wayland protocols
Diffstat (limited to 'lakefile.lean')
| -rw-r--r-- | lakefile.lean | 46 |
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 -} |
