meta: replace cmake mono-build system with a custom build co-ordinator

every system component now has its own self-contained build system, and a
seed file describing the component and its build system and dependencies.

a new tool, meadow, collects and uses these seed files to build the
components into a full system. meadow also manages the target system root
and a host prefix where toolchain tools are installed to.

the build system has also been updated to use a new $ARCH-rosetta-gcc
compiler, and the patches files necessary to build it have been
added to toolchain/cross-compiler.
This commit is contained in:
2026-07-19 13:34:32 +01:00
parent 59034be9e6
commit 1ec33767ab
104 changed files with 7111 additions and 257 deletions
+105
View File
@@ -0,0 +1,105 @@
import os
import sys
import tomli
from dependency import *
from config import Config
from path import Path
all_targets = {}
class Target(DependencyItem):
def all_targets():
global all_targets
return all_targets
def current_target():
name = Config.get('target.name')
if not name or name not in all_targets:
return None
return all_targets[name]
def load_file(self, path):
with open(path, mode='rb') as f:
self.__data = tomli.load(f)
def __init_dependencies(self):
self.__dependencies = {}
if 'dependency' not in self.__data:
return
dependency = self.__data['dependency']
if 'seeds' in dependency:
seeds = dependency['seeds']
self.__dependencies = {}
for s in seeds:
self.__dependencies[s] = SeedDependency(parent=self.name(), name=s)
def __init__(self, **kwargs):
super().__init__()
if 'path' not in kwargs:
return
self.load_file(kwargs['path'])
self.__init_dependencies()
def name(self):
if not 'target' in self.__data:
return None
s = self.__data['target']
if 'name' in s:
return s['name']
return None
def dependencies(self):
return self.__dependencies
def base_components(self):
if not 'target' in self.__data:
return None
s = self.__data['target']
if 'base_components' in s:
return s['base_components']
return []
def install_prefix(self, **kwargs):
make_relative = kwargs.get('make_relative', False)
path = self.__data.get('target', {}).get('default_prefix', '/')
if make_relative:
path = Path(path).remove_root().get_path
return path
def scan_directory(root_path):
global all_targets
for root, dirs, files in os.walk(root_path):
for f in files:
if not f.endswith('.target'):
continue
target_path = os.path.join(root, f)
target = None
try:
target = Target(path=target_path)
except tomli.TOMLDecodeError as e:
print('Err: Failed to parse target file {}\n {}'.format(target_path, e))
continue
all_targets[target.name()] = target