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
@@ -0,0 +1,139 @@
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 4dde5321f23..94c1a871ec2 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -242,7 +242,17 @@ esac
case "${targ}" in
# START OF targmatch.h
+ i[3-7]86-*-rosetta*)
+ targ_defvec=i386_elf32_vec
+ targ_selvecs=
+ targ64_selvecs=x86_64_elf64_vec
+ ;;
#ifdef BFD64
+ x86_64-*-rosetta*)
+ targ_defvec=x86_64_elf64_vec
+ targ_selvecs=i386_elf32_vec
+ want64=true
+ ;;
aarch64-*-darwin*)
targ_defvec=aarch64_mach_o_vec
targ_selvecs="arm_mach_o_vec mach_o_le_vec mach_o_be_vec mach_o_fat_vec"
diff --git a/config.sub b/config.sub
index 3d35cde174d..19cd8f07cd7 100755
--- a/config.sub
+++ b/config.sub
@@ -2102,6 +2102,7 @@ case $os in
| rhapsody* \
| riscix* \
| riscos* \
+ | rosetta* \
| rtems* \
| rtmk* \
| rtu* \
diff --git a/gas/configure.tgt b/gas/configure.tgt
index f0ea55d9def..4f194e70501 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -126,6 +126,7 @@ esac
generic_target=${cpu_type}-$vendor-$os
# Note: This table is alpha-sorted, please try to keep it that way.
case ${generic_target} in
+ i386-*-rosetta*) fmt=elf em=gnu;;
aarch64*-*-elf*) fmt=elf;;
aarch64*-*-fuchsia*) fmt=elf;;
aarch64*-*-haiku*) fmt=elf em=haiku ;;
diff --git a/ld/Makefile.am b/ld/Makefile.am
index c219662d2e3..8d17fed7581 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -153,6 +153,7 @@ endif
# These all start with e so 'make clean' can find them.
ALL_EMULATION_SOURCES = \
+ eelf_i386_rosetta.c \
eaix5ppc.c \
eaix5rs6.c \
eaixppc.c \
@@ -373,6 +374,7 @@ ALL_EMULATION_SOURCES = \
ALL_EMULATIONS = $(ALL_EMULATION_SOURCES:.c=.@OBJEXT@)
ALL_64_EMULATION_SOURCES = \
+ eelf_x86_64_rosetta.c \
eaarch64elf.c \
eaarch64elf32.c \
eaarch64elf32b.c \
diff --git a/ld/Makefile.in b/ld/Makefile.in
index f1ba6af5269..a4d76c4cc0b 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -668,6 +668,7 @@ LIBIBERTY = ../libiberty/libiberty.a
# These all start with e so 'make clean' can find them.
ALL_EMULATION_SOURCES = \
+ eelf_i386_rosetta.c \
eaix5ppc.c \
eaix5rs6.c \
eaixppc.c \
@@ -887,6 +888,7 @@ ALL_EMULATION_SOURCES = \
ALL_EMULATIONS = $(ALL_EMULATION_SOURCES:.c=.@OBJEXT@)
ALL_64_EMULATION_SOURCES = \
+ eelf_x86_64_rosetta.c \
eaarch64elf.c \
eaarch64elf32.c \
eaarch64elf32b.c \
@@ -1474,6 +1476,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_be.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_fbsd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_haiku.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_rosetta.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_sol2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_vxworks.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_iamcu.Po@am__quote@
@@ -1482,6 +1485,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_rosetta.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_sol2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eh8300elf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eh8300elf_linux.Po@am__quote@
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 3e158913b89..53c091fb78f 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -82,6 +82,13 @@ fi
# Please try to keep this table more or less in alphabetic order - it
# makes it much easier to lookup a specific archictecture.
case "${targ}" in
+i[3-7]86-*-rosetta*) targ_emul=elf_i386_rosetta
+ targ_extra_emuls=elf_i386
+ targ64_extra_emuls="elf_x86_64_rosetta elf_x86_64"
+ ;;
+x86_64-*-rosetta*) targ_emul=elf_x86_64_rosetta
+ targ_extra_emuls="elf_i386_rosetta elf_x86_64 elf_i386"
+ ;;
aarch64_be-*-elf) targ_emul=aarch64elfb
targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b armelfb armelf"
;;
diff --git a/ld/emulparams/elf_i386_rosetta.sh b/ld/emulparams/elf_i386_rosetta.sh
new file mode 100644
index 00000000000..002e918bc53
--- /dev/null
+++ b/ld/emulparams/elf_i386_rosetta.sh
@@ -0,0 +1,4 @@
+source_sh ${srcdir}/emulparams/elf_i386.sh
+TEXT_START_ADDR=0x08000000
+GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
diff --git a/ld/emulparams/elf_x86_64_rosetta.sh b/ld/emulparams/elf_x86_64_rosetta.sh
new file mode 100644
index 00000000000..4ddde5ab2a5
--- /dev/null
+++ b/ld/emulparams/elf_x86_64_rosetta.sh
@@ -0,0 +1,3 @@
+source_sh ${srcdir}/emulparams/elf_x86_64.sh
+GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
@@ -0,0 +1,14 @@
[command]
name = 'build-compiler'
description = 'Build a GCC cross-compiler that targets the Rosetta operating system'
[dependency]
seeds = [
'libc-headers',
'magenta-headers',
]
[exec]
args = [ 'src:build.py']
# vim: ft=toml
+31
View File
@@ -0,0 +1,31 @@
import os
class Builder:
def get_prefix(self):
return os.environ.get('MEADOW_NATIVE_ROOT', None)
def get_target(self):
env = os.environ
target = os.environ.get('MEADOW_TARGET_PLATFORM', None)
parts = target.split('-')
return f'{parts[0]}-rosetta'
def download(self):
pass
def configure(self):
pass
def build(self):
pass
def install(self):
pass
print(f'building cross compiler for {get_gcc_target()}, installed to {get_prefix()}')
@@ -0,0 +1 @@
../binutils-gdb/configure --target=x86_64-rosetta --prefix=/opt/cross-rosetta --with-sysroot=/opt/cross-rosetta --disable-nls --disable-werror --enable-default-execstack=no --with-gmp=/opt/homebrew --enable-shared
@@ -0,0 +1 @@
../gcc/configure --target=x86_64-rosetta --prefix=/opt/cross-rosetta --with-sysroot=/Users/wash/projects/rosetta/build/target-root --disable-nls --enable-languages=c,c++ --enable-shared --enable-initfini-array --with-gmp=/opt/homebrew
File diff suppressed because it is too large Load Diff