From 9881158e624b3b10b8956f9c4d3980af9ecc581a Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Sat, 22 Nov 2025 15:02:21 -0600 Subject: [PATCH] init --- examples/http_download_actor.ce | 2 ++ meson.build | 28 +++++++++++++++++++++++++--- scripts/engine.cm | 6 ++++-- source/cell.c | 4 +--- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/examples/http_download_actor.ce b/examples/http_download_actor.ce index 9bbce384..3951e09d 100644 --- a/examples/http_download_actor.ce +++ b/examples/http_download_actor.ce @@ -3,6 +3,8 @@ var http = use('http'); var os = use('os'); +log.console("HERE") + // Actor state var state = { downloading: false, diff --git a/meson.build b/meson.build index 3081efc3..c94fad48 100644 --- a/meson.build +++ b/meson.build @@ -379,16 +379,38 @@ if strip_enabled add_project_link_arguments('-s', language: ['c', 'cpp']) endif -cell = executable('cell', sources, +cell_bin = executable('cell_bin', sources, dependencies: deps, include_directories: includers, link_args: link, build_rpath: '$ORIGIN', - install: true + install: false ) cell_dep = declare_dependency( - link_with: cell + link_with: cell_bin +) + +# Create core.zip from scripts folder +zip_target = custom_target('core.zip', + output: 'core.zip', + command: ['sh', '-c', 'cd ' + meson.project_source_root() / 'scripts' + ' && zip -r ' + meson.current_build_dir() / 'core.zip' + ' .'], + build_by_default: true, + build_always_stale: true +) + +# Create final cell executable by appending core.zip to cell_bin +cell = custom_target('cell', + input: [cell_bin, zip_target], + output: 'cell' + exe_ext, + command: [ + 'sh', '-c', + 'cp "$1" "$3" && cat "$2" >> "$3" && chmod +x "$3"', + 'cell-cat', '@INPUT0@', '@INPUT1@', '@OUTPUT@' + ], + build_by_default: true, + install: true, + install_dir: get_option('bindir') ) tests = [ diff --git a/scripts/engine.cm b/scripts/engine.cm index 6a028fbd..d60455eb 100644 --- a/scripts/engine.cm +++ b/scripts/engine.cm @@ -117,7 +117,7 @@ if (!io.exists('.cell')) { var module_alias = {} var use_cache = {} -var BASEPATH = 'scripts/base' + MOD_EXT +var BASEPATH = 'base' + MOD_EXT var script = io.slurp(BASEPATH) var fnname = "base" script = `(function ${fnname}() { ${script}; })` @@ -170,6 +170,7 @@ globalThis.use = function use(file, ...args) { // If only embedded module exists, return it if (!path && embed_mod) { + log.console(`loaded module ${file}`) use_cache[file] = embed_mod return embed_mod } @@ -245,7 +246,8 @@ globalThis.use = function use(file, ...args) { // Cache the result use_cache[file] = ret - + log.console(`loaded module ${file}`) + return ret } diff --git a/source/cell.c b/source/cell.c index 8ae2d85e..e1cad690 100644 --- a/source/cell.c +++ b/source/cell.c @@ -947,10 +947,8 @@ int main(int argc, char **argv) prosperon = argv[0]; PHYSFS_init(argv[0]); - /* Mount core.zip first - this is critical! */ + /* Mount core.zip attached to executable - this is now mandatory! */ int mounted = prosperon_mount_core(); - if (!mounted) mounted = PHYSFS_mount("core.zip", NULL, 0); - if (!mounted) mounted = PHYSFS_mount("scripts", NULL, 0); if (!mounted) { printf("ERROR: Could not mount core. Reason: %s\n", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); return 1;