Salome HOME
Merge from V6_5_BR 05/06/2012
[modules/smesh.git] / src / Tools / padder / resources / appligen / genenv.sh
1 #!/bin/bash
2
3 # Copyright (C) 2011-2012  CEA/DEN, EDF R&D
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18 #
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #
21
22 # This script creates a source file that defines a SALOME shell
23 # environment. We assume here that the SALOME environment has been
24 # previously set, so that the env command get all environment
25 # variables required for building and executing SALOME. We talk
26 # about third party software programs and libraries. The environment
27 # variables defining SALOME module are exluded (i.e. *_ROOT_DIR)
28 # because they are automatically set when generating a SALOME application..
29 #
30 # The argument is the filepath to be created.
31 #
32
33 if [ $# == 1 ]; then
34     ENVAPPLI_SH=$1
35 else
36     ENVAPPLI_SH=envappli.sh
37 fi
38
39 function header {
40     echo "#"
41     echo "# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
42     echo "# THIS FILE IS GENERATED from the shell environment used to build the SALOME module."
43     echo "# IT SHOULD NOT BE EDITED, it is generated for the need of the SALOME application   "
44     echo "# that embeds the module (for test purposes).                                       "
45     echo "# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
46     echo "#"
47 }
48 header > $ENVAPPLI_SH
49 env | grep -v -e PWD -e SalomeAppConfig -e _ROOT_DIR | while read f; do
50     key=$(echo $f | cut -d"=" -f1)
51     value=$(echo $f | cut -d"=" -f2-)
52
53     # if the key is a path (LD_LIBRARY_PATH, PATH and PYTHONPATH) then
54     # we must extends the variable.
55     if [ $key == "LD_LIBRARY_PATH" -o $key == "PATH" -o $key == "PYTHONPATH" ]; then
56         echo export $key=\"$value:\$$key\"
57     else
58         echo export $key=\"$value\"
59     fi
60 done >> $ENVAPPLI_SH