Add setup.sh to build cross compiler
This commit is contained in:
commit
5d7081cf44
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/i686-elf-gcc/
|
||||
*.xz
|
||||
/build-*/
|
||||
/gcc-*/
|
||||
/binutils-*/
|
60
setup.sh
Executable file
60
setup.sh
Executable file
@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
# First install the following commands:
|
||||
# * gcc
|
||||
# * make
|
||||
# * bison
|
||||
# * flex
|
||||
# * texi2any (texinfo package)
|
||||
# * wget
|
||||
# And the following libraries:
|
||||
# * gmp (libgmp-dev)
|
||||
# * mpc (libmpc-dev)
|
||||
# * mpfr (libmpfr-dev)
|
||||
|
||||
BINUTILS_VERSION="2.35"
|
||||
GCC_VERSION="10.2.0"
|
||||
export PREFIX="$PWD/i686-elf-gcc"
|
||||
export PATH="$PWD/i686-elf-gcc/bin:$PATH"
|
||||
TARGET="i686-elf"
|
||||
|
||||
if [ -e "i686-elf-gcc" ]; then
|
||||
echo "Exiting since installation directory already present"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Download archives.
|
||||
if [ ! -f binutils-$BINUTILS_VERSION.tar.xz ]; then
|
||||
wget "https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VERSION.tar.xz"
|
||||
fi
|
||||
if [ ! -f gcc-$GCC_VERSION.tar.xz ]; then
|
||||
wget "https://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz"
|
||||
fi
|
||||
|
||||
# Extract archives.
|
||||
tar xJf binutils-$BINUTILS_VERSION.tar.xz
|
||||
tar xJf gcc-$GCC_VERSION.tar.xz
|
||||
|
||||
# Build binutils.
|
||||
rm -rf "build-binutils"
|
||||
mkdir "build-binutils"
|
||||
cd "build-binutils"
|
||||
../binutils-$BINUTILS_VERSION/configure \
|
||||
--target="$TARGET" --prefix="$PREFIX" --with-sysroot --disable-nls \
|
||||
--disable-werror
|
||||
make
|
||||
make install
|
||||
cd ..
|
||||
|
||||
# Build gcc.
|
||||
rm -rf "build-gcc"
|
||||
mkdir "build-gcc"
|
||||
cd "build-gcc"
|
||||
../gcc-$GCC_VERSION/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
|
||||
cd ..
|
Loading…
x
Reference in New Issue
Block a user