#!/bin/bash

#Get number of cpus on current platform
NUMCPUS=`grep -c processor /proc/cpuinfo`;

version=1.1.12

#Some cleanup
rm -rf src
rm -rf install
rm -rf sowing-$version

#Create src and install directories
mkdir src install

#Untar 
tar -zxvf  sowing.tar.gz

#Move sowing into src directory
mv sowing-$version/* src
rm -rf sowing-$version

#Configure sowing
cd src && ./configure --prefix "$ISSM_DIR/packages/sowing/install"

#Compile sowing
make  -j $NUMCPUS

#Install sowing
make  install
