Build script for a cross compiler

Timo Sintonen via D.gnu d.gnu at puremagic.com
Mon Apr 27 22:00:50 PDT 2015


People have been asking a build script Here is one I have
written. This was originally ment to build gdc in a virtual
machine but I did not get this to work in a vm. There were always
missing something or some issues like 32/64 bit mismatch.

This script gets the current head of gdc, loads the required gcc
version, pacthes it and configures for ARM. In addition, a file
to put in t-arm-elf is needed.

If you like, please test and report. If this is useful we may
then put this to wiki.

----8<----

#!/bin/bash

# This script compiles and installs tgdc

# Additional programs. Usually they are already installed but
# a virtual machine does not have these.
sudo apt-get install gcc g++ git libgmp-dev libmpfr-dev
libmpc-dev \
   binutils-dev flex

cd
rm -rf gdc
mkdir -p gdc
cd gdc

# Binutils
wget
ftp://ftp.funet.fi/pub/mirrors/ftp.gnu.org/pub/gnu/binutils/binutils-2.25.tar.gz
tar zxvf binutils-2.25.tar.gz
cd binutils-2.25
./configure --target=arm-eabi --disable-nls
make
sudo make install
cd ..

# GDC
git clone git://github.com/D-Programming-GDC/GDC gdc
gccver=`cat gdc/gcc.version`
gccdir=`cat gdc/gcc.version | cut -c5-`

# GCC
wget ftp://gcc.gnu.org/pub/gcc/snapshots/$gccdir/$gccver.tar.bz2
tar jxvf $gccver.tar.bz2

# Patch gcc
cd gdc
#./setup-gcc.sh ../$gccver
cd ..

# Patch t-arm-elf
cp  t-arm-elf.own  $gccver/gcc/config/arm/t-arm-elf

# GCC compilation
# MOdify the flags for your system
mkdir build-gcc
cd build-gcc
../$gccver/configure --target=arm-eabi --disable-bootstrap \
    --enable-languages=c --enable-multilib --disable-nls \
    --without-isl --without-cloog \
    --without-gmp --without-mpfr --without-mpc \
    --disable-libphobos

make
sudo make install
------->8------

And this is what to put in t-arm.elf.own:
-------
MULTILIB_OPTIONS  += mcpu=cortex-m0/mcpu=cortex-m3/mcpu=cortex-m4
   mfloat-abi=hard mfpu=fpv4-sp-d16
MULTILIB_DIRNAMES += cortex-m0 cortex-m3 cortex-m4
MULTILIB_REQUIRED += mcpu=cortex-m0
MULTILIB_REQUIRED += mcpu=cortex-m3
MULTILIB_REQUIRED += mcpu=cortex-m4 /mfloat-abi=hard
/mfpu=fpv4-sp-d16
MULTILIB_EXTRA_OPTS += mthumb

----------


More information about the D.gnu mailing list