mkdir -p ./src

# download dependencies
wget -nc https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.bz2 -O ./src/gmp-6.2.1.tar.bz2
wget -nc https://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz -O ./src/mpc-1.2.1.tar.gz
wget -nc https://ftp.gnu.org/gnu/mpfr/mpfr-4.1.0.tar.gz -O ./src/mpfr-4.1.0.tar.gz

# download sources
wget -nc https://ftp.gnu.org/gnu/gcc/gcc-13.1.0/gcc-13.1.0.tar.gz -O ./src/gcc.tar.gz
wget -nc https://ftp.gnu.org/gnu/binutils/binutils-2.40.tar.gz	-O ./src/binutils.tar.gz
wget -nc https://ftp.gnu.org/gnu/libc/glibc-2.37.tar.gz -O ./src/glibc.tar.gz

git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ./src/linux
git clone https://git.savannah.gnu.org/git/hurd/gnumach.git/ ./src/gnumach
git clone https://git.savannah.gnu.org/git/hurd/mig.git/ ./src/mig
git clone https://git.savannah.gnu.org/git/hurd/hurd.git/ ./src/hurd
git clone https://git.savannah.gnu.org/git/hurd/glibc.git/ ./src/hurd_glibc

mkdir -p ./src/gmp ./src/mpc ./src/mpfr ./src/gcc ./src/binutils ./src/glibc
tar xjf ./src/gmp-6.2.1.tar.bz2 -C ./src/gmp
tar xzf ./src/mpc-1.2.1.tar.gz -C ./src/mpc
tar xzf ./src/mpfr-4.1.0.tar.gz -C ./src/mpfr
tar xzf ./src/gcc.tar.gz -C ./src/gcc
tar xzf ./src/binutils.tar.gz -C ./src/binutils
tar xzf ./src/glibc.tar.gz -C ./src/glibc
