#!/bin/bash

funits=`readlink -n -f -s ./units/`
mseroot=`readlink -n -f -s ./mseide-msegui/`
exeout=`readlink -n -f -s ./`
ideuroot=./ideU-main/src

pushd $ideuroot
fpc -Cg -k-pie -k-znow -FU$funits -oideU -Fu$mseroot/lib/common/kernel/linux -Fu$mseroot/lib/common/* -Mobjfpc -Sh -Fcutf8 -dmse_with_zeoslib -gl -B -Xs -CX -XX -O2 -dmse_dynpo -SIcorba -vewinhq -dusemo ideU.pas -FE$exeout
     if [ "$?" != "0" ]
     then
          echo 'Compiling error - update FAILED :('
          popd
          exit
     fi
popd

echo 'All OK :)'
