#!/bin/bash

unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machineArch=Linux ;;
Darwin*) machineArch=MacOS ;;
CYGWIN*) machineArch=Windows ;;
MINGW*) machineArch=Windows ;;
*) machineArch="UNKNOWN:${unameOut}" ;;
esac
echo ${machineArch}

libVer=4.3.0

echo libVer=$libVer

scriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
originalPath=$scriptDir/original
buildPath=$scriptDir/build
installPath=$scriptDir/install
logPath=$scriptDir/log

libFilePath=$originalPath/swig-$libVer.tar.gz
libInstallPath=$installPath/$libVer
libSrcPath=$buildPath/swig-$libVer

echo
echo libFilePath=$libFilePath
echo libInstallPath=$libInstallPath
echo libSrcPath=$libSrcPath
echo

rm -rf $buildPath $installPath

mkdir -p $libBuildPath
mkdir -p $libInstallPath
mkdir -p $libSrcPath

tar zxvpf $libFilePath -C $buildPath
(cd $libSrcPath &&
  ./configure --prefix=$libInstallPath &&
  make -j &&
  make install)
