I'm trying to install scilab-5.3.1 under gentoo linux. The scilab startup script seems to be broken by commit: e7edf1ae5d0e666fd4a592a7aa3ddd5a7430b84a.
If you look at the new scilab script, even if $JAVA_HOME existed in the environment, the script will attempt to overwrite it based on the path of the java executable which breaks things in gentoo. This is what I get if I run SCIVERBOSE=1 scilab
SCILABBIN : scilab-bin
DISABLE_JAVA_DETECTION : 0
SCILAB_MODE : gui
OS : Linux
MODEL : i686
Using specified vm: /etc/java-config-2/current-system-vm
Look the binary java in the PATH. If it is a symlink, try to resolve it
JAVA_HOME : .
Cannot find ./lib/i386/libjava.so
so you can see that $JAVA_HOME was set to /etc/java-config-2/current-system-vm, which is correct, and libjava.so is in /etc/java-config-2/current-system-vm/jre/lib/i386/, so the script would find it fine if it didn't try to overwrite JAVA_HOME based on the PATH (this sets JAVA_HOME to . which breaks everything).
So to me these lines seem broken. At this point in the script $JAVA_HOME can be already set.
376 # JAVA_HOME still haven't been found. Well, we can now try to find it in the path
377 if test ! -d "$JAVA_HOME" -o ! -h "$JAVA_HOME"; then
378 if test $SCIVERBOSE -ne 0; then
379 echo "Have not been able to find any Java VM on this computer. Some features may be broken."
380 fi
381 else
382
383 PATH_SEPARATOR=:
384 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
385 if test $SCIVERBOSE -ne 0; then
386 echo "Look the binary java in the PATH. If it is a symlink, try to resolve it"
387 fi
388 for DIR in $PATH; do
389 if test -f $DIR/java; then
390
391 _cur=$DIR/java
392 # resolve symlink
393 # Will probably bug if a file contains -> in the name
394 while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do
395 _cur=`ls -ld "$_cur" | sed 's/.* -> //'`
396 done
397 # symlink resolved to the real file
398
399 # Now, create JAVA_HOME
400 TMP=`dirname $_cur`
401 JAVA_HOME=`dirname $TMP`
402 if test ! -z "$JAVA_HOME"; then
403 break;
404 fi
405 fi
406 done
407 IFS=$as_save_IFS
408 fi
409 if test ! -z "$JAVA_HOME"; then
410 if test $SCIVERBOSE -ne 0; then
411 echo "JAVA_HOME : $JAVA_HOME"
412 fi