]> SALOME platform Git repositories - tools/install.git/commitdiff
Salome HOME
PAL6777
authorvsr <vsr@opencascade.com>
Thu, 2 Jun 2005 07:36:06 +0000 (07:36 +0000)
committervsr <vsr@opencascade.com>
Thu, 2 Jun 2005 07:36:06 +0000 (07:36 +0000)
config_files/KERNEL_BIN.sh
config_files/common.sh

index 17b2c58763b26239deff5044e8c3e102237450f0..3b679f2c9e2b7c87b2761f6d1782883be43aa5f2 100755 (executable)
@@ -17,6 +17,13 @@ print_env(){
 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
 export KERNEL_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
+if [ -n "\${ENV_FOR_LAUNCH}" ] ; then
+  if [ "\${ENV_FOR_LAUNCH}" == "1" ] ; then
+    export PATH=\${KERNEL_ROOT_DIR}/bin/salome:\${PATH}
+    export LD_LIBRARY_PATH=\${KERNEL_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
+    export PYTHONPATH=\${KERNEL_ROOT_DIR}/bin/salome:\${KERNEL_ROOT_DIR}/lib/salome:\${KERNEL_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
+  fi
+fi
 ##
 EOF
 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
@@ -30,6 +37,13 @@ if [ $? -eq 0 ] ; then
     cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
 #$DELIM ${PRODUCT_TYPE} $DELIM
 export KERNEL_ROOT_DIR=\${INSTALL_ROOT}/${PRODUCT}
+if [ -n "\${ENV_FOR_LAUNCH}" ] ; then
+  if [ "\${ENV_FOR_LAUNCH}" == "1" ] ; then
+    export PATH=\${KERNEL_ROOT_DIR}/bin/salome:\${PATH}
+    export LD_LIBRARY_PATH=\${KERNEL_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
+    export PYTHONPATH=\${KERNEL_ROOT_DIR}/bin/salome:\${KERNEL_ROOT_DIR}/lib/salome:\${KERNEL_ROOT_DIR}/lib/python2.2/site-packages/salome:\${PYTHONPATH}
+  fi
+fi
 ##
 EOF
     make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
index 9a0dce607937c9fc3c45e0a3e45b422be33a9628..2bca801a55978ef7a16cca529883e62da31ab092 100755 (executable)
@@ -93,6 +93,9 @@ cat >> ${install_work}/$SHRC <<EOF
 #${DELIM} Setting products installation directory ${DELIM}
 export INSTALL_ROOT=${install_root}
 
+#${DELIM} Environment switch: 0 for SALOME building, 1 for SALOME launching ${DELIM}
+export ENV_FOR_LAUNCH=1
+
 EOF
 ### !!! writing salome.csh file !!! -> set inital variables
 pre_vars="PATH LD_LIBRARY_PATH LD_RUN_PATH PYTHONPATH TCLLIBPATH"
@@ -138,7 +141,8 @@ cat >> ${install_work}/_$SHRC <<EOF
 cleandup() {
 out_var=\`echo \$1 \$2 | awk -v dir=\$3 '{                   \\
     na = split(\$2,a,":");                                \\
-    nb = split(\$1,b,":");                                \\
+    if ( \$1 == "<empty>") nb = split("",b,":");          \\
+    else nb = split(\$1,b,":");                           \\
     s = "" ;                                             \\
     for(i=1;i<=nb;i++) {                                 \\
        if(!(b[i] in ccc)) {                             \\
@@ -170,6 +174,7 @@ echo \$out_var
 # to the variable (first parameter)
 exporta () { 
 xenv=\`printenv \$1\`
+if [ -z "\$xenv" ]; then xenv="<empty>"; fi
 out_var=\`cleandup \$xenv \$2 0\`
 export \$1=\$out_var
 }
@@ -178,6 +183,7 @@ export \$1=\$out_var
 # to the variable (first parameter)
 exportp () { 
 xenv=\`printenv \$1\`
+if [ -z "\$xenv" ]; then xenv="<empty>"; fi
 out_var=\`cleandup \$xenv \$2 1\`
 export \$1=\$out_var
 }
@@ -254,21 +260,24 @@ EOF
 cat ${install_work}/$CSHRC >> ${install_work}/_$CSHRC
 
 # 4. put the contents of salome.sh to _salome.sh replacing export by export(a|p) aliases where necessary
-sed -e 's%^export\([[:blank:]]*\)PATH=\$[{]\?PATH[}]\?:\(.*\)%exporta\1PATH \2%g' -e 's%^export\([[:blank:]]*\)PATH=\(.*\):\$[{]\?PATH[}]\?%exportp\1PATH \2%g' ${install_work}/$SHRC > ${INSTALL_WORK}/_tmp1 2>/dev/null
-sed -e 's%^export\([[:blank:]]*\)LD_LIBRARY_PATH=\$[{]\?LD_LIBRARY_PATH[}]\?:\(.*\)%exporta\1LD_LIBRARY_PATH \2%g' -e 's%^export\([[:blank:]]*\)LD_LIBRARY_PATH=\(.*\):\$[{]\?LD_LIBRARY_PATH[}]\?%exportp\1LD_LIBRARY_PATH \2%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
-sed -e 's%^export\([[:blank:]]*\)PYTHONPATH=\$[{]\?PYTHONPATH[}]\?:\(.*\)%exporta\1PYTHONPATH \2%g' -e 's%^export\([[:blank:]]*\)PYTHONPATH=\(.*\):\$[{]\?PYTHONPATH[}]\?%exportp\1PYTHONPATH \2%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
-sed -e 's%^export\([[:blank:]]*\)LD_RUN_PATH=\$[{]\?LD_RUN_PATH[}]\?:\(.*\)%exporta\1LD_RUN_PATH \2%g' -e 's%^export\([[:blank:]]*\)LD_RUN_PATH=\(.*\):\$[{]\?LD_RUN_PATH[}]\?%exportp\1LD_RUN_PATH \2%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2
+sed -e 's%export\([[:blank:]]*\)PATH=\$[{]\?PATH[}]\?:\(.*\)%exporta\1PATH \2%g' -e 's%export\([[:blank:]]*\)PATH=\(.*\):\$[{]\?PATH[}]\?%exportp\1PATH \2%g' ${install_work}/$SHRC > ${INSTALL_WORK}/_tmp1 2>/dev/null
+sed -e 's%export\([[:blank:]]*\)LD_LIBRARY_PATH=\$[{]\?LD_LIBRARY_PATH[}]\?:\(.*\)%exporta\1LD_LIBRARY_PATH \2%g' -e 's%export\([[:blank:]]*\)LD_LIBRARY_PATH=\(.*\):\$[{]\?LD_LIBRARY_PATH[}]\?%exportp\1LD_LIBRARY_PATH \2%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
+sed -e 's%export\([[:blank:]]*\)PYTHONPATH=\$[{]\?PYTHONPATH[}]\?:\(.*\)%exporta\1PYTHONPATH \2%g' -e 's%export\([[:blank:]]*\)PYTHONPATH=\(.*\):\$[{]\?PYTHONPATH[}]\?%exportp\1PYTHONPATH \2%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
+sed -e 's%export\([[:blank:]]*\)LD_RUN_PATH=\$[{]\?LD_RUN_PATH[}]\?:\(.*\)%exporta\1LD_RUN_PATH \2%g' -e 's%export\([[:blank:]]*\)LD_RUN_PATH=\(.*\):\$[{]\?LD_RUN_PATH[}]\?%exportp\1LD_RUN_PATH \2%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2
 cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/_$SHRC
 
 # 5. Create a salome.csh file from salome.sh by replacing export by setenv, etc.
-sed -e 's%^export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${install_work}/$SHRC > ${INSTALL_WORK}/_tmp1 2>/dev/null
+sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${install_work}/$SHRC > ${INSTALL_WORK}/_tmp1 2>/dev/null
 cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/$CSHRC
 
 # 6. Create a _salome.csh file from _salome.sh by replacing export by setenv, exporta by setenva, etc.
-sed -e 's%^export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
-sed -e 's%^exporta \([[:alnum:]_[:blank:]]*\)%setenva \1%g'  ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
-sed -e 's%^exportp \([[:alnum:]_[:blank:]]*\)%setenvp \1%g'  ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
-cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/_$CSHRC 2>/dev/null
+sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
+sed -e 's%exporta \([[:alnum:]_[:blank:]]*\)%setenva \1%g'  ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
+sed -e 's%exportp \([[:alnum:]_[:blank:]]*\)%setenvp \1%g'  ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
+sed -e 's%if \[ -n "\${ENV_FOR_LAUNCH}" \] ; then%if ( ${?ENV_FOR_LAUNCH} ) then%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
+sed -e 's%if \[ "\${ENV_FOR_LAUNCH}" == "1" \] ; then%if ( "\${ENV_FOR_LAUNCH}" == "1" ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
+sed -e 's%^\([[:blank:]]*\)fi\([[:blank:]]*\)$%\1endif\2%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
+cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/_$CSHRC 2>/dev/null
 
 rm -f ${INSTALL_WORK}/_tmp1 ${INSTALL_WORK}/_tmp2
 
@@ -279,8 +288,8 @@ if [ $# -eq 4 ] ; then
        cp -f ${install_work}/_$CSHRC ${product_dir}/$CSHRC
     fi
 fi
-cp -f ${install_work}/_$CSHRC ${install_root}/env_products.csh
-cp -f ${install_work}/_$SHRC  ${install_root}/env_products.sh
+sed -e 's%setenv ENV_FOR_LAUNCH 1%setenv ENV_FOR_LAUNCH 0%' ${install_work}/_$CSHRC > ${install_root}/env_products.csh
+sed -e 's%export ENV_FOR_LAUNCH=1%export ENV_FOR_LAUNCH=0%' ${install_work}/_$SHRC  > ${install_root}/env_products.sh
 rm -f ${install_work}/_$SHRC
 rm -f ${install_work}/_$CSHRC
 ### !!! copying build.csh script