#!/bin/sh set -e PREFIX="$PWD/toolchain" TARGET=avr export CFLAGS='-Os -pipe' export CXXFLAGS="$CFLAGS" export PATH="$PREFIX/bin:$PATH" export MAKEFLAGS="-j$(nproc)" mkdir -p "$PREFIX/src" ( cd "$PREFIX/src" wget -c https://ftp.gnu.org/gnu/binutils/binutils-2.30.tar.xz wget -c https://ftp.gnu.org/gnu/gcc/gcc-8.1.0/gcc-8.1.0.tar.xz wget -c https://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz wget -c https://ftp.gnu.org/gnu/mpfr/mpfr-4.0.1.tar.xz wget -c https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz wget -c http://isl.gforge.inria.fr/isl-0.19.tar.xz wget -c https://download.savannah.gnu.org/releases/avr-libc/avr-libc-2.0.0.tar.bz2 wget -c https://download.savannah.gnu.org/releases/avrdude/avrdude-6.3.tar.gz ) ( cd "$PREFIX/src" rm -rf binutils-*/ tar xf binutils-*.tar.xz cd binutils-*/ mkdir build cd build ../configure --prefix="$PREFIX" --target="$TARGET" --disable-nls make make install ) ( cd "$PREFIX/src" rm -rf gcc-*/ tar xf gcc-*.tar.xz cd gcc-*/ tar xf ../gmp-*.tar.xz tar xf ../mpfr-*.tar.xz tar xf ../mpc-*.tar.gz tar xf ../isl-*.tar.xz mv gmp-*/ gmp mv mpfr-*/ mpfr mv mpc-*/ mpc mv isl-*/ isl sed -i -e 's/\.\/fixinc\.sh/-c true/' gcc/Makefile.in mkdir -p "$PREFIX/$TARGET/include" mkdir build cd build ../configure --prefix="$PREFIX" --target="$TARGET" --enable-languages=c,c++ --disable-nls make make install ) ( cd "$PREFIX/src" rm -rf avr-libc-*/ tar xf avr-libc-*.tar.bz2 cd avr-libc-*/ ./configure --prefix="$PREFIX" --host="$TARGET" make make install ) ( cd "$PREFIX/src" rm -rf avrdude-*/ tar xf avrdude-*.tar.gz cd avrdude-*/ mkdir build cd build ../configure --prefix="$PREFIX" make make install ) ( cd "$PREFIX/src" rm -rf binutils-*/ rm -rf gcc-*/ rm -rf avr-libc-*/ rm -rf avrdude-*/ #find "$PREFIX" -type f -name '*.la' -delete ) cat > "$PREFIX/env" << EOF export PATH="$PREFIX/bin:\$PATH" EOF echo 'Run "source toolchain/env" before running make!'