Ehhhm, how about this ?
first,
DISCLAIMER: I am not responsible of any damage arising in any way out of the use of this script
/bin/runpas:
#!/bin/sh
pas=`basename $1`
exe=${pas%\.*}
mkdir -p /tmp/runpas;
mkdir -p /tmp/runpas/bin;
mkdir -p /tmp/runpas/units;
sed '1d' $pas>tmp_runpas_$pas
fpc -FE/tmp/runpas/bin -FU/tmp/runpas/units tmp_runpas_$pas>/tmp/runpas/runpas.log 2>/tmp/runpas/runpas.err
rm tmp_runpas_$pas
/tmp/runpas/bin/tmp_runpas_$exe
this copies and compiles main file in-place (except first line). It uses executable output path and unit output path parameters of fpc to redirect those files to temporary folder instead of moving main source file. So
$UNITPATH should keep working.
OK, this gave me an idea to create a script that would act as interpreter instead of running "instantfpc" as interpreter directly.
Then I made this script:
#! /bin/bash
INSTANTFPCOPTIONS='-Mobjfpc -O3 -Sih -viewnh -Fu/usr/include/*;/usr/local/include/* -XMmain -Xs -XS -XX';
export INSTANTFPCOPTIONS;
instantfpc "$@"
Then I just need to specify that script as interpreter: "#! /usr/local/bin/myscript.sh" instead of "#! /usr/bin/instantfpc".
And then just run the script normally: "./instantfpc_script.sh"
If you want a more portable alternative but be limited in number of options, you can specify a one line argument to the interpreter, as far as I know BASH allows only 1 option; like this:
#! /usr/bin/instantfpc -Fu/usr/include/*;/usr/local/include/*
This solution is OK for now, but it would be better if the "$UNITPATH" directive worked. If you know of a better alternative, please let me know.
Thank you very much for your help and time, people!