#!/bin/sh
# make_math-matrix.sh is a script that generates a DEB Math::Matrix package
# from CPAN source. Aimed at Ubuntu 9.04

set -o errexit  # Exit when simple command fails.  Same as `set -e'
set -o nounset  # Trigger error when expanding unset variables.  Same as `set -u'

echo "*** Going to install dependencies from repository..."
sudo aptitude -y install \
  build-essential devscripts dh-make-perl perl

LOG=$HOME/${0}.log
VER=Math-Matrix-0.5
mkdir -p $HOME/src
cd $HOME/src
wget http://search.cpan.org/CPAN/authors/id/U/UL/ULPFR/$VER.tar.gz
tar -xvzf $VER.tar.gz
dh-make-perl $VER
cd $VER
debuild --rootcmd=sudo --no-tgz-check --no-tgz-check -i -us -uc -b
# Clean up
NAME=libmath-matrix-perl_05
cd $HOME/src
rm -rf $NAME-1_amd64.build $NAME-1_amd64.changes
echo "The package is in $HOME/src directory"

