summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2024-03-11 21:40:28 -0400
committerJon Santmyer <jon@jonsantmyer.com>2024-03-11 21:40:28 -0400
commit50392995d6e7f3a10fb74bb2f9073a4790f8933c (patch)
treec89b067b3bacf35e092af5c31fb6e6a08921f31c /scripts
downloadjove-env-master.tar.gz
jove-env-master.tar.bz2
jove-env-master.zip
simple env with basic test init programHEADmaster
Diffstat (limited to 'scripts')
-rw-r--r--scripts/binutils-2.41.diff78
-rw-r--r--scripts/buildtools.mk63
-rw-r--r--scripts/gcc-13.2.0.diff78
3 files changed, 219 insertions, 0 deletions
diff --git a/scripts/binutils-2.41.diff b/scripts/binutils-2.41.diff
new file mode 100644
index 0000000..363e9ca
--- /dev/null
+++ b/scripts/binutils-2.41.diff
@@ -0,0 +1,78 @@
+diff -rNau binutils-2.41/bfd/config.bfd binutils-2.41-patched/bfd/config.bfd
+--- binutils-2.41/bfd/config.bfd 2023-07-02 19:00:00.000000000 -0400
++++ binutils-2.41-patched/bfd/config.bfd 2024-03-10 23:19:47.522036207 -0400
+@@ -714,6 +714,13 @@
+ targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec i386_pei_vec x86_64_pe_vec x86_64_pei_vec"
+ want64=true
+ ;;
++#ifdef BFD64
++ x86_64-*-jove*)
++ targ_defvec=x86_64_elf64_vec
++ targ_selvecs=i386_elf32_vec
++ want64=true
++ ;;
++#endif
+ x86_64-*-mingw* | x86_64-*-pe | x86_64-*-pep | x86_64-*-cygwin)
+ targ_defvec=x86_64_pe_vec
+ targ_selvecs="x86_64_pe_vec x86_64_pei_vec x86_64_pe_big_vec x86_64_elf64_vec i386_pe_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec pdb_vec"
+diff -rNau binutils-2.41/config.sub binutils-2.41-patched/config.sub
+--- binutils-2.41/config.sub 2023-07-02 19:00:00.000000000 -0400
++++ binutils-2.41-patched/config.sub 2024-03-10 23:33:30.546506756 -0400
+@@ -1758,7 +1758,7 @@
+ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
+ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
+ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
+- | fiwix* | mlibc* )
++ | fiwix* | mlibc* | jove* )
+ ;;
+ # This one is extra strict with allowed versions
+ sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
+diff -rNau binutils-2.41/gas/configure.tgt binutils-2.41-patched/gas/configure.tgt
+--- binutils-2.41/gas/configure.tgt 2023-07-02 19:00:00.000000000 -0400
++++ binutils-2.41-patched/gas/configure.tgt 2024-03-10 23:22:33.351797968 -0400
+@@ -231,6 +231,7 @@
+ i386-*-haiku*) fmt=elf em=haiku ;;
+ i386-*-genode*) fmt=elf ;;
+ i386-*-bsd*) fmt=aout em=386bsd ;;
++ i386-*-jove*) fmt=elf ;;
+ i386-*-netbsd*-gnu* | \
+ i386-*-knetbsd*-gnu | \
+ i386-*-netbsd* | \
+diff -rNau binutils-2.41/ld/configure.tgt binutils-2.41-patched/ld/configure.tgt
+--- binutils-2.41/ld/configure.tgt 2023-07-02 19:00:00.000000000 -0400
++++ binutils-2.41-patched/ld/configure.tgt 2024-03-10 23:24:16.838998259 -0400
+@@ -1053,6 +1053,9 @@
+ targ_extra_ofiles="deffilep.o pdb.o pep-dll.o pe-dll.o"
+ test "$targ" != "$host" && LIB_PATH='${tooldir}/lib/w32api'
+ ;;
++x86_64-*-jove*) targ_emul=elf_x86_64_jove
++ targ_extra_emuls="elf_x86_64"
++ ;;
+ x86_64-*-mingw*) targ_emul=i386pep ;
+ targ_extra_emuls=i386pe
+ targ_extra_ofiles="deffilep.o pdb.o pep-dll.o pe-dll.o"
+diff -rNau binutils-2.41/ld/emulparams/elf_x86_64_jove.sh binutils-2.41-patched/ld/emulparams/elf_x86_64_jove.sh
+--- binutils-2.41/ld/emulparams/elf_x86_64_jove.sh 1969-12-31 19:00:00.000000000 -0500
++++ binutils-2.41-patched/ld/emulparams/elf_x86_64_jove.sh 2024-03-10 23:25:24.152469179 -0400
+@@ -0,0 +1 @@
++source_sh ${srcdir}/emulparams/elf_x86_64.sh
+diff -rNau binutils-2.41/ld/Makefile.am binutils-2.41-patched/ld/Makefile.am
+--- binutils-2.41/ld/Makefile.am 2023-07-02 19:00:00.000000000 -0400
++++ binutils-2.41-patched/ld/Makefile.am 2024-03-10 23:26:41.812851367 -0400
+@@ -951,6 +951,7 @@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64tilegx_be.Pc@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_mipsel_haiku.Pc@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64.Pc@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_jove.Pc@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Pc@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Pc@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Pc@am__quote@
+@@ -455,6 +455,7 @@
+ eelf64tilegx_be.c \
+ eelf_mipsel_haiku.c \
+ eelf_x86_64.c \
++ eelf_x86_64_jove.c \
+ eelf_x86_64_cloudabi.c \
+ eelf_x86_64_fbsd.c \
+ eelf_x86_64_haiku.c \
+
diff --git a/scripts/buildtools.mk b/scripts/buildtools.mk
new file mode 100644
index 0000000..6160d01
--- /dev/null
+++ b/scripts/buildtools.mk
@@ -0,0 +1,63 @@
+BINUTILS_VERSION := 2.41
+GCC_VERSION := 13.2.0
+TOOLCHAIN := x86_64-jove
+
+TOOLDIR := $(PWD)/tools
+SCRIPTDIR := $(PWD)/scripts
+TOOL_SRCDIR := $(TOOLDIR)/src
+TOOL_BUILDDIR := $(TOOLDIR)/build
+SYSROOT_DIR := $(PWD)/sysroot
+
+BINUTILS_ARCHIVE := binutils-$(BINUTILS_VERSION).tar.gz
+BINUTILS_URL := https://ftp.gnu.org/gnu/binutils/$(BINUTILS_ARCHIVE)
+BINUTILS_PATCHFILE := $(SCRIPTDIR)/binutils-$(BINUTILS_VERSION).diff
+BINUTILS_SRCDIR := $(TOOL_SRCDIR)/binutils-$(BINUTILS_VERSION)
+BINUTILS_BUILDDIR := $(TOOL_BUILDDIR)/binutils
+
+GCC_ARCHIVE := gcc-$(GCC_VERSION).tar.gz
+GCC_URL := https://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VERSION)/$(GCC_ARCHIVE)
+GCC_PATCHFILE := $(SCRIPTDIR)/gcc-$(GCC_VERSION).diff
+GCC_SRCDIR := $(TOOL_SRCDIR)/gcc-$(GCC_VERSION)
+GCC_BUILDDIR := $(TOOL_BUILDDIR)/gcc
+
+all: $(TOOLDIR) $(BINUTILS_BUILDDIR) $(GCC_BUILDDIR)
+
+.ONESHELL:
+$(BINUTILS_BUILDDIR): $(BINUTILS_SRCDIR)
+ mkdir -p $(BINUTILS_BUILDDIR)
+ cd $(BINUTILS_BUILDDIR)
+ $(BINUTILS_SRCDIR)/configure --target=$(TOOLCHAIN) --prefix="$(TOOLDIR)" --with-sysroot=$(SYSROOT_DIR) --disable-nls --disable-werror
+ make -j4
+ make install
+
+.PHONY: $(GCC_BUILDDIR)
+.ONESHELL:
+$(GCC_BUILDDIR): $(GCC_SRCDIR)
+ mkdir -p $(GCC_BUILDDIR)
+ cd $(GCC_BUILDDIR)
+ $(GCC_SRCDIR)/configure --target=$(TOOLCHAIN) --prefix="$(TOOLDIR)" --disable-nls --enable-languages=c --with-sysroot=$(SYSROOT_DIR)
+ make all-gcc -j4
+ make all-target-libgcc -j4
+ make install-gcc
+ make install-target-libgcc
+
+$(BINUTILS_SRCDIR): $(TOOLDIR)/$(BINUTILS_ARCHIVE)
+ tar -xzvf $(TOOLDIR)/$(BINUTILS_ARCHIVE) -C $(TOOL_SRCDIR)
+ patch --directory=$(BINUTILS_SRCDIR) --strip=1 < $(BINUTILS_PATCHFILE)
+ cd $(BINUTILS_SRCDIR)/ld && automake
+
+$(GCC_SRCDIR): $(TOOLDIR)/$(GCC_ARCHIVE)
+ tar -xzvf $(TOOLDIR)/$(GCC_ARCHIVE) -C $(TOOL_SRCDIR)
+ patch --directory=$(GCC_SRCDIR) --strip=1 < $(GCC_PATCHFILE)
+ cd $(GCC_SRCDIR) && ./contrib/download_prerequisites
+
+$(TOOLDIR)/$(BINUTILS_ARCHIVE):
+ wget $(BINUTILS_URL) -O $(TOOLDIR)/$(BINUTILS_ARCHIVE)
+
+$(TOOLDIR)/$(GCC_ARCHIVE):
+ wget $(GCC_URL) -O $(TOOLDIR)/$(GCC_ARCHIVE)
+
+$(TOOLDIR):
+ mkdir -p $(TOOLDIR)
+ mkdir -p $(TOOL_SRCDIR)
+ mkdir -p $(TOOL_BUILDDIR)
diff --git a/scripts/gcc-13.2.0.diff b/scripts/gcc-13.2.0.diff
new file mode 100644
index 0000000..45dbe98
--- /dev/null
+++ b/scripts/gcc-13.2.0.diff
@@ -0,0 +1,78 @@
+diff -rNau gcc-13.2.0/config.sub gcc-13.2.0-patched/config.sub
+--- gcc-13.2.0/config.sub 2023-07-27 04:13:03.000000000 -0400
++++ gcc-13.2.0-patched/config.sub 2024-03-10 23:33:56.596289806 -0400
+@@ -1749,7 +1749,7 @@
+ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
+ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
+ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
+- | fiwix* )
++ | fiwix* | jove* )
+ ;;
+ # This one is extra strict with allowed versions
+ sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
+diff -rNau gcc-13.2.0/fixincludes/mkfixinc.sh gcc-13.2.0-patched/fixincludes/mkfixinc.sh
+--- gcc-13.2.0/fixincludes/mkfixinc.sh 2023-07-27 04:13:03.000000000 -0400
++++ gcc-13.2.0-patched/fixincludes/mkfixinc.sh 2024-03-10 23:49:24.405547826 -0400
+@@ -20,6 +20,7 @@
+ powerpcle-*-eabisim* | \
+ powerpcle-*-eabi* | \
+ *-*-vxworks7* | \
++ *-*-jove* | \
+ *-musl* )
+ # IF there is no include fixing,
+ # THEN create a no-op fixer and exit
+diff -rNau gcc-13.2.0/gcc/config/jove.h gcc-13.2.0-patched/gcc/config/jove.h
+--- gcc-13.2.0/gcc/config/jove.h 1969-12-31 19:00:00.000000000 -0500
++++ gcc-13.2.0-patched/gcc/config/jove.h 2024-03-10 23:44:13.570083205 -0400
+@@ -0,0 +1,8 @@
++#undef TARGET_JOVE
++#define TARGET_JOVE 1
++
++#undef LIB_SPEC
++#define LIB_SPEC "-lc"
++
++#undef STARTFILE_SPEC
++#define STARTFILE_SPEC "crt0.o%s crti.o%s crtbegin.o%s"
++
++#undef ENDFILE_SPEC
++#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
+diff -rNau gcc-13.2.0/gcc/config.gcc gcc-13.2.0-patched/gcc/config.gcc
+--- gcc-13.2.0/gcc/config.gcc 2023-07-27 04:13:04.000000000 -0400
++++ gcc-13.2.0-patched/gcc/config.gcc 2024-03-10 23:42:11.659119360 -0400
+@@ -843,6 +843,12 @@
+ *-*-fuchsia*)
+ native_system_header_dir=/include
+ ;;
++*-*-jove*)
++ gas=yes
++ gnu_ld=yes
++ default_use_cxa_atexit=yes
++ use_gcc_stdint=provide
++ ;;
+ *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu | *-*-uclinuxfdpiceabi)
+ extra_options="$extra_options gnu-user.opt"
+ gas=yes
+@@ -1891,6 +1897,9 @@
+ x86_64-*-freebsd*)
+ tm_file="${tm_file} i386/unix.h i386/att.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h"
+ ;;
++x86_64-*-jove*)
++ tm_file="${tm_file} i386/unix.h i386/att.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h jove.h"
++ ;;
+ i[34567]86-*-netbsdelf*)
+ tm_file="${tm_file} i386/unix.h i386/att.h elfos.h ${nbsd_tm_file} i386/netbsd-elf.h"
+ extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
+diff -rNau gcc-13.2.0/libgcc/config.host gcc-13.2.0-patched/libgcc/config.host
+--- gcc-13.2.0/libgcc/config.host 2023-07-27 04:13:07.000000000 -0400
++++ gcc-13.2.0-patched/libgcc/config.host 2024-03-10 23:47:32.669386544 -0400
+@@ -386,6 +386,10 @@
+ esac
+
+ case ${host} in
++x86_64-*-jove*)
++ tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
++ extra_parts="$extra_parts crti.o crtbegin.o crtend.o crtn.o"
++ ;;
+ aarch64*-*-elf | aarch64*-*-rtems*)
+ extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o"
+ extra_parts="$extra_parts crtfastmath.o"