Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
GD9: raea's own Godot 4.6.1 + GodotJS editors, and `raea setup godot` downloads them first (apps/engines godot.rs, sdk/godot/build). Pins move to raea's v0.1.1 release (godot-4.6.1-raea-macos-arm64, -linux-x86_64, -windows-x86_64 .zip, each pinned by size and sha256); GodotJS's own pinned build is the fallback, so a release whose zips aren't up yet still installs, and setup says which build it installed and why not raea's. RAEA_GODOT_FROM=URL (file:// too) installs from elsewhere. windows.py cross-builds the Windows editor with MinGW-w64; macos.sh makes Godot.app from Godot's macos_tools.app; package.sh signs it with the Developer ID and Godot's editor entitlements, notarizes and staples it, and zips all three; verify.sh fails unless the smoke prints its PASS line. godot run's usage gains --scene and --frames. Tests: every_pin_has_a_full_digest, raeas_build_is_tried_first_and_godotjss_after, setup_says_whose_build_and_why_not_the_one_before
shinyobjectza4a213e05e67
diff --git a/apps/engines/src/godot.rs b/apps/engines/src/godot.rsindex 5f55a667..bf24b3c5 100644--- a/apps/engines/src/godot.rs+++ b/apps/engines/src/godot.rs@@ -1,8 +1,9 @@//! `raea setup godot`, `raea godot types` and `raea godot open`; `raea godot run` is godot_run.rs. raea's Godot is//! Godot 4.6.1 with GodotJS (github.com/godotjs/GodotJS, MIT): Godot's whole API from TypeScript, on Godot's own//! JavaScript engine, JavaScriptCore on the Mac and QuickJS-ng on Windows and Linux (no V8). Godot without GodotJS-//! can't run a script, so raea uses GodotJS's editor build (the editor, headless or not, runs scripts and projects),-//! downloaded from its GitHub release into ~/.raea/tools/godot and checked against the sha256 pinned here.+//! can't run a script, so raea uses an editor build with GodotJS in it (the editor, headless or not, runs scripts and+//! projects): raea's own (GD9, sdk/godot/build), from raea's release, else GodotJS's, from its GitHub release, into+//! ~/.raea/tools/godot and checked against the sha256 pinned here.use std::path::{Path, PathBuf};use std::process::Command;@@ -10,39 +11,72 @@ use raea_app_tools::blender::own_dir;type R<T> = Result<T, String>;-pub const USAGE: &str = "raea setup godot [--check] (download Godot 4.6.1 with GodotJS, its TypeScript bindings (MIT), into ~/.raea/tools/godot: JavaScriptCore on the Mac, QuickJS on Windows and Linux; checked against its pinned sha256)\n raea godot run SCRIPT.ts [--project DIR] [--window] [--movie FILE [--fps N]] [--size WxH] [--timeout S] [ARGS...] (a TypeScript script against Godot's whole API through raea/godot: its default export gets the SceneTree and ARGS, headless unless --window; --movie writes every frame Godot draws (NAME.png numbered, or .avi) at a fixed --fps, 30 unless given; the project is DIR, else the nearest project.godot above the script, else an empty one; Godot quits when it returns)\n raea godot types [DIR] (the project's own TypeScript types from GodotJS: Godot's API with its scenes, resources and input actions, into DIR/typings)\n raea godot open [DIR] (the Godot editor on the project, GodotJS's, to edit its scenes)";+pub const USAGE: &str = "raea setup godot [--check] (download Godot 4.6.1 with GodotJS, its TypeScript bindings (MIT), into ~/.raea/tools/godot: JavaScriptCore on the Mac, QuickJS on Windows and Linux; raea's own build (the Mac's notarized), else GodotJS's, each checked against its pinned sha256)\n raea godot run [SCRIPT.ts] [--project DIR] [--window] [--movie FILE [--fps N] [--frames N]] [--scene res://X.tscn] [--size WxH] [--timeout S] [ARGS...] (a TypeScript script against Godot's whole API through raea/godot: its default export gets the SceneTree and ARGS, headless unless --window; --movie writes every frame Godot draws (NAME.png numbered, or .avi) at a fixed --fps, 30 unless given; the project is DIR, else the nearest project.godot above the script, else an empty one; Godot quits when it returns, or after --frames N; --scene plays a scene of the project under it, with no script needed; a scene in --window plays until the window is closed)\n raea godot types [DIR] (the project's own TypeScript types from GodotJS: Godot's API with its scenes, resources and input actions, into DIR/typings)\n raea godot open [DIR] (the Godot editor on the project, GodotJS's, to edit its scenes)";/// The GodotJS release raea downloads (github.com/godotjs/GodotJS/releases); sdk/godot/tools/gen.sh writes/// raea/godot's types from it, so the two move together.pub const RELEASE: &str = "v1.1.0.beta1-4.6.1";-/// One platform's download: the asset, its sha256 and size, and the program inside its one top folder.+/// raea's own builds of the same editors (GD9: sdk/godot/build's macos.sh, linux.py and windows.py, zipped by+/// package.sh; the Mac's signed with raea's Developer ID and notarized), files of raea's release of this tag.+pub const RAEA_RELEASE: &str = "v0.1.1";++/// Where raea's builds are downloaded from; RAEA_GODOT_FROM points elsewhere (a folder as file:///..., to rehearse).+fn raea_base() -> String {+ std::env::var("RAEA_GODOT_FROM").unwrap_or_else(|_| format!("https://github.com/shinyobjectz/raea/releases/download/{RAEA_RELEASE}"))+}++/// One platform's download: who built it, the asset, its sha256 and size, and the program inside its one top folder.struct Pin {+ by: &'static str,asset: &'static str,sha256: &'static str,size: u64,program: &'static str,}-fn pin() -> R<Pin> {- pin_for(std::env::consts::OS, std::env::consts::ARCH)+impl Pin {+ fn url(&self) -> String {+ match self.by {+ "raea" => format!("{}/{}", raea_base(), self.asset),+ _ => format!("https://github.com/godotjs/GodotJS/releases/download/{RELEASE}/{}", self.asset),+ }+ }}-/// A platform GodotJS doesn't build for is told how to bring its own build (GD2), never given a stock Godot.-fn pin_for(os: &str, arch: &str) -> R<Pin> {+fn pins() -> R<Vec<Pin>> {+ pins_for(std::env::consts::OS, std::env::consts::ARCH)+}++/// This platform's downloads in the order they're tried: raea's build, then GodotJS's (a release made before raea's+/// builds are among its files still installs). Both hold the program at the same path. A platform GodotJS doesn't+/// build for is told how to bring its own build (GD2), never given a stock Godot.+fn pins_for(os: &str, arch: &str) -> R<Vec<Pin>> {+ let raea = |asset, sha256, size, program| Pin { by: "raea", asset, sha256, size, program };+ let theirs = |asset, sha256, size, program| Pin { by: "GodotJS", asset, sha256, size, program };+ // GodotJS's Mac build: a universal app, ad-hoc signed; raea's: arm64, notarized+ let mac = theirs("macos-editor-app-4.6.1-jsc.zip", "8a3022cb07c9740b2acc4a0b6bba6be78fb2fe46ba172b13abd51e6829cdca95", 143_940_673, "Godot.app/Contents/MacOS/Godot");match (os, arch) {- // a universal app, ad-hoc signed- ("macos", _) => Ok(Pin { asset: "macos-editor-app-4.6.1-jsc.zip", sha256: "8a3022cb07c9740b2acc4a0b6bba6be78fb2fe46ba172b13abd51e6829cdca95", size: 143_940_673, program: "Godot.app/Contents/MacOS/Godot" }),- ("linux", "x86_64") => Ok(Pin { asset: "linux-editor-4.6.1-qjs-ng.zip", sha256: "daa91d6cff5862ed9e0b3776694fbe4ea0ebb474d244f46ffb3aa5af0318989d", size: 78_737_089, program: "godot.linuxbsd.editor.x86_64" }),- ("windows", "x86_64") => Ok(Pin { asset: "windows-editor-4.6.1-qjs-ng.zip", sha256: "041b761a945b6a34d40f508dbd1accca462d943d2941c3a1a4568f84dd29c1d4", size: 83_915_786, program: "godot.windows.editor.x86_64.exe" }),+ ("macos", "aarch64") => Ok(vec![raea("godot-4.6.1-raea-macos-arm64.zip", "17e66b8f99134a67db29ce82b88ace7f4c2e4ae651c80a3876ac6bd5e68a8a75", 69_132_728, "Godot.app/Contents/MacOS/Godot"), mac]),+ ("macos", _) => Ok(vec![mac]),+ ("linux", "x86_64") => Ok(vec![+ raea("godot-4.6.1-raea-linux-x86_64.zip", "9c86b3e6af0f8cc8a7158685103ccbe15d10aaf246067ec47509909647726b54", 78_737_822, "godot.linuxbsd.editor.x86_64"),+ theirs("linux-editor-4.6.1-qjs-ng.zip", "daa91d6cff5862ed9e0b3776694fbe4ea0ebb474d244f46ffb3aa5af0318989d", 78_737_089, "godot.linuxbsd.editor.x86_64"),+ ]),+ ("windows", "x86_64") => Ok(vec![+ raea("godot-4.6.1-raea-windows-x86_64.zip", "cf360e7a350f04a1cdb8d1ac475ebfc81518b5b49831ab2ed693f5d8127265e5", 73_171_472, "godot.windows.editor.x86_64.exe"),+ theirs("windows-editor-4.6.1-qjs-ng.zip", "041b761a945b6a34d40f508dbd1accca462d943d2941c3a1a4568f84dd29c1d4", 83_915_786, "godot.windows.editor.x86_64.exe"),+ ]),(os, arch) => Err(format!("GodotJS has no build for {os} {arch}: build it (github.com/godotjs/GodotJS) and `git config --global raea.godot PATH`")),}}-/// The release a download in own_dir came from (raea.json beside it), so a moved pin downloads again.-fn own_release() -> Option<String> {- let text = std::fs::read_to_string(own_dir("godot").ok()?.join("raea.json")).ok()?;- serde_json::from_str::<serde_json::Value>(&text).ok()?["release"].as_str().map(str::to_string)+/// Whether the download in own_dir is one this raea pins (raea.json beside it names its sha256), so a moved pin+/// downloads again.+fn own_is_pinned() -> bool {+ let Some(text) = own_dir("godot").ok().and_then(|d| std::fs::read_to_string(d.join("raea.json")).ok()) else { return false };+ let had = serde_json::from_str::<serde_json::Value>(&text).ok().and_then(|v| v["sha256"].as_str().map(str::to_string));+ pins().is_ok_and(|ps| ps.iter().any(|p| had.as_deref() == Some(p.sha256)))}/// The Godot to use and where it came from: `git config --global raea.godot` (a GodotJS build of your own), else@@ -52,7 +86,7 @@ pub fn find() -> Option<(PathBuf, &'static str)> {if let Some(p) = configured.filter(|p| p.is_file()) {return Some((p, "raea.godot in git config"));}- let own = own_dir("godot").ok()?.join(pin().ok()?.program);+ let own = own_dir("godot").ok()?.join(pins().ok()?.first()?.program);own.is_file().then_some((own, "raea's download"))}@@ -68,16 +102,37 @@ fn version(bin: &Path) -> R<String> {out.lines().map(str::trim).find(|l| l.chars().next().is_some_and(|c| c.is_ascii_digit())).map(str::to_string).ok_or_else(|| format!("{} --version printed no version", bin.display()))}-/// Downloads the pinned GodotJS editor into ~/.raea/tools/godot and returns its program.+/// Downloads the first pinned editor that comes and matches (raea's, then GodotJS's) into ~/.raea/tools/godot and+/// returns its program, and which it was.fn download() -> R<(PathBuf, String)> {- let p = pin()?;+ let mut not = Vec::new();+ for p in pins()? {+ match download_one(&p) {+ Ok(program) => return Ok((program, downloaded(&p, ¬))),+ Err(e) => not.push(format!("{}'s build: {e}", p.by)),+ }+ }+ Err(format!("no Godot downloaded: {}", not.join("; ")))+}++/// What `raea setup godot` says it downloaded: whose build, and why any tried before it wasn't.+fn downloaded(p: &Pin, not: &[String]) -> String {+ let by = if p.by == "raea" { format!("raea's build ({}, from raea's {RAEA_RELEASE} release)", p.asset) } else { format!("GodotJS's build ({}, from GodotJS {RELEASE})", p.asset) };+ let before = if not.is_empty() { String::new() } else { format!("; {}", not.join("; ")) };+ format!("downloaded Godot 4.6.1 with GodotJS, {by}{before}")+}++/// One pinned download, checked and unpacked into ~/.raea/tools/godot: its program.+fn download_one(p: &Pin) -> R<PathBuf> {let dir = own_dir("godot")?;let tmp = dir.with_file_name("godot.download");let _ = std::fs::remove_dir_all(&tmp);std::fs::create_dir_all(&tmp).map_err(|e| format!("{}: {e}", tmp.display()))?;let file = tmp.join(p.asset);- let url = format!("https://github.com/godotjs/GodotJS/releases/download/{RELEASE}/{}", p.asset);- raea_app_tools::blender::run(Command::new("curl").args(["-fL", "--retry", "3", "-o"]).arg(&file).arg(&url), "downloading Godot with GodotJS")?;+ let url = p.url();+ if raea_app_tools::blender::run(Command::new("curl").args(["-fsSL", "--retry", "3", "-o"]).arg(&file).arg(&url), "downloading Godot with GodotJS").is_err() {+ return Err(format!("{url} didn't download"));+ }let size = std::fs::metadata(&file).map_err(|e| e.to_string())?.len();if size != p.size || raea_app_tools::blender::sha256(&file)? != p.sha256 {return Err(format!("{} doesn't match the sha256 raea pins ({size} bytes); nothing installed (it's in {})", p.asset, tmp.display()));@@ -94,11 +149,12 @@ fn download() -> R<(PathBuf, String)> {use std::os::unix::fs::PermissionsExt;std::fs::set_permissions(&program, std::fs::Permissions::from_mode(0o755)).map_err(|e| e.to_string())?;}- std::fs::write(unpacked.join("raea.json"), serde_json::json!({ "release": RELEASE, "asset": p.asset, "sha256": p.sha256 }).to_string()).map_err(|e| e.to_string())?;+ let release = if p.by == "raea" { RAEA_RELEASE } else { RELEASE };+ std::fs::write(unpacked.join("raea.json"), serde_json::json!({ "by": p.by, "release": release, "asset": p.asset, "sha256": p.sha256 }).to_string()).map_err(|e| e.to_string())?;let _ = std::fs::remove_dir_all(&dir);std::fs::rename(&unpacked, &dir).map_err(|e| format!("{}: {e}", dir.display()))?;let _ = std::fs::remove_dir_all(&tmp);- Ok((dir.join(p.program), format!("downloaded GodotJS {RELEASE} ({}) from github.com/godotjs/GodotJS", p.asset)))+ Ok(dir.join(p.program))}/// A zip's files into `to`, without its one top folder (every GodotJS zip has one).@@ -129,10 +185,10 @@ fn unzip(file: &Path, to: &Path) -> R<()> {/// `raea setup godot [--check]`.pub fn setup(args: &[String]) -> R<String> {let check = args.iter().any(|a| a == "--check");- let current = own_release().as_deref() == Some(RELEASE);+ let current = own_is_pinned();let (bin, from) = match find() {Some((p, from)) if from != "raea's download" || current => (p, from.to_string()),- _ if check => return Err(format!("no Godot with GodotJS {RELEASE}: raea setup godot downloads it")),+ _ if check => return Err("no Godot with GodotJS that this raea pins: raea setup godot downloads it".into()),_ => download()?,};let v = version(&bin)?;@@ -168,7 +224,9 @@ fn types(args: &[String]) -> R<String> {/// `raea godot open [DIR]`: the editor on the project, left running.fn open(args: &[String]) -> R<String> {let dir = project(args.get(2))?;- Command::new(binary()?).args(["--editor", "--path"]).arg(&dir).spawn().map_err(|e| e.to_string())?;+ // its output isn't raea's: a caller reading raea's (the app) would otherwise wait until the editor is closed+ let null = std::process::Stdio::null;+ Command::new(binary()?).args(["--editor", "--path"]).arg(&dir).stdin(null()).stdout(null()).stderr(null()).spawn().map_err(|e| e.to_string())?;Ok(format!("APPLIED the Godot editor (GodotJS) is opening {}", dir.display()))}@@ -187,21 +245,46 @@ mod tests {use super::*;#[test]- fn this_platform_has_a_pin_with_a_full_digest() {- if let Ok(p) = pin() {- assert_eq!(p.sha256.len(), 64);- assert!(p.sha256.chars().all(|c| c.is_ascii_hexdigit() && !c.is_ascii_uppercase()));- assert!(p.asset.ends_with(".zip") && p.size > 50_000_000);+ fn every_pin_has_a_full_digest() {+ for (os, arch) in [("macos", "aarch64"), ("macos", "x86_64"), ("linux", "x86_64"), ("windows", "x86_64")] {+ for p in pins_for(os, arch).unwrap() {+ assert_eq!(p.sha256.len(), 64);+ assert!(p.sha256.chars().all(|c| c.is_ascii_hexdigit() && !c.is_ascii_uppercase()));+ assert!(p.asset.ends_with(".zip") && p.size > 50_000_000);+ }}}+ #[test]+ fn raeas_build_is_tried_first_and_godotjss_after() {+ for (os, arch) in [("macos", "aarch64"), ("linux", "x86_64"), ("windows", "x86_64")] {+ let ps = pins_for(os, arch).unwrap();+ assert_eq!(ps.iter().map(|p| p.by).collect::<Vec<_>>(), ["raea", "GodotJS"], "{os}");+ assert_eq!(ps[0].program, ps[1].program, "{os}: both hold the program at one path");+ assert!(ps[1].url().starts_with("https://github.com/godotjs/GodotJS/releases/download/v1.1.0.beta1-4.6.1/"));+ }+ let mac = pins_for("macos", "aarch64").unwrap();+ if std::env::var_os("RAEA_GODOT_FROM").is_none() {+ assert_eq!(mac[0].url(), "https://github.com/shinyobjectz/raea/releases/download/v0.1.1/godot-4.6.1-raea-macos-arm64.zip");+ }+ // raea builds the Mac editor for arm64 only: an Intel Mac gets GodotJS's universal app+ assert_eq!(pins_for("macos", "x86_64").unwrap().iter().map(|p| p.by).collect::<Vec<_>>(), ["GodotJS"]);+ }++ #[test]+ fn setup_says_whose_build_and_why_not_the_one_before() {+ let ps = pins_for("linux", "x86_64").unwrap();+ assert_eq!(downloaded(&ps[0], &[]), "downloaded Godot 4.6.1 with GodotJS, raea's build (godot-4.6.1-raea-linux-x86_64.zip, from raea's v0.1.1 release)");+ let not = ["raea's build: https://x/godot-4.6.1-raea-linux-x86_64.zip didn't download".to_string()];+ assert_eq!(downloaded(&ps[1], ¬), "downloaded Godot 4.6.1 with GodotJS, GodotJS's build (linux-editor-4.6.1-qjs-ng.zip, from GodotJS v1.1.0.beta1-4.6.1); raea's build: https://x/godot-4.6.1-raea-linux-x86_64.zip didn't download");+ }+#[test]fn a_platform_godotjs_doesnt_build_for_is_told_to_bring_its_own() {for (os, arch) in [("linux", "aarch64"), ("windows", "aarch64"), ("freebsd", "x86_64")] {- let e = pin_for(os, arch).err().unwrap_or_default();+ let e = pins_for(os, arch).err().unwrap_or_default();assert!(e.contains("github.com/godotjs/GodotJS") && e.contains("git config --global raea.godot PATH"), "{os} {arch}: {e}");}- assert!(pin_for("macos", "aarch64").is_ok() && pin_for("linux", "x86_64").is_ok() && pin_for("windows", "x86_64").is_ok());}#[test]diff --git a/sdk/godot/build/macos.sh b/sdk/godot/build/macos.shindex 0fec27b3..deaf1e95 100755--- a/sdk/godot/build/macos.sh+++ b/sdk/godot/build/macos.sh@@ -26,3 +26,9 @@ strip -S "$B" 2>/dev/null || truemkdir -p "$W/out" && cp "$B" "$W/out/" && (cd "$W/out" && shasum -a 256 godot.macos.editor.arm64 | tee godot.sha256)echo " size: $(stat -f %z "$W/out/godot.macos.editor.arm64")""$W/out/godot.macos.editor.arm64" --headless --version 2>&1 | tail -1+# the editor as Godot.app, made from Godot's own template as its official Mac builds are (package.sh signs it with+# the template's editor entitlements: JavaScriptCore's JIT needs allow-jit under the hardened runtime)+rm -rf "$W/out/Godot.app" && cp -R misc/dist/macos_tools.app "$W/out/Godot.app" && mkdir -p "$W/out/Godot.app/Contents/MacOS"+cp "$B" "$W/out/Godot.app/Contents/MacOS/Godot" && chmod +x "$W/out/Godot.app/Contents/MacOS/Godot"+cp misc/dist/macos/editor.entitlements "$W/out/editor.entitlements"+echo " $W/out/Godot.app"diff --git a/sdk/godot/build/package.sh b/sdk/godot/build/package.shnew file mode 100755index 00000000..a8bfe889--- /dev/null+++ b/sdk/godot/build/package.sh@@ -0,0 +1,60 @@+#!/usr/bin/env bash+# GD9: raea's Godot editors as the zips `raea setup godot` downloads from raea's release (apps/engines/src/godot.rs pins+# each one's sha256 and size). Each zip has one top folder, as GodotJS's do. The Mac editor (macos.sh's Godot.app) is+# signed with raea's Developer ID under the hardened runtime with Godot's editor entitlements, notarized and stapled;+# Linux's (linux.py) and Windows' (windows.py, both executables) are zipped as built.+# sdk/godot/build/package.sh MAC_OUT LINUX_DIR WINDOWS_DIR DEST+# MAC_OUT is macos.sh's WORK/out; LINUX_DIR and WINDOWS_DIR hold what linux.py and windows.py wrote to the raea-gd9+# volume. Needs the signing keychain (~/Library/Keychains/raea-signing.keychain-db, its password in the login keychain)+# and RAEA_NOTARY_ENV, a file that sets ASC_KEY_PATH, ASC_KEY_ID and ASC_ISSUER_ID. Prints each zip's pin line.+set -euo pipefail+M=${1:?usage: package.sh MAC_OUT LINUX_DIR WINDOWS_DIR DEST}; L=${2:?}; WIN=${3:?}; D=${4:?}+V=4.6.1-raea+kc="$HOME/Library/Keychains/raea-signing.keychain-db"+mkdir -p "$D"+D=$(cd "$D" && pwd)+work=$(mktemp -d)+trap 'rm -rf "$work"' EXIT++pin() { # ZIP PROGRAM+ printf '%s %s %s %s\n' "$(basename "$1")" "$(shasum -a 256 "$1" | cut -d' ' -f1)" "$(stat -f %z "$1")" "$2"+}++echo "[mac] sign, notarize, staple"+top="$work/godot-$V-macos-arm64"+mkdir -p "$top" && ditto "$M/Godot.app" "$top/Godot.app"+app="$top/Godot.app"+security unlock-keychain -p "$(security find-generic-password -s raea-signing-keychain -a raea -w)" "$kc"+identity=$(security find-identity -v -p codesigning "$kc" | awk '/Developer ID Application/ { print $2; exit }')+[ -n "$identity" ] || { echo "FAIL no Developer ID Application identity in $kc"; exit 1; }+codesign --force --options runtime --timestamp --keychain "$kc" --entitlements "$M/editor.entitlements" -s "$identity" "$app"+codesign --verify --deep --strict "$app"+ditto -c -k --keepParent "$app" "$work/notarize.zip"+set -a; . "${RAEA_NOTARY_ENV:?RAEA_NOTARY_ENV: a file that sets ASC_KEY_PATH, ASC_KEY_ID and ASC_ISSUER_ID}"; set +a+xcrun notarytool submit "$work/notarize.zip" --key "$ASC_KEY_PATH" --key-id "$ASC_KEY_ID" --issuer "$ASC_ISSUER_ID" --wait --output-format json | tee "$work/notary.json"+grep -q '"status" *: *"Accepted"' "$work/notary.json" || { echo "FAIL notarization: $(cat "$work/notary.json")"; exit 1; }+xcrun stapler staple "$app"+spctl --assess --type execute -vv "$app" 2>&1 | head -3+mac="$D/godot-$V-macos-arm64.zip"+rm -f "$mac" && (cd "$work" && ditto -c -k --norsrc --noextattr --keepParent "godot-$V-macos-arm64" "$mac")++echo "[linux]"+top="$work/godot-$V-linux-x86_64"+mkdir -p "$top" && cp "$L/godot.linuxbsd.editor.x86_64" "$top/" && chmod +x "$top/godot.linuxbsd.editor.x86_64"+(cd "$L" && shasum -a 256 -c godot.sha256)+linux="$D/godot-$V-linux-x86_64.zip"+rm -f "$linux" && (cd "$work" && zip -qrX "$linux" "godot-$V-linux-x86_64")++echo "[windows]"+top="$work/godot-$V-windows-x86_64"+mkdir -p "$top" && cp "$WIN/godot.windows.editor.x86_64.exe" "$WIN/godot.windows.editor.x86_64.console.exe" "$top/"+(cd "$WIN" && shasum -a 256 -c godot.sha256)+win="$D/godot-$V-windows-x86_64.zip"+rm -f "$win" && (cd "$work" && zip -qrX "$win" "godot-$V-windows-x86_64")++echo "[pins] asset sha256 size program"+{+ pin "$mac" "Godot.app/Contents/MacOS/Godot"+ pin "$linux" "godot.linuxbsd.editor.x86_64"+ pin "$win" "godot.windows.editor.x86_64.exe"+} | tee "$D/pins.txt"diff --git a/sdk/godot/build/verify.sh b/sdk/godot/build/verify.shindex 0055f6e5..628c4a9f 100755--- a/sdk/godot/build/verify.sh+++ b/sdk/godot/build/verify.sh@@ -10,7 +10,9 @@ H=$W/home; rm -rf "$H" "$W/types-ours" "$W/types-theirs"; mkdir -p "$H" "$W/typefor d in ours theirs; do printf 'config_version=5\n\n[application]\nconfig/name="t"\n' > "$W/types-$d/project.godot"; doneprintf '[raea]\n\tgodot = %s\n' "$E" > "$H/.gitconfig"echo "[1] smoke on our build"-(cd "$(dirname "$0")/../../.." && HOME=$H "$RAEA" godot run sdk/godot/test/scripts/smoke.ts alpha --beta 2>&1 | tail -3)+smoke=$(cd "$(dirname "$0")/../../.." && HOME=$H "$RAEA" godot run sdk/godot/test/scripts/smoke.ts alpha --beta 2>&1 | tail -3)+echo "$smoke"+grep -q 'PASS raea/godot' <<<"$smoke" || { echo "FAIL the smoke script didn't pass on $E"; exit 1; }echo "[2] types from our build, then from GodotJS's"(HOME=$H "$RAEA" godot types "$W/types-ours" 2>&1 | tail -1)("$RAEA" godot types "$W/types-theirs" 2>&1 | tail -1)diff --git a/sdk/godot/build/windows.py b/sdk/godot/build/windows.pynew file mode 100644index 00000000..e862aa5e--- /dev/null+++ b/sdk/godot/build/windows.py@@ -0,0 +1,72 @@+# GD9: raea's own GodotJS editor for Windows x86_64 (QuickJS-ng), cross-built on Linux with MinGW-w64 (GCC, posix+# threads), the toolchain Godot's own Windows releases are built with. GodotJS's CI builds the same sources with MSVC on+# windows-latest (build_windows.yml at v1.1.0.beta1-4.6.1): Godot 4.6.1-stable with GodotJS as modules/GodotJS, its JS+# runtime built by pnpm (scripts/out), AccessKit-c 0.18.0. Vulkan and OpenGL; no Direct3D 12 or ANGLE, which raea's+# runs don't use. Writes the stripped editor and its sha256 to a Modal volume; nothing is uploaded anywhere else.+# MODAL_PROFILE=<profile> modal run sdk/godot/build/windows.py+import subprocess++import modal++image = (+ modal.Image.from_registry("ubuntu:24.04", add_python="3.12")+ .apt_install("build-essential", "pkg-config", "git", "curl", "ca-certificates", "xz-utils", "unzip", "mingw-w64")+ .run_commands(+ "update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix",+ "update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix",+ )+ .pip_install("scons==4.9.1")+)+vol = modal.Volume.from_name("raea-gd9", create_if_missing=True)+app = modal.App("raea-gd9-windows", image=image)++SCRIPT = r"""+set -euo pipefail+cd /build+echo "[1] node and pnpm"+v=$(curl -fsSL https://nodejs.org/dist/latest-v24.x/SHASUMS256.txt | awk '/linux-x64.tar.xz/{print $2}')+curl -fsSL -o "$v" "https://nodejs.org/dist/latest-v24.x/$v"+curl -fsSL https://nodejs.org/dist/latest-v24.x/SHASUMS256.txt | grep " $v\$" | sha256sum -c - >/dev/null && echo " $v checked"+mkdir node && tar -xf "$v" -C node --strip-components 1 && rm "$v"+export PATH=/build/node/bin:$PATH+corepack enable --install-directory /build/node/bin && corepack prepare [email protected] --activate >/dev/null+x86_64-w64-mingw32-g++ --version | head -1+echo "[2] sources"+git clone -q --depth 1 --branch 4.6.1-stable https://github.com/godotengine/godot.git godot+git clone -q --depth 1 --branch v1.1.0.beta1-4.6.1 --recurse-submodules --shallow-submodules https://github.com/godotjs/GodotJS.git godot/modules/GodotJS+echo " godot $(git -C godot rev-parse --short HEAD), GodotJS $(git -C godot/modules/GodotJS rev-parse --short HEAD), quickjs-ng $(git -C godot/modules/GodotJS/quickjs-ng rev-parse --short HEAD)"+curl -fsSL -o ak.zip https://github.com/AccessKit/accesskit-c/releases/download/0.18.0/accesskit-c-0.18.0.zip+unzip -q -o ak.zip -d /build && rm ak.zip && ls /build/accesskit-c-0.18.0/lib/windows/x86_64 2>/dev/null | tr '\n' ' '; echo+echo "[3] GodotJS's JS runtime (scripts/out)"+cd godot/modules/GodotJS+pnpm install --frozen-lockfile >/dev/null 2>&1 || pnpm install >/dev/null+pnpm build >/dev/null+ls scripts/out | tr '\n' ' '; echo+cd /build/godot+echo "[4] scons: editor, QuickJS-ng, MinGW"+start=$(date +%s)+BUILD_NAME=raea scons -j$(nproc) platform=windows target=editor use_mingw=yes use_quickjs_ng=yes d3d12=no \+ module_text_server_fb_enabled=yes accesskit_sdk_path=/build/accesskit-c-0.18.0/ skip_js_runtime=yes \+ > /build/scons.log 2>&1 || { grep -n -m 20 -i 'error' /build/scons.log; tail -40 /build/scons.log; exit 1; }+echo " built in $(( $(date +%s) - start )) s"+ls -la bin/+B=$(ls bin/godot.windows.editor.x86_64*.exe | grep -v console | head -1)+x86_64-w64-mingw32-strip "$B"+mkdir -p /out/windows && cp bin/godot.windows.editor.x86_64*.exe /out/windows/ && (cd /out/windows && sha256sum *.exe | tee godot.sha256)+x86_64-w64-mingw32-objdump -p "$B" | awk '/DLL Name/{print " needs " $3}' | sort -u+echo " size: $(stat -c %s "$B")"+"""++[email protected](cpu=16, memory=32768, timeout=5400, volumes={"/out": vol})+def build() -> str:+ import os+ os.makedirs("/build", exist_ok=True)+ r = subprocess.run(["bash", "-c", SCRIPT], capture_output=True, text=True)+ vol.commit()+ return r.stdout + ("\n--stderr--\n" + r.stderr[-4000:] if r.stderr.strip() else "") + f"\nexit {r.returncode}"++[email protected]_entrypoint()+def main():+ print(build.remote())