41 lines
1.3 KiB
Bash
Executable file
41 lines
1.3 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
# Extract binutils and gcc
|
|
# You can try changing versions, if you want.
|
|
# The official setup is binutils 2.32 and GCC 9.2.0
|
|
tar -xvf binutils-2.32.tar.xz
|
|
tar -xvf gcc-9.2.0.tar.xz
|
|
|
|
# We'll eventuall change to, like, i686-fenix or something,
|
|
# but, for now, this is what we'll use.
|
|
# Besides, we'd need patches for a custom OS target
|
|
TARGET=i686-elf
|
|
PREFIX="$HOME/opt/cross"
|
|
PATH="$PREFIX/bin:$PATH"
|
|
|
|
# Go ahead and make sure the prefix exists
|
|
mkdir -p $PREFIX
|
|
|
|
# Binutils build
|
|
mkdir build-binutils
|
|
cd build-binutils
|
|
# Binutils w/o native language support. Feel free to remove --disable-nls
|
|
# if you want stuff in your native language. Also, enable sysroot support.
|
|
../binutils-2.32/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
|
|
make
|
|
make install
|
|
|
|
# GCC build
|
|
cd ..
|
|
mkdir build-gcc
|
|
cd build-gcc
|
|
# Check for $PREFIX/bin in PATH
|
|
which -- $TARGET-as || exit 1
|
|
# GCC w/o NLS and with only C support. Also, it shouldn't rely on having
|
|
# headers available to it. You can optionally remove --disable-nls for
|
|
# nativle language stuffs, or add ,C++ to languages, if you wanna have C++.
|
|
../gcc-9.2.0/configure --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
|