pickup_env()
{
make_env ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE} ${PRODUCT_DIR}
-if [ -f ${PRODUCT_DIR}/bin/salome/createAppli.sh ] ; then
- pushd ${PRODUCT_DIR} > /dev/null
- version=`cat bin/salome/VERSION | awk -F: '{print $2}' | tr -d '[:space:]'`
- dir="${HOME}/salome_appli_${version}"
- ./bin/salome/createAppli.sh ${dir}
- if [ -d ${dir}/env.d ] ; then
- rm -rf ${dir}/env.d/*.sh
- fi
- if [ ! -e ${dir}/env.d ] ; then
- mkdir -p ${dir}/env.d
- fi
- cp -f ${PRODUCT_DIR}/salome.sh ${dir}/env.d
- popd > /dev/null
-fi
-./create_application.sh ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_DIR}
+./create_config.sh ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_DIR}
make_env ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src ${PRODUCT_SRC_DIR}
}
export DELIM="------"
export SHRC="salome.sh"
export CSHRC="salome.csh"
+export CFGRC="salome.cfg"
#####################################################
# !WARNING! This is current SALOME version number
install_root=$1; shift
install_work=$1;
-for i in ${SHRC} ${CSHRC} ; do
+for i in ${SHRC} ${CSHRC} ${CFGRC} ; do
if [ -e ${install_work}/${i} ]; then
rm ${install_work}/${i}
fi
product_env=${install_work}/env_${product_name}.sh
(test -e ${product_env} && rm ${product_env} )
fi
+
### !!! writing salome.sh file !!! -> define INST_ROOT
cat >> ${install_work}/${SHRC} <<EOF
#${DELIM} Setting products installation directory ${DELIM}
export LC_NUMERIC=C
EOF
-### !!! The next is for RedHat 9 only !!!
-if [ -f /etc/redhat-release ] ; then
- grep -e "Red Hat Linux release 9" /etc/redhat-release > /dev/null
- if [ $? -eq 0 ] ; then
- cat >> ${install_work}/${SHRC} <<EOF
-#${DELIM} Force RH9 to use old implementation of threads ${DELIM}
-export LD_ASSUME_KERNEL=2.4.18
-EOF
- fi
-fi
### !!! writing salome.csh file !!! -> set inital variables
pre_vars="PATH LD_LIBRARY_PATH LD_RUN_PATH PYTHONPATH TCLLIBPATH"
for i in ${pre_vars} ; do
EOF
done
+### !!! writing salome.cfs file !!! -> set inital variables
+cat >> ${install_work}/${CFGRC} <<EOF
+[SALOME Configuration]
+
+EOF
+
### !!! writing salome.(c)sh files !!! -> dump products environment files, changing 'export' by 'setenv(a|p)' where necessary
### Note, that for performance reasons temporary environment files used during installation procedure itself
### are created without using setenv(a|p) aliases.
rm -f ${INSTALL_WORK}/_tmp1 ${INSTALL_WORK}/_tmp2
+# 7. Create a salome.cfg file from salome.sh
+cat ${install_work}/${SHRC} | grep -v -e "^## " | grep -v "PV_PLUGIN_PATH" | awk 'BEGIN {v=1} /if / {v=0;} /fi/ {v=1;} {if (match($0, "KERNEL")) exit 0; else if(v==1 && match($0, "^ *fi *$")==0) print $0;}' >> ${install_work}/${CFGRC}
+sed -i "s%export PATH=\(.*\):\${\?PATH}\?%ADD_TO_PATH: \1%g" ${install_work}/${CFGRC}
+sed -i "s%export LD_LIBRARY_PATH=\(.*\):\${\?LD_LIBRARY_PATH}\?%ADD_TO_LD_LIBRARY_PATH: \1%g" ${install_work}/${CFGRC}
+sed -i "s%export PYTHONPATH=\(.*\):\${\?PYTHONPATH}\?%ADD_TO_PYTHONPATH: \1%g" ${install_work}/${CFGRC}
+sed -i "s%export %%g" ${install_work}/${CFGRC}
+sed -i "s%INST_ROOT%ROOT_SALOME%g" ${install_work}/${CFGRC}
+sed -i "s%\${\?\([A-Za-z0-9_]\+\)}\?%\%(\1)s%g" ${install_work}/${CFGRC}
+
if [ $# -eq 5 ] ; then
product_dir=$5
- if [ -e ${product_dir} ] ; then
+ if [ -d ${product_dir} ] ; then
test -e ${product_dir}/${SHRC} && mv ${product_dir}/${SHRC} ${product_dir}/${SHRC}_`date +%F_%T`
cp ${install_work}/_${SHRC} ${product_dir}/${SHRC}
test -e ${product_dir}/${CSHRC} && mv ${product_dir}/${CSHRC} ${product_dir}/${CSHRC}_`date +%F_%T`
cp ${install_work}/_${CSHRC} ${product_dir}/${CSHRC}
+ test -e ${product_dir}/${CFGRC} && mv ${product_dir}/${CFGRC} ${product_dir}/${CFGRC}_`date +%F_%T`
+ cp ${install_work}/${CFGRC} ${product_dir}/${CFGRC}
fi
fi
sed -e 's%setenv ENV_FOR_LAUNCH 1%setenv ENV_FOR_LAUNCH 0%' ${install_work}/_${CSHRC} > ${install_root}/env_build.csh
cp -f ${install_work}/_${SHRC} ${install_root}/env_products.sh
rm -f ${install_work}/_${SHRC} ${install_work}/_${CSHRC}
+
### !!! copying build.csh and build.sh scripts
if [ -e ./build.csh ] && [ ! -e ${install_root}/build.csh ]; then
cp -f ./build.csh ${install_root}
if [ -e ./build.sh ] && [ ! -e ${install_root}/build.sh ]; then
cp -f ./build.sh ${install_root}
fi
+
### !!! copying release notes
for p in `ls ../` ; do
export pdf=`echo ${p} | sed s/[.]/" "/g | awk '{print $2}'`
#!/bin/bash -noprofile
####################################################################################
-# File : create_config.sh
+# File : create_application.sh
# Created : Fri May 30 10:40:01 2008
# Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
# Project : SALOME
# --- configuration file ---
CONFIG_FILE=${INSTALL_WORK}/config_appli.xml
+# -- spacing for configuration file ---
+SPACING=" "
+
+# ----------------------------------
# create and source environment file
+# ----------------------------------
+
make_env ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
source ${INSTALL_WORK}/${SHRC}
-# remove config file
+# ----------------------------------
+# create config file
+# ----------------------------------
+
+# remove previous config file
if [ -e ${CONFIG_FILE} ] ; then
- rm ${CONFIG_FILE}
+ rm -f ${CONFIG_FILE}
fi
+
# create empty config file
touch ${CONFIG_FILE}
echo "<application>" >> ${CONFIG_FILE}
# <prerequisites> tag : path to the environment script
-echo " <prerequisites path=\"${INST_ROOT}/env_products.sh\"/>" >> ${CONFIG_FILE}
+echo "${SPACING}<prerequisites path=\"${PRODUCT_DIR}/salome.sh\"/>" >> ${CONFIG_FILE}
+
+# <context> tag : path to the context file
+echo "${SPACING}<context path=\"${PRODUCT_DIR}/salome.cfg\"/>" >> ${CONFIG_FILE}
+
+# <resources> tag
+echo "${SPACING}<resources path=\"CatalogResources.xml\"/>" >> ${CONFIG_FILE}
# begin <modules> tag
-echo " <modules>" >> ${CONFIG_FILE}
+echo "${SPACING}<modules>" >> ${CONFIG_FILE}
# for each module create <module> tag
-ALL_ENV="`env | awk -F_ '/[a-zA-Z0-9]*_ROOT_DIR/ { print $1 }' | grep -v -E '^SALOME$'`"
+ALL_ENV="KERNEL GUI `env | awk -F_ '/[a-zA-Z0-9]*_ROOT_DIR/ { print $1 }' | grep -v -E '^(SALOME|KERNEL|GUI)$' | sort -u`"
for p in ${ALL_ENV} ; do
pvar=${p}_ROOT_DIR
pdir=${!pvar}
+ # if it's a SALOME module, it should have share/salome/resources sub-directory
if [ -d ${pdir}/share/salome/resources ] ; then
case ${p} in
- KERNEL | GUI | *PLUGIN ) echo " <module name=\"${p}\" gui=\"no\" path=\"${pdir}\"/>" >> ${CONFIG_FILE} ;;
- * ) echo " <module name=\"${p}\" gui=\"yes\" path=\"${pdir}\"/>" >> ${CONFIG_FILE} ;;
+ KERNEL | GUI | COMPONENT | *CALCULATOR | RANDOMIZER | DSCCODE | *PLUGIN ) echo "${SPACING}${SPACING}<module name=\"${p}\" gui=\"no\" path=\"${pdir}\"/>" >> ${CONFIG_FILE} ;;
+ * ) echo "${SPACING}${SPACING}<module name=\"${p}\" gui=\"yes\" path=\"${pdir}\"/>" >> ${CONFIG_FILE} ;;
esac
fi
done
# end <modules> tag
-echo " </modules>" >> ${CONFIG_FILE}
+echo "${SPACING}</modules>" >> ${CONFIG_FILE}
# <samples> tag : path to the samples directory
if [ -n ${DATA_DIR} ] && [ -d ${DATA_DIR} ] ; then
- echo " <samples path=\"${DATA_DIR}\"/>" >> ${CONFIG_FILE}
+ echo "${SPACING}<samples path=\"${DATA_DIR}\"/>" >> ${CONFIG_FILE}
fi
# end <application> tag
# copy resulting confuguration file to the KERNEL module
if [ -n "${PRODUCT_DIR}" ] && [ -d ${PRODUCT_DIR} ] ; then
- cp -f ${CONFIG_FILE} ${PRODUCT_DIR}/bin/salome
+ cp -f ${CONFIG_FILE} ${PRODUCT_DIR}
+fi
+
+# ----------------------------------
+# generate application
+# ----------------------------------
+
+if [ -f ${PRODUCT_DIR}/bin/salome/appli_gen.py ] ; then
+ version=`head -n1 ${PRODUCT_DIR}/bin/salome/VERSION | awk -F: '{print $2}' | tr -d '[:space:]'`
+ ${PRODUCT_DIR}/bin/salome/appli_gen.py --prefix=${INST_ROOT}/salome_appli_${version} --config=${PRODUCT_DIR}/config_appli.xml >& /dev/null
fi