#!/bin/sh
#
# Configure and build gcc for MiNT
#

###### Adapt the MY_* variables for your setup
# Installation directory
MY_INSTALL_DIR=/home/patrice/cross-tools

# Name of package to build
MY_PACKAGE=gcc-3.1

# The target system
MY_TARGET=m68k-atari-mint

# Complete path to the mintlib (includes and lib)
# You must have ${MY_TARGETLIB_DIR}/include for includes
# You must have ${MY_TARGETLIB_DIR}/lib for libraries
MY_TARGETLIB_DIR=../mintlib-devel-0.57

# Modify the path to get access to gcc-3.1 for host
# and binutils-2.9.1 for MiNT
export PATH=${MY_INSTALL_DIR}/bin:$PATH

##### Let's work

# Create a directory to build it
mkdir ${MY_PACKAGE}-mint
cd ${MY_PACKAGE}-mint

# Configure the package
../${MY_PACKAGE}/configure \
  --prefix=${MY_INSTALL_DIR} \
  --target=${MY_TARGET} \
  --program-prefix=${MY_TARGET}- \
  --infodir=${MY_INSTALL_DIR}/share/info \
  --mandir=${MY_INSTALL_DIR}/share/man
  --enable-languages=c++ \
  --with-headers=${MY_TARGETLIB_DIR}/include \
  --with-libs=${MY_TARGETLIB_DIR}/lib

# Build and install it
make bootstrap
make install

# Go out
cd ..
