Last active
May 7, 2022 02:46
-
-
Save alirezaarzehgar/5f0e52615866c132609273d114e3b484 to your computer and use it in GitHub Desktop.
Download and install gcc for other targets and versions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
GCC="gcc-8.2.0" | |
BINUTILS="binutils-2.31.1" | |
GDB="gdb-9.1" | |
PREFIX=$(pwd)/cross | |
COMPILEFLAGS=--disable-multilib | |
mkdir $GCC-elf-objs | |
mkdir ${GDB}-build | |
wget --no-clobber --no-check-certificate https://ftp.gnu.org/gnu/binutils/${BINUTILS}.tar.gz | |
wget --no-clobber --no-check-certificate https://ftp.gnu.org/gnu/gcc/${GCC}/${GCC}.tar.gz | |
wget --no-clobber --no-check-certificate http://ftp.gnu.org/gnu/gdb/${GDB}.tar.gz | |
[ ! -d ${BINUTILS} ] && tar -zxf ${BINUTILS}.tar.gz | |
[ ! -d ${GCC} ] && tar -zxf ${GCC}.tar.gz | |
[ ! -d ${GDB} ] && tar -zxf ${GDB}.tar.gz | |
cd ${BINUTILS} | |
./configure --prefix="${PREFIX}" --disable-nls --disable-werror --with-sysroot ${COMPILEFLAGS} | |
make && make install | |
cd - | |
cd ${GCC} | |
./contrib/download_prerequisites | |
cd - | |
cd ${GCC}-elf-objs | |
../${GCC}/configure --prefix="${PREFIX}" --disable-nls --enable-languages=c --without-headers ${COMPILEFLAGS} | |
make all-gcc && make all-target-libgcc && make install-gcc && make install-target-libgcc | |
cd - | |
cd ${GDB}-build | |
../${GDB}/configure --prefix="${PREFIX}" ${COMPILEFLAGS} | |
make && make install | |
cd - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment