Created
January 17, 2017 22:56
-
-
Save FirstTimeInForever/ae9c7f1867399fdba96caa2e856bbf50 to your computer and use it in GitHub Desktop.
Easy install cross gcc
This file contains hidden or 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
#!/bin/sh | |
ARCH=$1 | |
TARGET_DIR=$2 | |
BUILD_DIR=$3 | |
if [ -z "$ARCH" ]; then | |
echo "ARCH is not set!" | |
exit 1 | |
fi | |
if [ -z "$TARGET_DIR" ]; then | |
echo "TARGET_DIR is not set!" | |
exit 1 | |
fi | |
if [ -z "$BUILD_DIR" ]; then | |
echo "BUILD_DIR is not set!" | |
exit 1 | |
fi | |
sudo apt install libgmp3-dev libmpfr-dev libisl-dev libcloog-isl-dev libmpc-dev texinfo -y | |
TARGET_DIR_ABS=$(readlink -f $TARGET_DIR) | |
BUILD_DIR_ABS=$(readlink -f $BUILD_DIR) | |
echo "Arch is: $ARCH" | |
echo "Target dir is: $TARGET_DIR_ABS" | |
echo "Build dir is: $BUILD_DIR_ABS" | |
mkdir -p $BUILD_DIR_ABS | |
cd $BUILD_DIR_ABS | |
mkdir -p download | |
mkdir -p src | |
cd download | |
wget ftp://ftp.gnu.org/gnu/binutils/binutils-2.26.tar.gz | |
wget ftp://ftp.gnu.org/gnu/gcc/gcc-6.1.0/gcc-6.1.0.tar.gz | |
tar -xvzf binutils-2.26.tar.gz -C ../src/ | |
tar -xvzf gcc-6.1.0.tar.gz -C ../src/ | |
cd .. | |
export PREFIX="$TARGET_DIR_ABS" | |
export TARGET=$ARCH | |
export PATH="$PREFIX/bin:$PATH" | |
mkdir build-binutils | |
cd build-binutils | |
../src/binutils-2.26/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror | |
make -j $(nproc) | |
make install | |
cd .. | |
mkdir build-gcc | |
cd build-gcc | |
../src/gcc-6.1.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers | |
make -j $(nproc) all-gcc | |
make -j $(nproc) all-target-libgcc | |
make install-gcc | |
make install-target-libgcc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment