core is now at packages/core
This commit is contained in:
@@ -35,9 +35,9 @@ all source for every single part of a cell program are located in the cell shop.
|
|||||||
|
|
||||||
the cell shop looks like this:
|
the cell shop looks like this:
|
||||||
.cell
|
.cell
|
||||||
shop.toml <---- shop configuration
|
|
||||||
packages
|
packages
|
||||||
gitea.pockle.world/john/cell <--- this is the core cell
|
core <--- this is the core cell
|
||||||
|
gitea.pockle.world/john/cell <---- core contents. this is linked to core
|
||||||
gitea.pockle.world/john/prosperon
|
gitea.pockle.world/john/prosperon
|
||||||
cell.toml <--- the manifest of the package
|
cell.toml <--- the manifest of the package
|
||||||
mod1.cm
|
mod1.cm
|
||||||
|
|||||||
27
shop.cm
27
shop.cm
@@ -231,13 +231,10 @@ function get_global_build_dir() {
|
|||||||
|
|
||||||
// Get the core directory (in the global shop)
|
// Get the core directory (in the global shop)
|
||||||
Shop.get_core_dir = function() {
|
Shop.get_core_dir = function() {
|
||||||
return global_shop_path + '/core'
|
return get_packages_dir() + '/' + core_package
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_core_package()
|
var core_package = 'core'
|
||||||
{
|
|
||||||
return "gitea.pockle.world/john/cell"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the links file path (in the global shop)
|
// Get the links file path (in the global shop)
|
||||||
function get_links_path() {
|
function get_links_path() {
|
||||||
@@ -800,7 +797,7 @@ var open_dls = {}
|
|||||||
var script_form = function(path, script, pkg) {
|
var script_form = function(path, script, pkg) {
|
||||||
var pkg_arg = pkg ? `'${pkg}'` : 'null'
|
var pkg_arg = pkg ? `'${pkg}'` : 'null'
|
||||||
var relative_use_fn = `def use = function(path) { return globalThis.use(path, ${pkg_arg});}`
|
var relative_use_fn = `def use = function(path) { return globalThis.use(path, ${pkg_arg});}`
|
||||||
var fn = `(function setup_module($_){ ${relative_use_fn}; ${script}})`
|
var fn = `(function setup_module($_, args){ ${relative_use_fn}; ${script}})`
|
||||||
return fn
|
return fn
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -823,23 +820,21 @@ Shop.get_flags = get_flags
|
|||||||
function resolve_mod_fn(path, pkg) {
|
function resolve_mod_fn(path, pkg) {
|
||||||
if (!fd.is_file(path)) throw new Error(`path ${path} is not a file`)
|
if (!fd.is_file(path)) throw new Error(`path ${path} is not a file`)
|
||||||
|
|
||||||
var content = fd.slurp(path)
|
var content = text(fd.slurp(path))
|
||||||
var obj = pull_from_cache(content)
|
var script = script_form(path, content, pkg);
|
||||||
|
|
||||||
|
var obj = pull_from_cache(utf8.encode(script))
|
||||||
if (obj) {
|
if (obj) {
|
||||||
var fn = js.compile_unblob(obj)
|
var fn = js.compile_unblob(obj)
|
||||||
return js.eval_compile(fn)
|
return js.eval_compile(fn)
|
||||||
}
|
}
|
||||||
|
|
||||||
var form = script_form
|
|
||||||
|
|
||||||
var script = form(path, text(content), pkg);
|
|
||||||
|
|
||||||
// Compile name is just for debug/stack traces
|
// Compile name is just for debug/stack traces
|
||||||
var compile_name = pkg ? pkg + ':' + path : 'local:' + path
|
var compile_name = pkg ? pkg + ':' + path : 'local:' + path
|
||||||
|
|
||||||
var fn = js.compile(compile_name, script)
|
var fn = js.compile(compile_name, script)
|
||||||
|
|
||||||
put_into_cache(content, js.compile_blob(fn))
|
put_into_cache(utf8.encode(script), js.compile_blob(fn))
|
||||||
|
|
||||||
return js.eval_compile(fn)
|
return js.eval_compile(fn)
|
||||||
}
|
}
|
||||||
@@ -1763,8 +1758,7 @@ Shop.build_package = function(package)
|
|||||||
var link_flags = '-fPIC -shared'
|
var link_flags = '-fPIC -shared'
|
||||||
|
|
||||||
// Link against core package dylib (unless we ARE the core)
|
// Link against core package dylib (unless we ARE the core)
|
||||||
var core_pkg = get_core_package()
|
if (package != core_package) {
|
||||||
if (package != core_pkg) {
|
|
||||||
var lib_dir = get_shared_lib_path()
|
var lib_dir = get_shared_lib_path()
|
||||||
if (platform == 'macOS') {
|
if (platform == 'macOS') {
|
||||||
link_flags += ' -L' + lib_dir + ' -Wl,-rpath,@loader_path'
|
link_flags += ' -L' + lib_dir + ' -Wl,-rpath,@loader_path'
|
||||||
@@ -1773,7 +1767,7 @@ Shop.build_package = function(package)
|
|||||||
} else if (platform == 'Windows') {
|
} else if (platform == 'Windows') {
|
||||||
link_flags += ' -L' + lib_dir
|
link_flags += ' -L' + lib_dir
|
||||||
}
|
}
|
||||||
link_flags += ' -l' + get_core_package()
|
link_flags += ' -l' + core_package
|
||||||
}
|
}
|
||||||
|
|
||||||
var ldflags = get_flags(config, platform, 'LDFLAGS')
|
var ldflags = get_flags(config, platform, 'LDFLAGS')
|
||||||
@@ -2016,6 +2010,7 @@ Shop.list_shop_packages = function() {
|
|||||||
var lock = Shop.load_lock()
|
var lock = Shop.load_lock()
|
||||||
var list = []
|
var list = []
|
||||||
for (var k in lock) {
|
for (var k in lock) {
|
||||||
|
log.console(k)
|
||||||
if (lock[k]) list.push(lock[k])
|
if (lock[k]) list.push(lock[k])
|
||||||
}
|
}
|
||||||
return list
|
return list
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#define ENGINE "internal/engine.cm"
|
#define ENGINE "internal/engine.cm"
|
||||||
#define CELL_SHOP_DIR ".cell"
|
#define CELL_SHOP_DIR ".cell"
|
||||||
#define CELL_CORE_DIR "core"
|
#define CELL_CORE_DIR "packages/core"
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ for (var i = 0; i < args.length; i++) {
|
|||||||
|
|
||||||
var packages = shop.list_shop_packages()
|
var packages = shop.list_shop_packages()
|
||||||
|
|
||||||
log.console("Checking for updates (" + packages.length + " packages)...")
|
log.console("Checking for updates (" + text(packages.length) + " packages)...")
|
||||||
|
|
||||||
// 1. Update all packages
|
// 1. Update all packages
|
||||||
for (var info of packages) {
|
for (var info of packages) {
|
||||||
|
|||||||
Reference in New Issue
Block a user