3 # Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 # Copyright (C) INRIA - 2006-2008 - Sylvestre Ledru
5 # Copyright (C) INRIA - 2008 - Simon Lipp
6 # Copyright (C) DIGITEO - 2009-2011 - Sylvestre Ledru
7 # Copyright (C) DIGITEO - 2010-2011 - Bruno JOFRET
8 # Copyright (C) 2012 - 2016 - Scilab Enterprises
10 # This file is hereby licensed under the terms of the GNU GPL v2.0,
11 # pursuant to article 5.3.4 of the CeCILL v.2.1.
12 # This file was originally licensed under the terms of the CeCILL v2.1,
13 # and continues to be available under such terms.
14 # For more information, see the COPYING file which you should have received
15 # along with this program.
19 # Scilab can be installed/used in different ways :
20 # * ./configure; make install
21 # => will install Scilab into /usr/local/ and split files to
22 # /usr/local/bin, /usr/local/share/scilab/, /usr/local/lib/scilab/,
23 # /usr/local/include/scilab/
24 # * ./configure --prefix=/my/dir/; make install
25 # => will install Scilab into /my/dir/ and split files to
26 # /my/dir/bin/, /my/dir/share/scilab/, /my/dir/lib/scilab/
27 # /my/dir/include/scilab/
28 # Scilab official binary uses this arch
29 # * ./configure; make install prefix=$(DESTDIR)/usr \
30 # bindir=$(DESTDIR)/usr/bin \
31 # datadir=$(DESTDIR)/usr/share/scilab ...
32 # Solution used mainly by Linux packagers
34 ## First, this script will look for scilab-bin in :
35 # * If specified, in the $SCI variable
36 # * Into the scilab/bin/ directory
37 # * Into the scilab/ directory (if the user is using a source version and
38 # scilab has been compiled in this directory)
39 # * if this file is a symlink to the real one. We browse symlink(s) until we
40 # find the real "scilab" script file and consider that it is the right
42 # * That is all. Don't hesitate to contact us if you see one missing.
46 if test ! -z "$SCIVERBOSE"; then
52 if test -n "$SCI"; then
53 if test ! -d "$SCI/modules"; then
54 echo "Cannot find directory $SCI/modules/ !"
55 echo "SCI should point to the root data directory of Scilab"
60 DISABLE_JAVA_DETECTION=0
75 if test -n "$DEVENV"; then
76 echo "Running debug of Scilab [$DEBUG_CMD] : " "$SCI"/libtool --mode=execute $DEBUG_CMD $SCILAB_GDB_OPT $DEBUG_ARGS "$SCILABBIN" "$@"
77 "$SCI"/libtool --mode=execute $DEBUG_CMD $SCILAB_GDB_OPT $DEBUG_ARGS "$SCILABBIN" "$@"
79 echo "Running debug of Scilab [$DEBUG_CMD] : " $DEBUG_CMD $SCILAB_GDB_OPT $DEBUG_ARGS "$SCILABBIN" "$@"
80 $DEBUG_CMD $SCILAB_GDB_OPT $DEBUG_ARGS "$SCILABBIN" "$@"
85 if test -n "$DEVENV"; then
86 echo "Running debug of Scilab [rr] : " "$SCI"/libtool --mode=execute rr "$SCILABBIN" "$@"
87 "$SCI"/libtool --mode=execute rr "$SCILABBIN" "$@"
89 echo "Running debug of Scilab [rr] : " rr "$SCILABBIN" "$@"
90 rr record "$SCILABBIN" "$@"
95 if test -n "$DEVENV"; then
96 echo "Running debug of Scilab [kdbg] : " "$SCI"/libtool --mode=execute kdbg "$SCILABBIN"
97 "$SCI"/libtool --mode=execute kdbg "$SCILABBIN"
99 echo "Running debug of Scilab [kdbg] : " kdbg "$SCILABBIN"
105 VALGRIND_OPTIONS=" --show-below-main=yes --num-callers=16 --demangle=yes --leak-check=full --show-reachable=yes --smc-check=all --show-below-main=yes --track-origins=yes --suppressions=$SCI/tools/profiling/valgrind.supp $SCILAB_VALGRIND_OPT"
106 if test -n "$DEVENV"; then
107 echo "Running profiling of Scilab : " "$SCI"/libtool --mode=execute valgrind $VALGRIND_OPTIONS "$SCILABBIN" "$@"
108 "$SCI"/libtool --mode=execute valgrind $VALGRIND_OPTIONS "$SCILABBIN" "$@"
110 echo "Running profiling of Scilab : " valgrind $VALGRIND_OPTIONS "$SCILABBIN" "$@"
111 valgrind $VALGRIND_OPTIONS "$SCILABBIN" "$@"
116 start_profiling_visu() {
117 VALGRIND_VISU_OPTIONS=" --tool=callgrind --trace-children=yes --smc-check=all --trace-jump=yes --dump-line=yes --separate-threads=yes $SCILAB_VALGRIND_OPT"
119 if test -n "$DEVENV"; then
120 echo "Running profiling visualization of Scilab : " "$SCI"/libtool --mode=execute valgrind $VALGRIND_VISU_OPTIONS "$SCILABBIN" "$@"
121 "$SCI"/libtool --mode=execute valgrind $VALGRIND_VISU_OPTIONS "$SCILABBIN" "$@"
123 echo "Running profiling visualization of Scilab : " valgrind $VALGRIND_VISU_OPTIONS "$SCILABBIN" "$@"
124 valgrind $VALGRIND_VISU_OPTIONS "$SCILABBIN" "$@"
128 find_docbook_path() {
129 if test -z "$DOCBOOK_ROOT"; then
130 for dir in $SCI/thirdparty/docbook /usr/share/sgml/docbook/stylesheet/xsl/nwalsh /usr/share/docbook2X/xslt/man/ /usr/share/xml/docbook/stylesheet/nwalsh/ /usr/share/xml/docbook/stylesheet/nwalsh/current/ /sw/share/xml/xsl/docbook-xsl /usr/share/xml/docbook/xsl-stylesheets-*/ /usr/share/sgml/docbook/xsl-stylesheets-*/ /usr/share/sgml/docbook/xsl-stylesheets /usr/share/sgml/docbook/xsl-ns-stylesheets-*/ /usr/share/xml/docbook/stylesheet/docbook-xsl /opt/local/share/xsl/docbook-xsl; do
131 if test -r "$dir/fo/docbook.xsl"; then
132 if test -z "$DOCBOOK_ROOT"; then
139 if test $SCIVERBOSE -ne 0; then
140 echo "DOCBOOK : $DOCBOOK_ROOT"
144 detect_type_of_scilab(){
148 SCILABBIN="scilab-bin"
150 if (echo "$progname"|grep "scilab-adv-cli$" 2>&1 > /dev/null;) || (echo "$@"|grep "\-nw" 2>&1 > /dev/null;) then
152 # We are using scilab-bin here because we are going to force the arg -nw
153 SCILABBIN="scilab-bin"
156 if (echo "$progname"|grep "scilab-cli$" 2>&1 > /dev/null;) || (echo "$@"|grep "\-nwni" 2>&1 > /dev/null;) then
158 SCILABBIN="scilab-cli-bin"
159 DISABLE_JAVA_DETECTION=1
162 if (echo "$progname"|grep "scinotes$" 2>&1 > /dev/null;) then
163 SCILAB_MODE="scinotes"
164 SCILABBIN="scilab-bin"
168 if (echo "$progname"|grep "xcos$" 2>&1 > /dev/null;) then
170 SCILABBIN="scilab-bin"
174 if test $SCIVERBOSE -ne 0; then
175 echo "SCILABBIN : $SCILABBIN"
176 echo "DISABLE_JAVA_DETECTION : $DISABLE_JAVA_DETECTION"
177 echo "SCILAB_MODE : $SCILAB_MODE"
183 if test "${OS}" = ""; then
184 OS=$(uname -s) # Retrieve the Operating System
186 if test "${MODEL}" = ""; then
187 MODEL=$(uname -m) # Retrieve the model
190 if test $SCIVERBOSE -ne 0; then
192 echo "MODEL : $MODEL"
196 detect_type_of_scilab $@
201 detect_scilab_path() {
205 # If we are running Scilab binary, it is trivial to set paths.
206 curdir=$(dirname "$progname")
208 # If the script is a symlink, it might be a symlink to the Scilab binary
209 # We could run into the bug #9125
210 if test -h "$progname"; then
211 while test -h "$progname"; do
212 bn=$(basename "$progname")
213 cd $(dirname "$progname")
215 # Browse the symlink to the real one
216 progname=$(/bin/ls -l "$bn" | sed -e 's/^.* -> //' )
218 if test ! -x "$progname"; then
222 cd $(dirname "$progname")
226 if test -d "$curdir/../thirdparty/" -a -d "$curdir/../share/scilab"; then
227 # We are in the Scilab binary
229 # export the bin directory to the PATH first (avoid to take the packaged version)
233 SCI=$SCIBINARYBASE/share/scilab
238 # Use scilab-bin in the current dir if it exists
239 # If not, then start resolving symlinks until we find scilab-bin
241 cd $(dirname "$progname")
245 progbase=$(basename "$progname")
246 run_sci="$curdir/$SCILABBIN"
247 if test -x "$run_sci"; then # scilab-bin is in the /bin/ directory
253 run_sci="$curdir/../$SCILABBIN"
254 if test -x "$run_sci"; then # scilab-bin is in the / directory
255 # which is the case in a dev env
262 while test -h "$progname"; do
263 bn=$(basename "$progname")
264 cd $(dirname "$progname")
265 # Browse the symlink to the real one
266 progname=$(/bin/ls -l "$bn" | sed -e 's/^.* -> //' )
267 if test ! -x "$progname"; then
270 curdir=$(dirname "$progname")
271 if test -x "$curdir"; then
274 SCIBIN="$curdir/$SCILABBIN"
279 # The current file ($0), probably scilab is a symlink to the
280 # real one and here, it is the dev env
281 run_sci="$curdir/../$SCILABBIN"
282 if test -x "$run_sci"; then
292 if test $SCIVERBOSE -ne 0; then
293 echo "I think I found Scilab here : $SCI"
298 if test -x "$SCI/bin/$SCILABBIN"; then
300 SCILABBIN=$SCI/bin/$SCILABBIN
301 SCI=$SCI/share/scilab/
303 if test -x "$SCI/$SCILABBIN"; then
305 SCILABBIN=$SCI/$SCILABBIN
307 # add modelica in the path
308 PATH="$PATH:$SCI/modules/scicos/"
310 echo "Cannot find $SCILABBIN ..."
319 set_macosx_java_vm () {
320 # For Mac OS X, Since path are different from the JVM normal tree,
321 # don't need to detect the CPU
322 JAVA_SHLIB="libjava.jnilib"
323 if test -z "$JAVA_HOME"; then
324 JAVA_HOME=$(/usr/libexec/java_home --arch x86_64 --failfast --version 1.8+)
326 JAVA_JVM_VERSION=$JAVA_HOME
327 export JAVA_JVM_VERSION
328 DYLD_LIBRARY_PATH="$JAVA_HOME/../Libraries${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
332 set_embedded_java_vm () {
334 # Scilab binary => no Java detection since we are using the embeded JRE
335 # Here, we are handling 3 cases: GNU/Linux 32bit, GNU/Linux 64bit,
344 # We embed java/lib/i386 with Scilab Binary
345 # force proc to i386 even if systems answer i686
349 echo "Could not find the Java configuration for the model <${MODEL}>. Please contact us on http://bugzilla.scilab.org"
353 *darwin* | *Darwin*) # MacOS X
354 # JRE is now embedded in Mac OS X binary version
356 JAVA_HOME=$SCIBINARYBASE/thirdparty/java/Contents/Home/
357 JAVA_JVM_VERSION=$JAVA_HOME
358 export JAVA_JVM_VERSION
359 DYLD_LIBRARY_PATH="$JAVA_HOME/lib/server:${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
362 echo "Could not find the Java configuration for the OS <${OS}>. Please contact us or submit a bug report with your detailed configuration http://bugzilla.scilab.org/"
363 echo "Fallback on the model <${MODEL}> found by uname -m"
367 JRE_HOME="$SCIBINARYBASE/thirdparty/java/"
371 # If enabled, disable se_linux
372 check_and_disable_selinux() {
373 if test -x /usr/sbin/selinuxenabled -a $IS_SCILAB_BINARY -eq 1; then
374 /usr/sbin/selinuxenabled
376 if test $SCIVERBOSE -ne 0; then
377 echo "Disabling SELinux on Scilab"
380 JVMLIB_32=$SCIBINARYBASE/java/lib/i386/server/libjvm.so
381 if test -f "$JVMLIB_32"; then
382 /usr/bin/chcon -t textrel_shlib_t "$JVMLIB_32"
383 if test $? != 0; then
384 echo "Error: Cannot chcon $JVMLIB_32"
387 JVMLIB_64=$SCIBINARYBASE/java/lib/amd64/server/libjvm.so
388 if test -f "$JVMLIB_64"; then
389 /usr/bin/chcon -t textrel_shlib_t "$JVMLIB_64"
390 if test $? != 0; then
391 echo "Error: Cannot chcon $JVMLIB_64"
394 /usr/bin/chcon -t execmem_exec_t "$SCIBINARYBASE/bin/scilab-bin"
395 if test $? != 0; then
396 echo "Error: Cannot chcon 'scilab-bin'"
399 /usr/bin/chcon -t execmem_exec_t "$SCIBINARYBASE/bin/scilab-cli-bin"
400 if test $? != 0; then
401 echo "Error: Cannot chcon 'scilab-cli-bin'"
410 JAVA_SHLIB="libjava.so"
412 if test $IS_SCILAB_BINARY -eq 1; then
414 else # NOT IS_SCILAB_BINARY
416 ############# JAVA DETECTION ##############
417 # Basic inspiration from Eclipse
419 # Scilab is looking for Java in various places with different ways :
420 # * if JAVA_HOME is specificed, use it
421 # * Check in 'standard' places we know Java could be installed
422 # if some are missing, please contact us
423 # * look in the PATH if there is a java binary
424 # if it is the case, resolve the symlink and set the JAVA_HOME from it
426 # Once we have JAVA_HOME, we check that native libraries (libjava.so and
427 # 2 others) are available
430 # Get the proc name matching to the one of the JVM
431 # Inspiration and data are from http://www.google.com/codesearch?hl=en&q=+java+ppc+libjava.so+show:a78sz0SP41k:zxNozD-vc0A:FWiIy7Hinmg&sa=N&cd=2&ct=rc&cs_p=http://fresh.t-systems-sfr.com/unix/src/misc/tclBlendSrc1.2.5.tar.gz&cs_f=tclBlend1.2.5/configure.in#a0
432 # For Mac OS X, we will get stuff like that:
433 # uname -s Power Macintosh
436 # If the user has the variable JAVA_HOME in the ENV
437 if test -n "$JAVA_HOME" ; then
438 if test $SCIVERBOSE -ne 0; then
439 echo "Using specified vm: $JAVA_HOME"
441 if test ! -x "$JAVA_HOME/bin/java" ; then
442 echo "Cannot find $JAVA_HOME/bin/java"
445 elif test "$DEVENV" = "1" -a -d "$SCI/java/jre" ; then
446 export JAVA_HOME=$SCI/java/jre
447 if test $SCIVERBOSE -ne 0; then
448 echo "Using thirdparty vm: $JAVA_HOME"
450 if test ! -x "$JAVA_HOME/bin/java" ; then
451 echo "Cannot find $JAVA_HOME/bin/java"
459 if test $SCIVERBOSE -ne 0; then
460 echo "Using default Mac OS X vm: $JAVA_HOME"
461 echo "And LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
462 echo "And DYLD_LIBRARY_PATH: $DYLD_LIBRARY_PATH"
469 # Browse "default directory" (if it means anything under Unix/Linux) of Java
470 # to find where it could be !
471 if test -z "$JAVA_HOME"; then
472 JAVA_DEFAULT_DIR="/usr/java/jdk1.8.*/ /usr/lib/jvm/java-1.8.0-*/ /usr/lib/jvm/java-8-*/ /etc/alternatives/java_sdk /etc/alternatives/jre /usr/java/jdk*/ /usr/lib/jvm/java-*/"
473 for DIR in $JAVA_DEFAULT_DIR ; do
474 if test $SCIVERBOSE -ne 0; then
475 echo "Trying to find Java in $DIR "
477 if test -x "${DIR}/bin/java" ; then
478 # resolve symlinked dir
484 if test $SCIVERBOSE -ne 0; then
485 echo "Java found in $JAVA_HOME"
492 # if JAVA_HOME still haven't been found. Well, we can now try to find it in the path
493 if test ! -d "$JAVA_HOME"; then
496 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
497 if test $SCIVERBOSE -ne 0; then
498 echo "Look for the java binary in the PATH. If it is a symlink, try to resolve it"
501 if test -f "$DIR/java"; then
505 # Will probably bug if a file contains -> in the name
506 while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do
507 _cur=$(ls -ld "$_cur" | sed 's/.* -> //')
509 # symlink resolved to the real file
511 # Now, create JAVA_HOME
513 JAVA_HOME=$(dirname $TMP)
514 if test ! -z "$JAVA_HOME"; then
522 if test ! -z "$JAVA_HOME"; then
523 if test $SCIVERBOSE -ne 0; then
524 echo "JAVA_HOME : $JAVA_HOME"
526 # Manage JRE & JDK because libjava.so and others are stored in the JRE
527 if test -d "$JAVA_HOME/jre"; then
528 JRE_HOME=$JAVA_HOME/jre
532 # Configuring LD_LIBRARY_PATH for libjava.so libhpi.so and libxxxx.so
542 if test -d "${JRE_HOME}/lib/$(uname -m)" ; then
560 mips*) # under mipsel, uname -m is
561 # usually returning mips or mips64...
562 # but binary are in mipsel
563 if test -d "${JRE_HOME}/lib/mipsel" ; then
591 echo "Could not find the Java configuration for the model <${MODEL}>. Please contact us on http://bugzilla.scilab.org"
596 JAVA_SHLIB="libjava.sl"
597 proc="lib" # TODO : check if it is right or not ... seems not !
604 "i86pc") # solaris x86
607 # check for the 64 bits syntax
612 echo "Could not find the Java configuration for the model <${MODEL}>. Please contact us."
617 *win32* | *WIN32* | *CYGWIN_NT*)
621 *darwin* | *Darwin*) # MacOS X
628 echo "Could not find the Java configuration for the OS <${OS}>. Please contact us or submit a bug report with your detailed configuration http://bugzilla.scilab.org/"
629 echo "Fallback on the model <${MODEL}> found by uname -m"
633 fi # JAVA_HOME provided or found
634 fi # IS_SCILAB_BINARY
636 # Check if the lib exists
637 LIBJAVA="$JRE_HOME/lib/$proc/$JAVA_SHLIB"
638 if test ! -f "$LIBJAVA"; then
639 if test $SCIVERBOSE -ne 0; then
640 echo "Cannot find $LIBJAVA"
643 CLASSPATH="${CLASSPATH:+:$CLASSPATH}$SCI/modules/core/jar/org.scilab.modules.core.jar"
644 # @TODO This is the default path of the official sun JVM.
645 # It is different for other implementation of the JVM....
646 LD_LIBRARY_PATH="$JRE_HOME/lib/$proc/:$JRE_HOME/lib/$proc/server/:$JRE_HOME/lib/$proc/native_threads/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
649 # Bug http://bugzilla.scilab.org/show_bug.cgi?id=14290 -
650 # Never run headless on Mac (unless explicitly asked through
651 # the SCI_JAVA_ENABLE_HEADLESS option -- which will not work anyway)
653 *darwin* | *Darwin*) # MacOS X
654 export _JAVA_OPTIONS="-Djava.awt.headless=false"
658 ####### END OF JAVA ENV DETECTION/SETTING ######
662 if test $SCIVERBOSE -ne 0; then
663 echo "IS_SCILAB_BINARY : $IS_SCILAB_BINARY"
667 # If we are calling scilab-cli, no need to detect java.
668 if test $DISABLE_JAVA_DETECTION -ne 1; then
672 if test $IS_SCILAB_BINARY -eq 1; then
674 if test ! -d "$SCIBINARYBASE/thirdparty/tcl8.5"; then
675 # New packaging path (similar to Windows one)
676 TCL_LIBRARY="$SCIBINARYBASE/share/scilab/modules/tclsci/tcl/tcl8.5"
677 TK_LIBRARY="$SCIBINARYBASE/share/scilab/modules/tclsci/tcl/tk8.5"
680 TCL_LIBRARY="$SCIBINARYBASE/thirdparty/tcl8.5"
681 TK_LIBRARY="$SCIBINARYBASE/thirdparty/tk8.5"
683 LD_LIBRARY_PATH=$SCIBINARYBASE/lib/scilab:$SCIBINARYBASE/lib/thirdparty${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}:$SCIBINARYBASE/lib/thirdparty/redist
684 DOCBOOK_ROOT="$SCI/../../thirdparty/docbook"
685 PATH="$PATH:$SCI/modules/scicos/"
689 export LD_LIBRARY_PATH
695 DYLD_LIBRARY_PATH=$SCIBINARYBASE/lib/scilab:$SCIBINARYBASE/lib/thirdparty${DYLD_LIBRARY_PATH+:$DYLD_LIBRARY_PATH}
696 export DYLD_LIBRARY_PATH
697 PATH="/sw/bin:/sw64/bin:$PATH"
703 # Scilab compiled using prerequirements
704 if test -d "$curdir/../usr"; then
705 TCL_LIBRARY="$SCI/usr/lib/tcl8.5"
706 TK_LIBRARY="$SCI/usr/lib/tk8.5"
710 PATH="$SCI:$SCI/bin:$PATH"
714 # See http://bugzilla.scilab.org/show_bug.cgi?id=3486
715 # Some Java stuff raises spurious SIGSEGV. The problem is that when bug-buddy
716 # is enabled, it catches the signal and terminate Scilab. We have to
717 # desactivate bug-buddy.
718 # See also https://bugzilla.novell.com/show_bug.cgi?id=331618
719 # and: http://bugzilla.gnome.org/show_bug.cgi?id=479929
720 GTK_MODULES=$(echo $GTK_MODULES | sed s/gnomebreakpad//g)
723 # libEGL may be partially supported by the closed-source NVIDIA driver.
724 # Until they release an EGL driver, we force the egl_glx driver.
725 # http://bugzilla.scilab.org/show_bug.cgi?id=12940
726 if test $SCILAB_MODE != "nwni" -a -x /usr/bin/glxinfo; then
727 NVIDIA_GLX_VENDOR=$(/usr/bin/glxinfo |grep "NVIDIA Corporation")
728 if test ! -z "$NVIDIA_GLX_VENDOR"; then
734 if test $SCIVERBOSE -ne 0; then
736 echo "SCIBIN : $SCIBIN"
738 echo "CLASSPATH : $CLASSPATH"
739 echo "EGL_DRIVER : $EGL_DRIVER"
742 # Returns to the original path
745 #if test "$DISPLAY" = ""; then
751 detect_macosx_version()
753 macosxVersion=`sw_vers | grep '^ProductVersion:' | grep -o '[0-9]*\.[0-9]*\.[0-9]*'`
754 if test "${macosxVersion}" = ""; then
755 macosxVersion=`sw_vers | grep '^ProductVersion:' | grep -o '[0-9]*\.[0-9]*'`
757 macosxMajorVersion=`echo $macosxVersion | cut -d . -f 1`
758 macosxMinorVersion=`echo $macosxVersion | cut -d . -f 2`
759 macosxBuildVersion=`echo $macosxVersion | cut -d . -f 3`
761 if test $SCIVERBOSE -ne 0; then
762 echo "Found MacOSX Version: $macosxVersion"
767 set_macox_specific_path()
770 PATH_TO_SPECIFIC_10_13=$SCIBINARYBASE/lib/thirdparty/10.13/
771 PATH_TO_SPECIFIC_10_12=$SCIBINARYBASE/lib/thirdparty/10.12/
772 PATH_TO_SPECIFIC_10_11=$SCIBINARYBASE/lib/thirdparty/10.11/
773 PATH_TO_SPECIFIC_10_10=$SCIBINARYBASE/lib/thirdparty/10.10/
774 PATH_TO_SPECIFIC_10_6=$SCIBINARYBASE/lib/thirdparty/10.6/
776 case $macosxMajorVersion in
778 case $macosxMinorVersion in
782 # Specific libBLAS.dylib & libz versions for 10.13
783 LD_LIBRARY_PATH=$PATH_TO_SPECIFIC_10_13${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
784 DYLD_LIBRARY_PATH=$PATH_TO_SPECIFIC_10_13${DYLD_LIBRARY_PATH+:$DYLD_LIBRARY_PATH}
787 # Specific libBLAS.dylib version for 10.12
788 LD_LIBRARY_PATH=$PATH_TO_SPECIFIC_10_12${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
789 DYLD_LIBRARY_PATH=$PATH_TO_SPECIFIC_10_12${DYLD_LIBRARY_PATH+:$DYLD_LIBRARY_PATH}
792 # Specific libBLAS.dylib & libLAPACK.dylib version for 10.11
793 LD_LIBRARY_PATH=$PATH_TO_SPECIFIC_10_11${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
794 DYLD_LIBRARY_PATH=$PATH_TO_SPECIFIC_10_11${DYLD_LIBRARY_PATH+:$DYLD_LIBRARY_PATH}
797 # Specific libBLAS.dylib & libLAPACK.dylib version for 10.10
798 LD_LIBRARY_PATH=$PATH_TO_SPECIFIC_10_10${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
799 DYLD_LIBRARY_PATH=$PATH_TO_SPECIFIC_10_10${DYLD_LIBRARY_PATH+:$DYLD_LIBRARY_PATH}
802 # Run normally on 10.7, 10.8 & 10.9
805 # the iconv lib fails under 10.7, just declare it for 10.6
806 LD_LIBRARY_PATH=$PATH_TO_SPECIFIC_10_6${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
807 DYLD_LIBRARY_PATH=$PATH_TO_SPECIFIC_10_6${DYLD_LIBRARY_PATH+:$DYLD_LIBRARY_PATH}
819 # Version checks for Mac
823 osascript $BINPATH/checkmacosx.applescript "$1" || exit 128
826 fail_macosx_version()
828 dialog_try_or_exit "This version of Scilab may fail on this system ($macosxVersion): Scilab is currently supported from 10.8.3 (Mountain Lion) to 10.13 (High Sierra)."
830 check_macosx_version()
832 case $macosxMajorVersion in
834 case $macosxMinorVersion in
836 # We force to install JRE on Mavericks
837 /usr/libexec/java_home --request > /dev/null
840 # ... but not on Yosemite, El Capitan, Sierra, High Sierra, Mojave or Catalina:
841 # there will be a (better) error at launch
844 if test $macosxBuildVersion -le 3; then
860 # . is used by the dynamic link. The build lib are copied into the PWD
861 SCILIB=$SCI/bin:$SCI/lib/scilab/:$SCI/lib64/scilab/:.
862 if test -d "$SCI/lib/thirdparty"; then
863 SCILIB=$SCI/lib/thirdparty:$SCILIB;
865 LD_LIBRARY_PATH=$SCILIB${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
866 if test -d "$SCI/lib/thirdparty/redist"; then
867 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SCI/lib/thirdparty/redist;
871 *darwin* | *Darwin*) # MacOS X
872 # When using some packaging tools like fink which are storing the info in /sw/lib
873 LD_LIBRARY_PATH="/sw/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
874 # Export the path to the Scilab lib when Scilab has been install ...
875 # to a Mac os x specific variable used by the linker before LD_LIBRARY_PATH
876 DYLD_LIBRARY_PATH=$SCI/../../lib/scilab/${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}:
877 # Crappy workaround for the dynamic load of sundials under Mac OS X
878 # in the source tree version. This does not occur in the binary
879 # thanks to the previous declaration on ../../lib/scilab
881 if test -d "$SCI/modules/scicos_blocks/.libs/"; then
882 DYLD_LIBRARY_PATH=$SCI/modules/scicos_blocks/.libs/${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}
884 if test -d "$SCI/modules/scicos/.libs/"; then
885 DYLD_LIBRARY_PATH=$SCI/modules/scicos/.libs/${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}
887 export DYLD_LIBRARY_PATH
889 # Now, check that I can run Scilab on this version of Mac OS X and
890 # display a standard window
891 BINPATH=$(dirname $0)
892 # Do not perform the check with Scilab is started in CLI mode
894 detect_macosx_version
895 set_macox_specific_path
897 if test "$SCILAB_MODE" = "gui"; then
901 # When started as an Application, the default path was "/"
902 # It is not really useful. Changing to HOME.
903 # See bugs 8339 and 10575 for rational
904 if test "$(pwd)" = "/"; then
913 if test $SCIVERBOSE -ne 0; then
914 echo "LD_LIBRARY_PATH : $LD_LIBRARY_PATH"
915 if test ! -z "$DYLD_LIBRARY_PATH"; then
916 echo "DYLD_LIBRARY_PATH: $DYLD_LIBRARY_PATH"
919 export LD_LIBRARY_PATH
922 # Scilab does not support the LANGUAGE variable.
923 # Unset to avoid some weird issue. CF bug #10032
926 if test $IS_SCILAB_BINARY -ne 1; then
927 # We are not using the Scilab binary, find out where docbook is.
931 # Check if SELINUX is enable. If it is the case, disable it for Scilab
932 check_and_disable_selinux
937 if test $# -gt 0; then
938 # scinotes is called. We process the arguments
941 for SCIARG in "$@"; do
942 if test "$SCIARG" = "-indent"; then
943 INDENT="['indent','trailing','quote']"
945 ARGS="$ARGS '$SCIARG' "
951 if test -n "$INDENT"; then
952 # Call scinotes with the arguments
953 if test $SCIVERBOSE -ne 0; then
954 echo "Will start scinotes with: $SCILABBIN -nb -nw -e scinotes($ARGS, $INDENT);exit()"
956 "$SCILABBIN" -nb -nw -e "scinotes($ARGS, $INDENT);exit()"
958 if test $SCIVERBOSE -ne 0; then
959 echo "Will start scinotes with: $SCILABBIN -e scinotes($ARGS)"
962 # Call scinotes with no argument
963 "$SCILABBIN" -e "scinotes($ARGS)"
971 if test $# -gt 0; then
972 # xcos is called. We process the arguments
974 for SCIARG in "$@"; do
975 if test "$SCIARG" = "-simulate"; then
976 if test $# -ne 2; then
977 echo "Wrong syntax: When -simulate is used, only one file must be provided."
982 ARGS="$ARGS '$SCIARG' "
988 if test $SIMULATE -eq 1; then
989 if test $SCIVERBOSE -ne 0; then
990 echo "Will start Xcos with: $SCILABBIN -e 'importXcosDiagram($ARGS);xcos_simulate(scs_m, 4)'"
993 # Call xcos with the arguments to simulate
994 "$SCILABBIN" -e "importXcosDiagram($ARGS);xcos_simulate(scs_m, 4)"
996 if test $SCIVERBOSE -ne 0; then
997 echo "Will start Xcos with: $SCILABBIN -e xcos($ARGS)"
1000 # Call xcos with the arguments
1001 "$SCILABBIN" -e "xcos($ARGS)"
1009 if test "$SCILAB_MODE" = "xcos"; then
1012 if test "$SCILAB_MODE" = "scinotes"; then
1023 if test "$SCILAB_MODE" = "xcos"; then
1024 echo "Start Xcos, the hybrid simulator"
1026 echo "xcos [ file1.xcos, [ file2.xcos ]]"
1028 echo " Possible arguments are:"
1029 echo " -simulate : Start the simulation. Only one file will be accepted."
1032 if test "$SCILAB_MODE" = "scinotes"; then
1033 echo "Start Scinotes, the Scilab text editor"
1035 echo "scinotes [ file1.sci, [ file2.sce ]]"
1037 echo " Possible arguments are:"
1038 echo " -indent : format (indent, trailing spaces, quote mismatch) the files"
1043 echo "scilab <arguments>"
1044 echo "scilab-cli <arguments>"
1045 echo "scilab-adv-cli <arguments>"
1047 echo " Possible arguments are:"
1048 echo " -display Display: for use under Xwindow systems to set a specific X server display."
1049 echo " -d Display : equivalent to -display Display."
1050 echo " -e Instruction : execute the scilab instruction given in Instruction argument."
1051 echo " -e and -f arguments are mutually exclusive."
1052 echo " -f File : execute the scilab script given in File argument."
1053 echo " -e and -f arguments are mutually exclusive."
1054 echo " -quit : force scilab exit after execution of script from -e or -f argument."
1055 echo " this flag is ignored if it is not used with -e or -f argument."
1056 echo " -l Lang : set the current language. Lang can be equal to en_US, fr_FR, etc."
1057 echo " -nb : do not display Scilab loading on start."
1058 echo " -ns : do not execute scilab.start startup file. This argument will disable many features in Scilab (Only use if you know what you are doing)."
1059 echo " -nouserstartup : do not execute the user startup files SCIHOME/.scilab or SCIHOME/scilab.ini."
1060 echo " -noatomsautoload: do not load ATOMS installed module."
1061 echo " -nw : start Scilab without dedicated Scilab Window."
1062 echo " -nwni : start Scilab without the GUI, graphic and help features (batch mode). This argument disables the need of Java."
1063 echo " -nogui : See -nwni"
1064 echo " -nocolor : Remove the color in the cli and adv-cli modes"
1065 echo " -args : accept all extra arguments and make them available through sciargs"
1066 echo " -version : print product version and exit."
1067 echo " -h/--help : display help about this command."
1068 echo " --texmacs : reserved for TeXMacs."
1069 echo " -scihome dir : Force SCIHOME to given dir."
1072 echo "Developer arguments:"
1073 echo " -debug : Start Scilab under gdb (Unix/linux only)."
1074 echo " define the variable SCILAB_GDB_OPT to add custom arguments to gdb."
1075 echo " -debug-rr : Start Scilab under rr (Unix/linux only)."
1076 echo " -debug-kdbg : Start Scilab under kdbg (Unix/linux only)."
1077 echo " -profiling : Start Scilab under valgrind (Unix/linux only)."
1078 echo " define the variable SCILAB_VALGRIND_OPT to add custom arguments to"
1079 echo " valgrind (and override the existing valgrind arguments)."
1080 echo " -profiling-visu : Start Scilab under callgrind (Unix/linux only)."
1081 echo " define the variable SCILAB_VALGRIND_OPT to add custom arguments to"
1082 echo " callgrind (and override the existing callgrind arguments)."
1083 echo " -disable-exception-catching : Disable Scilab exception catching system."
1085 echo " --parse-file File : Only parse File argument without execution and exit."
1086 echo " --parse-trace : Display bison state machine evolution."
1087 echo " --AST-trace : Display ASCII-art AST to be human readable."
1088 echo " --pretty-print : Display pretty-printed code, standard Scilab syntax."
1090 echo "Developer Timer arguments:"
1091 echo " --AST-timed : Time each AST node."
1092 echo " --timed : Time global execution."
1094 echo "Developer Debug arguments:"
1095 echo " --no-exec : Only do Lexing/parsing do not execute instructions."
1096 echo " --context-dump : Display context status."
1097 echo " --exec-verbose : Display command before execute it."
1098 echo " --timeout delay : Kill the Scilab process after a delay (s, m, h, d)."
1100 echo " All these arguments can be retrieved by the Scilab function sciargs."
1103 echo " Several environment variables can be declared:"
1104 echo " SCIVERBOSE Provides debugging information of the startup"
1105 echo " JAVA_HOME Declares which Java Virtual Machine to use"
1106 echo " SCI_DISABLE_TK Disables Tk (but not Tcl) features"
1107 echo " SCI_JAVA_ENABLE_HEADLESS Runs Java Headless VM (without GUI; Windows and Linux only)"
1108 echo " SCI_DISABLE_EXCEPTION_CATCHING Disable the catch by Scilab of exception (segfault, ...)"
1113 # under MacOS X LANG is not set when launching Scilab from its icon
1114 if test "$OS" = "Darwin"; then
1115 if test -z "$LANG"; then
1116 export LANG=$(defaults read NSGlobalDomain AppleLocale).UTF-8
1121 echo " $@ " | grep " \-nw " 2>&1 > /dev/null
1122 if ([ $? != 0 ];) && (test "$SCILAB_MODE" = "nw";) then
1126 # calling Scilab with no argument or special cases of calling Scilab
1129 0) # No arg, run Scilab
1141 # really calling Scilab with arguments
1143 if test "$rest" = "yes"; then
1152 # If the previous argument needs an argument, skip current one.
1153 if test -n "$prevarg"; then
1159 -nogui|-version|-ns|-nb|-nouserstartup|-noatomsautoload|-nocolor|--texmacs)
1162 if test "$SCILAB_MODE" = "nwni"; then
1163 echo "Cannot use scilab-cli with option -nw"
1168 if test "$SCILAB_MODE" = "nw"; then
1169 echo "Cannot use scilab-adv-cli with option -nwni"
1173 --parse-trace|--pretty-print|--help|--AST-trace|--no-exec|--context-dump|--exec-verbose|--timed|--AST-timed|--serialize|-quit|--webmode)
1174 #This are Scilab6 dedicated options.
1177 #This are Scilab6 dedicated options with an argument
1181 # Under Mac OS X, .app is adding the arg -psn_0_xxxx
1182 # (psn = ProcessSerialNumber). It is not used (but could be in the future)
1184 -display|-f|-l|-e|-d|--parse-file|-scihome)
1187 -args) # Accept extra arguments
1194 DEBUG_RR="-debug-rr"
1197 DEBUG_KDBG="-debug-kdbg"
1200 PROFILING="-profiling"
1203 PROFILING_VISU="-profiling-visu"
1205 -disable-exception-catching)
1206 SCI_DISABLE_EXCEPTION_CATCHING=1
1207 export SCI_DISABLE_EXCEPTION_CATCHING
1215 # Do nothing. Gives unknown args to Scilab binaries if -args is provided
1221 # If the argument -a is not provided (extraarg) and we found unknown args
1222 # fail and provide help
1223 if test -z "$extraarg" -a -n "$foundUnknownArg"; then
1224 echo "Unknown argument: $wrongArg"
1229 if test -n "$DEBUG"; then
1230 start_debug "$@" $MORE_OPT
1231 elif test -n "$DEBUG_RR"; then
1232 start_debug_rr "$@" $MORE_OPT
1233 elif test -n "$DEBUG_KDBG"; then
1234 start_debug_kdbg "$@" $MORE_OPT
1235 elif test -n "$PROFILING"; then
1236 start_profiling "$@" $MORE_OPT
1237 elif test -n "$PROFILING_VISU"; then
1238 start_profiling_visu "$@" $MORE_OPT
1240 do_scilex "$@" $MORE_OPT