Add web-canvas target: the web build on kryon's Canvas2D backend
Vendor kryon forward to master, which now carries the canvas Tier A backend (HTML5 Canvas2D through EM_JS: no libraylib.web.a, no GLFW, no WebGL). make web-canvas compiles the same generated app sources with kryon's src tree + canvas_backend.c under emcc (-sASYNCIFY so the while-loop frame pacing survives, -fexceptions for the set_main_loop unwind) and preloads locales and assets. Sync-account crypto and audio are not carried in this target: scripts/ksync-canvas-shim.c reports sync unavailable (the app runs local-only) and kryon's canvas audio is null-grade. The host page (web-assets/canvas_index.html) drives requestAnimationFrame from timers because embedded webviews suspend RAF while timers keep running. Verified in a real browser: full boot, storage, fonts, icons, theming, tinting, and input all render on the canvas backend.
This commit is contained in:
1 parent
f5bde88490
commit
d26cdd72a6
4 files changed
+353
-2
No files matched your search
@@ -479,7 +479,7 @@ MEDITATION_AUDIO_TRACKS := \
|
||||
|
||||
include $(KRYON_DIR)/mk/package-freebsd.mk
|
||||
|
||||
.PHONY: all native kryon-host install install-user uninstall stage package-freebsd deb package-deb deb-check rpm package-rpm rpm-check snap package-snap snap-cache-clean flatpak package-flatpak podman-check validate-desktop run run-fresh screenshot test ci dist appimage click click-verify vendor-prebuilds vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows font-subsets font-bundle-check clean clean-linux clean-native clean-vendor-builds android-avd android-audio-e2e android-check-keystore android-copy-assets android-copy-debug-apks android-copy-release-apks android-copy-bundle android-smoke android-local-properties android-debug android-release android-bundle android-install android-install-release android-clean validate-meditation-audio package-unpackaged-assets windows-runtime-assets-check windows windows64 windows32 web web-tools-check web-smoke-test web-smoke-test-firefox web-smoke-test-librewolf site chrome-web-store firefox-addons firefox-addons-lint firefox-addons-source-zip verify-firefox-addons
|
||||
.PHONY: web-canvas all native kryon-host install install-user uninstall stage package-freebsd deb package-deb deb-check rpm package-rpm rpm-check snap package-snap snap-cache-clean flatpak package-flatpak podman-check validate-desktop run run-fresh screenshot test ci dist appimage click click-verify vendor-prebuilds vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows font-subsets font-bundle-check clean clean-linux clean-native clean-vendor-builds android-avd android-audio-e2e android-check-keystore android-copy-assets android-copy-debug-apks android-copy-release-apks android-copy-bundle android-smoke android-local-properties android-debug android-release android-bundle android-install android-install-release android-clean validate-meditation-audio package-unpackaged-assets windows-runtime-assets-check windows windows64 windows32 web web-tools-check web-smoke-test web-smoke-test-firefox web-smoke-test-librewolf site chrome-web-store firefox-addons firefox-addons-lint firefox-addons-source-zip verify-firefox-addons
|
||||
.NOTPARALLEL: dist windows windows64 windows32 android-release android-bundle click deb package-deb rpm package-rpm snap package-snap flatpak package-flatpak
|
||||
|
||||
all: native
|
||||
@@ -1281,6 +1281,36 @@ $(WEB_TARGET): src/web_shell.html $(WEB_BOOT_JS) $(WEB_JS_TARGET) vendor/kryon/w
|
||||
cp -R site-icons $(WEB_DIST_DIR)/
|
||||
cp manifest.json $(WEB_DIST_DIR)/webmanifest.json
|
||||
|
||||
|
||||
# Canvas-backend web build: kryon's HTML5 Canvas2D Tier A backend instead of
|
||||
# raylib+GLFW — no libraylib.web.a, no WebGL. Sync-account crypto (liboqs)
|
||||
# and audio are not carried in this target: scripts/ksync-canvas-shim.c
|
||||
# reports sync unavailable and kryon's canvas audio is null-grade.
|
||||
WEB_CANVAS_DIR := $(BUILD_DIST_DIR)/web-canvas
|
||||
WEB_CANVAS_TARGET := $(WEB_CANVAS_DIR)/index.html
|
||||
KRYON_CANVAS_SRCS := $(filter-out $(KRYON_DIR)/src/ksync/% $(KRYON_RAYLIB_WRAPPERS_C),$(KRYON_SRCS))
|
||||
KSYNC_CANVAS_SHIM := scripts/ksync-canvas-shim.c
|
||||
|
||||
web-canvas: $(WEB_CANVAS_TARGET)
|
||||
|
||||
$(WEB_CANVAS_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
$(WEB_CANVAS_TARGET): Makefile $(WEB_SRC) $(KRYON_CANVAS_SRCS) $(KSYNC_CANVAS_SHIM) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_FILES) $(EMBEDDED_ASSETS_C) $(KRY_GEN_STAMP) web-assets/canvas_index.html | $(WEB_CANVAS_DIR)
|
||||
rm -f $(WEB_CANVAS_DIR)/index.data
|
||||
PATH="$${HOME}/emsdk/upstream/emscripten:$$PATH" $(WEB_CC) $(WEB_CFLAGS) \
|
||||
$(APP_INCLUDE) -I$(KRYON_DIR)/include \
|
||||
-I$(KRY_GEN_DIR) -I$(KRY_GEN_DIR)/src -I$(SQLITE_BUILD_DIR) \
|
||||
-DPLATFORM_WEB \
|
||||
-o $(WEB_CANVAS_DIR)/index.js \
|
||||
$(WEB_SRC) $(KRYON_CANVAS_SRCS) $(KSYNC_CANVAS_SHIM) $(SQLITE_SRC) \
|
||||
-sASYNCIFY -sASYNCIFY_STACK_SIZE=1048576 -fexceptions \
|
||||
-sFORCE_FILESYSTEM=1 -sFETCH=1 -lidbfs.js \
|
||||
-sALLOW_MEMORY_GROWTH=1 -sINITIAL_MEMORY=268435456 -sSTACK_SIZE=33554432 \
|
||||
-sEXPORTED_FUNCTIONS=_main,_malloc,_free \
|
||||
--preload-file locales --preload-file assets
|
||||
sed 's/{{APP_TITLE}}/$(APP_TITLE)/' web-assets/canvas_index.html > $@
|
||||
|
||||
android-copy-assets:
|
||||
$(MAKE) $(FONT_FILES)
|
||||
$(MAKE) $(EMBEDDED_ASSETS_C)
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
/* Canvas-build shim: the ksync account crypto (liboqs) and HTTP transport
|
||||
* are not carried in this target. Every entry point reports
|
||||
* unavailable/failure, so the app degrades to local-only mode. */
|
||||
#include "ksync_account.h"
|
||||
#include "ksync_sync.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int IsKsyncAccountAvailable(void) { return 0; }
|
||||
|
||||
int HasKsyncAccountValues(const KsyncAccount *account)
|
||||
{
|
||||
return account != NULL && account->public_id[0] != '\0' &&
|
||||
account->public_key_hex[0] != '\0' &&
|
||||
account->private_key_hex[0] != '\0';
|
||||
}
|
||||
|
||||
int CreateKsyncAccount(KsyncAccount *account)
|
||||
{
|
||||
(void)account;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ValidateKsyncAccount(KsyncAccount *account)
|
||||
{
|
||||
(void)account;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ParseKsyncAccountText(const char *text, KsyncAccount *account)
|
||||
{
|
||||
(void)text;
|
||||
(void)account;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ExportKsyncAccountText(const KsyncAccount *account, char *out,
|
||||
size_t out_size)
|
||||
{
|
||||
(void)account;
|
||||
(void)out;
|
||||
(void)out_size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ImportKsyncAccountFile(const char *filename, KsyncAccount *account)
|
||||
{
|
||||
(void)filename;
|
||||
(void)account;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ExportKsyncAccountFile(const KsyncAccount *account, const char *filename)
|
||||
{
|
||||
(void)account;
|
||||
(void)filename;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ExportKsyncAccountTextEncrypted(const KsyncAccount *account,
|
||||
const char *passphrase, char *out,
|
||||
size_t out_size)
|
||||
{
|
||||
(void)account;
|
||||
(void)passphrase;
|
||||
(void)out;
|
||||
(void)out_size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ExportKsyncAccountFileEncrypted(const KsyncAccount *account,
|
||||
const char *passphrase,
|
||||
const char *filename)
|
||||
{
|
||||
(void)account;
|
||||
(void)passphrase;
|
||||
(void)filename;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ParseKsyncAccountTextEncrypted(const char *text, const char *passphrase,
|
||||
KsyncAccount *account)
|
||||
{
|
||||
(void)text;
|
||||
(void)passphrase;
|
||||
(void)account;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ImportKsyncAccountFileEncrypted(const char *filename,
|
||||
const char *passphrase,
|
||||
KsyncAccount *account)
|
||||
{
|
||||
(void)filename;
|
||||
(void)passphrase;
|
||||
(void)account;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void KsyncSha256Hex(const uint8_t *data, size_t len,
|
||||
char out_hex[KSYNC_PUBLIC_ID_HEX_SIZE])
|
||||
{
|
||||
(void)data;
|
||||
(void)len;
|
||||
if(out_hex != NULL)
|
||||
out_hex[0] = '\0';
|
||||
}
|
||||
|
||||
int SignKsyncAccountHex(const KsyncAccount *account, const uint8_t *message,
|
||||
size_t message_len, char *out_signature_hex,
|
||||
size_t out_size)
|
||||
{
|
||||
(void)account;
|
||||
(void)message;
|
||||
(void)message_len;
|
||||
(void)out_signature_hex;
|
||||
(void)out_size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *GetKsyncSyncResultName(KsyncSyncResult result)
|
||||
{
|
||||
(void)result;
|
||||
return "unavailable";
|
||||
}
|
||||
|
||||
int IsKsyncSyncURLValid(const char *url)
|
||||
{
|
||||
(void)url;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int NormalizeKsyncSyncURL(const char *input, char *out, size_t out_size)
|
||||
{
|
||||
(void)input;
|
||||
(void)out;
|
||||
(void)out_size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int JoinKsyncSyncURL(char *out, size_t out_size, const char *base_url,
|
||||
const char *path)
|
||||
{
|
||||
(void)out;
|
||||
(void)out_size;
|
||||
(void)base_url;
|
||||
(void)path;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int JoinKsyncSyncWebSocketURL(char *out, size_t out_size,
|
||||
const char *base_url, const char *path)
|
||||
{
|
||||
(void)out;
|
||||
(void)out_size;
|
||||
(void)base_url;
|
||||
(void)path;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AppendKsyncSyncBuffer(KsyncSyncBuffer *buffer, const void *data,
|
||||
size_t bytes)
|
||||
{
|
||||
(void)buffer;
|
||||
(void)data;
|
||||
(void)bytes;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AppendKsyncSyncBufferJSONString(KsyncSyncBuffer *buffer,
|
||||
const char *text)
|
||||
{
|
||||
(void)buffer;
|
||||
(void)text;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FreeKsyncSyncBuffer(KsyncSyncBuffer *buffer)
|
||||
{
|
||||
if(buffer != NULL) {
|
||||
free(buffer->data);
|
||||
buffer->data = NULL;
|
||||
buffer->len = 0;
|
||||
buffer->cap = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int FindKsyncSyncJSONString(const char *json, const char *key,
|
||||
char *out, size_t out_size)
|
||||
{
|
||||
(void)json;
|
||||
(void)key;
|
||||
(void)out;
|
||||
(void)out_size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
long long FindKsyncSyncJSONInt64(const char *json, const char *key,
|
||||
long long fallback)
|
||||
{
|
||||
(void)json;
|
||||
(void)key;
|
||||
return fallback;
|
||||
}
|
||||
|
||||
void ClearKsyncSyncAuthToken(const KsyncSyncConfig *cfg)
|
||||
{
|
||||
(void)cfg;
|
||||
}
|
||||
|
||||
KsyncSyncResult LoginKsyncSync(const KsyncSyncConfig *cfg)
|
||||
{
|
||||
(void)cfg;
|
||||
return KSYNC_SYNC_NO_ACCOUNT;
|
||||
}
|
||||
|
||||
KsyncSyncResult RunKsyncSync(const KsyncSyncConfig *cfg)
|
||||
{
|
||||
(void)cfg;
|
||||
return KSYNC_SYNC_NO_ACCOUNT;
|
||||
}
|
||||
|
||||
KsyncSyncResult RequestKsyncSyncBearer(const KsyncSyncConfig *cfg,
|
||||
const char *method, const char *path,
|
||||
const char *body, char *out,
|
||||
size_t out_size)
|
||||
{
|
||||
(void)cfg;
|
||||
(void)method;
|
||||
(void)path;
|
||||
(void)body;
|
||||
(void)out;
|
||||
(void)out_size;
|
||||
return KSYNC_SYNC_NO_ACCOUNT;
|
||||
}
|
||||
|
||||
KsyncSyncResult DeleteKsyncSyncAccount(const KsyncSyncConfig *cfg)
|
||||
{
|
||||
(void)cfg;
|
||||
return KSYNC_SYNC_NO_ACCOUNT;
|
||||
}
|
||||
|
||||
int WrapKsyncSyncPayload(const KsyncAccount *account, const char *payload,
|
||||
char **out)
|
||||
{
|
||||
(void)account;
|
||||
(void)payload;
|
||||
(void)out;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int UnwrapKsyncSyncPayload(const KsyncAccount *account,
|
||||
const char *envelope_json, char **out)
|
||||
{
|
||||
(void)account;
|
||||
(void)envelope_json;
|
||||
(void)out;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int KsyncDefaultHttpRequest(const char *method, const char *url,
|
||||
const char *body, const char *const *headers,
|
||||
int header_count, KsyncSyncBuffer *response,
|
||||
long *status, void *user)
|
||||
{
|
||||
(void)method;
|
||||
(void)url;
|
||||
(void)body;
|
||||
(void)headers;
|
||||
(void)header_count;
|
||||
(void)response;
|
||||
(void)status;
|
||||
(void)user;
|
||||
return 0;
|
||||
}
|
||||
|
||||
KsyncSyncResult KsyncRemoteEventWait(const KsyncSyncConfig *cfg,
|
||||
const char *path)
|
||||
{
|
||||
(void)cfg;
|
||||
(void)path;
|
||||
return KSYNC_SYNC_NO_ACCOUNT;
|
||||
}
|
||||
|
||||
int KsyncWebSyncStart(const KsyncSyncConfig *cfg)
|
||||
{
|
||||
(void)cfg;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int KsyncWebSyncPoll(KsyncSyncResult *result, int *changed)
|
||||
{
|
||||
(void)result;
|
||||
(void)changed;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int KsyncWebRemoteEventsStart(const KsyncSyncConfig *cfg, const char *path)
|
||||
{
|
||||
(void)cfg;
|
||||
(void)path;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int KsyncWebRemoteEventsPoll(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Vendored
+1
-1
Submodule vendor/kryon updated: b15d70ee51...e0af9509c4.
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html><html><head><meta charset="utf-8"><title>{{APP_TITLE}}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>html,body{margin:0;height:100%;background:#0a0a0c}canvas{display:block;margin:0 auto}</style>
|
||||
</head><body><canvas id="canvas"></canvas>
|
||||
<script>
|
||||
/* Embedded webviews can suspend requestAnimationFrame while still running
|
||||
timers; drive frames from timers so the app's RAF-based loop keeps
|
||||
rendering. Real browsers are unaffected. */
|
||||
window.requestAnimationFrame = (fn) => setTimeout(() => fn(performance.now()), 16);
|
||||
Module = { canvas: document.getElementById('canvas') };
|
||||
</script>
|
||||
<script src="index.js"></script></body></html>
|
||||
Reference in new issue
Block a user