Different directory trees in Scilab under GNU-Linux Unix
Linux/Unix world is very different from the Windows one.
There is different ways to create/manage directory trees. There is a list of cases in Scilab 5.
Different types of tree
It is the most used directory tree used by Scilab developers. However, it is probably the least used because a vast majority of users use the binary or the packaged version of Scilab.
Basically, Scilab is checkout in a specific directory. It is built with the commands ./configure && make and Scilab can be launched with the command ./bin/scilab
- The binary tree is mixed with the source tree.
- SCI is pointing to the root directory of this tree.
Dynamic libraries are stored in libs/.libs/*.so, modules/*/.libs/*.so and modules/.libs/*.so
SCI/scilab-bin is a wrapper to .libs/lt-scilab-bin (lt = libtool) in order to manage paths to the .so
make install without prefix
A user download the source tree and is building Scilab with the commands ./configure && make install. Files will be dispatched into /usr/local/ matching the Linux/Unix policy.
Files/directories are slitted into /usr/local/
make install with prefix
A user download the source tree and is building Scilab with the commands ./configure --prefix=/my/path/that/I/like/ && make install. Files will be dispatched into /my/path/that/I/like/ matching the Linux/Unix policy.
Note: It is the way we use to produce the binary available on the website.
Files/directories are slitted into /my/path/that/I/like/
The distribution packaged version of Scilab
Under GNU/Linux, the most used and best vector of diffusion of a free software is to be packaged into Linux distribution. This work is done by packager working for a specific distribution. More information is available on this wiki: Scilab Linux/Unix packages
This work is usually done using the DESTDIR variable. This can be done this way: make install prefix=\$(DESTDIR)/usr bindir=\$(DESTDIR)/usr/bin datadir=\$(DESTDIR)/usr/share/scilab
- Files/directories match the Filesystem Hierarchy Standard (FHS) and the Debian Policy. ie:
How it is actually managed ?
Most of Scilab paths management is done thanks to the SCI variable. This variable is set by the Scilab script: xxx/bin/scilab. For more information about this script, have a look to the comment in this file.
In the dynamic link modules (ie ilib_for_link), we are detecting in which kind of installation we are in order to set the include dir path right. This is done in: modules/dynamic_link/macros/ilib_compile.sci
In Scicos, for Modelica blocks, it is managed in modules/scicos/macros/scicos_scicos/scicos_block_link.sci and modules/scicos/macros/scicos_scicos/buildnewblock.sci. Please note this point will probably merged with the second point by doing a function hiding this complexity (like getIncludeScilabPath for example)
For the dynamic load of libraries (scicos, metanet...) , we are using the LD_LIBRARY_PATH variable which is set in the script bin/scilab. This variable is one the location used by dlopen to load libraries (see man dlopen)