Files
kryon/scripts/build_android_runtime.py
T
waozi 214415b321 Add a first-class Android target as an installable APK
An android profile now builds a real Android application from the same
sources as the desktop: the kryon tool scaffolds a droid/ Gradle project
beside the application on the first build and assembles a debug APK with
the NDK. The canonical host (android_run) drives the session over
raylib's NativeActivity backend with the shared viewport policies; a
generated NativeActivity reports insets, cutouts, IME state, density,
dark mode and orientation through JNI natives written in Ziran, forwards
soft-keyboard text through the session-owned input queue, and an
unconsumed back key finishes the activity. Generation runs the whole Zi
graph through ziran ir --project so application module names may repeat
Kryon module names.
2026-10-08 03:18:27 -03:00

33 lines
858 B
Python

#!/usr/bin/env python3
"""Build the pinned Ziran host runtime (libziran.a) for an Android target."""
import argparse
from pathlib import Path
import subprocess
p = argparse.ArgumentParser()
p.add_argument("--source", type=Path, required=True)
p.add_argument("--output", type=Path, required=True)
p.add_argument("--cc", required=True)
p.add_argument("--ar", default="ar")
p.add_argument("--objcopy", default="objcopy")
p.add_argument("--flags", default="-O2 -fPIC")
a = p.parse_args()
source = a.source.resolve()
output = a.output.resolve()
command = [
"make",
"-j4",
"-C",
str(source),
"BOOTSTRAP=1",
"BUILD_DIR=" + str(output),
"CC=" + a.cc,
"AR=" + a.ar,
"OBJCOPY=" + a.objcopy,
"CFLAGS=" + a.flags,
"FRAMEFLAGS=-Wframe-larger-than=16384",
str(output / "libziran.a"),
]
subprocess.run(command, check=True)