diff options
Diffstat (limited to 'setup.sh')
-rw-r--r-- | setup.sh | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..bb20c18 --- /dev/null +++ b/setup.sh @@ -0,0 +1,76 @@ +#!/bin/sh + +LIMINE_TAG=v7.5.1 +MINTSUKI_HEADERS_COMMIT=dd3abd2d7147efc4170dff478d3b7730bed14147 +BINUTILS_TAG=binutils-2_42 +GCC_TAG=releases/gcc-14.1.0 + +PROJECT_ROOT="$(pwd)" + +if [ -e .setup-complete ]; then + echo setup has already completed. refusing to run again. + echo to run again anyway, delete .setup-complete + echo to clean the dependencies, run clean-dependencies.sh + exit 1 +fi + +if [ -e .setup-started ]; then + echo setup has already been started, but failed. refusing to run again. + echo to run again anyway, delete .setup-started + echo to clean the dependencies, run clean-dependencies.sh + exit 1 +fi + +if [ -z "$MAKEOPTS" ]; then + MAKEOPTS=-j$(nproc) +fi + +touch .setup-started + +set -e + +mkdir -p dependencies toolchain/usr +cd dependencies + +git clone --depth 1 -b "$LIMINE_TAG" https://github.com/limine-bootloader/limine limine +cd limine +./bootstrap +./configure --enable-bios --enable-bios-cd +make $MAKEOPTS +cd .. + +git clone --depth 1 https://github.com/osdev0/freestanding-headers mintsuki-headers +cd mintsuki-headers +git fetch --depth=1 origin "$MINTSUKI_HEADERS_COMMIT" +git checkout "$MINTSUKI_HEADERS_COMMIT" +patch stddef.h "$PROJECT_ROOT"/patches/mintsuki-stddef.patch +cd .. + +git clone --depth 1 -b "$BINUTILS_TAG" https://sourceware.org/git/binutils-gdb binutils +mkdir binutils/build +cd binutils/build +../configure --disable-gdb --target=x86_64-elf --prefix="$PROJECT_ROOT"/toolchain/usr +make $MAKEOPTS +make $MAKEOPTS install +cd ../.. + +git clone --depth 1 -b "$GCC_TAG" https://gcc.gnu.org/git/gcc gcc +mkdir gcc/build +cd gcc/build +../configure --disable-fixed-point --disable-gcov --disable-multilib \ + --disable-shared --disable-hosted-libstdcxx --enable-languages=c++ \ + --target=x86_64-elf --enable-cstdio=stdio_pure \ + --prefix="$PROJECT_ROOT"/toolchain/usr --without-headers \ + --enable-cxx-flags=-mno-sse +make $MAKEOPTS all-gcc +make $MAKEOPTS install-gcc +make $MAKEOPTS all-target-libgcc +make $MAKEOPTS install-target-libgcc +make $MAKEOPTS all-target-libstdc++-v3 +make $MAKEOPTS install-target-libstdc++-v3 +patch "$PROJECT_ROOT"/toolchain/usr/x86_64-elf/include/c++/14.1.0/memory \ + "$PROJECT_ROOT"/patches/gcc-memory.patch +cd ../.. + +cd .. +touch .setup-complete |