build: Pull make_toolchain.sh on bootstrap
This commit is contained in:
parent
79b0d531cb
commit
2280e2c346
|
@ -5,6 +5,7 @@
|
|||
/toolchain-files
|
||||
/limine-efi
|
||||
/freestanding_headers
|
||||
/make_toolchain.sh
|
||||
/ovmf*
|
||||
*.o
|
||||
*.d
|
||||
|
|
|
@ -10,6 +10,7 @@ cd "$srcdir"
|
|||
[ -d freestanding_headers ] || git clone https://github.com/mintsuki/freestanding_headers.git
|
||||
[ -d libgcc-binaries ] || git clone https://github.com/mintsuki/libgcc-binaries.git
|
||||
[ -d limine-efi ] || git clone https://github.com/limine-bootloader/limine-efi.git
|
||||
[ -f make_toolchain.sh ] || curl -o make_toolchain.sh https://gist.github.com/mintsuki/50fca7022e09f241e40809168662493d/raw/c7eb3dd24100da888893dcee6e8d6b577613b577/make_toolchain.sh
|
||||
|
||||
automake_libdir="$(automake --print-libdir)"
|
||||
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
srcdir="$(dirname "$0")"
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
cd "$srcdir"
|
||||
|
||||
if [ -z "$TARGET" ]; then
|
||||
set +x
|
||||
echo "TARGET not specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TARGET=$TARGET-elf
|
||||
BINUTILSVERSION=2.38
|
||||
GCCVERSION=12.1.0
|
||||
|
||||
if command -v gmake; then
|
||||
export MAKE=gmake
|
||||
else
|
||||
export MAKE=make
|
||||
fi
|
||||
|
||||
if command -v gtar; then
|
||||
export TAR=gtar
|
||||
else
|
||||
export TAR=tar
|
||||
fi
|
||||
|
||||
export CFLAGS="-O2 -pipe"
|
||||
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
if [ "$(uname)" = "OpenBSD" ]; then
|
||||
# OpenBSD has an awfully ancient GCC which fails to build our toolchain.
|
||||
# Force clang/clang++.
|
||||
export CC="clang"
|
||||
export CXX="clang++"
|
||||
fi
|
||||
|
||||
mkdir -p toolchain && cd toolchain
|
||||
PREFIX="$(pwd -P)"
|
||||
|
||||
export MAKEFLAGS="-j$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || psrinfo -tc 2>/dev/null || echo 1)"
|
||||
|
||||
export PATH="$PREFIX/bin:$PATH"
|
||||
|
||||
if [ ! -f binutils-$BINUTILSVERSION.tar.gz ]; then
|
||||
curl -o binutils-$BINUTILSVERSION.tar.gz https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILSVERSION.tar.gz
|
||||
fi
|
||||
if [ ! -f gcc-$GCCVERSION.tar.gz ]; then
|
||||
curl -o gcc-$GCCVERSION.tar.gz https://ftp.gnu.org/gnu/gcc/gcc-$GCCVERSION/gcc-$GCCVERSION.tar.gz
|
||||
fi
|
||||
|
||||
rm -rf build
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
$TAR -zxf ../binutils-$BINUTILSVERSION.tar.gz
|
||||
$TAR -zxf ../gcc-$GCCVERSION.tar.gz
|
||||
|
||||
mkdir build-binutils
|
||||
cd build-binutils
|
||||
../binutils-$BINUTILSVERSION/configure CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
|
||||
$MAKE
|
||||
$MAKE install
|
||||
cd ..
|
||||
|
||||
cd gcc-$GCCVERSION
|
||||
sed 's|http://gcc.gnu|https://gcc.gnu|g' < contrib/download_prerequisites > dp.sed
|
||||
mv dp.sed contrib/download_prerequisites
|
||||
chmod +x contrib/download_prerequisites
|
||||
./contrib/download_prerequisites --no-verify
|
||||
cd ..
|
||||
mkdir build-gcc
|
||||
cd build-gcc
|
||||
../gcc-$GCCVERSION/configure CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c --without-headers
|
||||
$MAKE all-gcc
|
||||
$MAKE all-target-libgcc
|
||||
$MAKE install-gcc
|
||||
$MAKE install-target-libgcc
|
||||
cd ..
|
Loading…
Reference in New Issue