#!/bin/sh
#
# Configure and build cross-binutils 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=binutils-2.9.1

# Path to archive
MY_PACKAGE_TGZ=${MY_PACKAGE}.tar.gz

# Path to diff
MY_PACKAGE_DIFFGZ=${MY_PACKAGE}-mint.diff.gz

# The target system
MY_TARGET=m68k-atari-mint

##### Let's work

# Unpack the archive
tar xvzf ${MY_PACKAGE_TGZ}

# Patch it
cd ${MY_PACKAGE}
gunzip -c ${MY_PACKAGE_DIFFGZ} | patch -p1
cd ..

# 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

# Build and install it
make install

# Go out
cd ..
