# Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
# Project : SALOME
# Module : Installation Wizard
-# Copyright : 2002-2007 CEA
+# Copyright : 2002-2013 CEA
#
# This script is the part of the SALOME installation procedure.
#
export SHRC="salome.sh"
export CSHRC="salome.csh"
+#####################################################
+# !WARNING! This is current SALOME version number
+####################################################
+export SALOME_VERSION="7.3.0"
+export YACSGEN_VERSION=${SALOME_VERSION}
-#this function takes several parameters
-#first parameter contains path to module source filder
-#second parameters is value of $VERSION variables form MODULE.sh file
+# Name of the single directory for SALOME modules
+export SDIR_NAME="SALOME_${SALOME_VERSION}"
+#this function takes one parameter - path to module source folder
check_salome_src_version(){
-root_dir=`printenv $1`
-module_version=$2
+root_dir=${!1}
-if [ -n "$root_dir" ]; then
+if [ -n "${root_dir}" ]; then
cfg_file=configure.ac
if [ ! -f ${root_dir}/${cfg_file} ] ; then
cfg_file=configure.in.base
- fi
+ else
+ cfg_file=CMakeLists.txt
+ fi
if [ -f ${root_dir}/${cfg_file} ] ; then
- ver=`grep -e "^AC_INIT" ${root_dir}/${cfg_file} | sed -e "s%.*\[\([[:digit:].]*\)\].*%\1%g"`
- if [ "$ver" = "${module_version}" ]; then
+ if [ "${cfg_file}" = "CMakeLists.txt" ] ; then
+ ver_maj=`cat ${root_dir}/${cfg_file} | grep SET\(VERSION_MAJOR | sed -e "s%[A-Z_() ]%%g"`
+ ver_min=`cat ${root_dir}/${cfg_file} | grep SET\(VERSION_MINOR | sed -e "s%[A-Z_() ]%%g"`
+ ver_maintenance=`cat ${root_dir}/${cfg_file} | grep SET\(VERSION_MAINTENANCE | sed -e "s%[A-Z_() ]%%g"`
+ ver="${ver_maj}.${ver_min}.${ver_maintenance}"
+ else
+ ver=`grep -e "^AC_INIT" ${root_dir}/${cfg_file} | sed -e "s%.*\[\([[:digit:].]*\)\].*%\1%g"`
+ fi
+
+ if [ "${ver}" = "${SALOME_VERSION}" ]; then
return 0
fi
fi
out=$1
shift
errfile=/tmp/errlog
- if [ -n "$INSTALL_WORK" ] ; then errfile=$INSTALL_WORK/errlog; fi
+ if [ -n "${INSTALL_WORK}" ] ; then errfile=${INSTALL_WORK}/errlog; fi
cmd="`pwd` -> $*"
- if [ "$out" != "1" ] ; then cmd="$cmd >> $out" ; fi
- echo -e $cmd
- if [ "$out" != "1" ] ; then
- $* >> $out 2>$errfile
+ if [ "${out}" != "1" ] ; then cmd="${cmd} >> ${out}" ; fi
+ echo -e ${cmd}
+ if [ "${out}" != "1" ] ; then
+ $* >> ${out} 2>${errfile}
else
$*
fi
if [ "$?" -ne "0" ] ; then
- if [ $out != "1" ] ; then
- cat $out
- cat $errfile >&2
- cat $errfile >> $out
+ if [ ${out} != "1" ] ; then
+ cat ${out}
+ cat ${errfile} >&2
+ cat ${errfile} >> ${out}
fi
# VSR : 10/11/05: disable answer mode ==>
#echo -n " " >&2
#echo -e "NOT DONE !!! => $*"
#echo -n "Would you like to continue to install this product: (Y,N) [Y] : "
#read rep;
- #rep=`echo $rep | tr "[A-Z]" "[a-z]"`
- #if test -z $rep || [ $rep = "y" ] ; then
+ #rep=`echo ${rep} | tr "[A-Z]" "[a-z]"`
+ #if test -z ${rep} || [ ${rep} = "y" ] ; then
# return 1
#fi
# VSR : 10/11/05: disable answer mode <==
install_root=$1; shift
install_work=$1;
-for i in $SHRC $CSHRC ; do
- if [ -e ${install_work}/$i ]; then
- rm ${install_work}/$i
+for i in ${SHRC} ${CSHRC} ; do
+ if [ -e ${install_work}/${i} ]; then
+ rm ${install_work}/${i}
fi
- touch ${install_work}/$i
+ touch ${install_work}/${i}
done
if [ $# -eq 4 ] ; then
(test -e ${product_env} && rm ${product_env} )
fi
### !!! writing salome.sh file !!! -> define INST_ROOT
-cat >> ${install_work}/$SHRC <<EOF
+cat >> ${install_work}/${SHRC} <<EOF
#${DELIM} Setting products installation directory ${DELIM}
export INST_ROOT=${install_root}
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
+ cat >> ${install_work}/${SHRC} <<EOF
#${DELIM} Force RH9 to use old implementation of threads ${DELIM}
export LD_ASSUME_KERNEL=2.4.18
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
-cat >> ${install_work}/$CSHRC <<EOF
+for i in ${pre_vars} ; do
+cat >> ${install_work}/${CSHRC} <<EOF
#${DELIM} setting initial ${i} ${DELIM}
if (! (\$?${i}) ) then
- setenv $i
+ setenv ${i}
endif
EOF
# 0. add /usr/lib or /usr/lib64 dir to the LD_LIBRARY_PATH
#if test `uname -m` = "x86_64" ; then
-#echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> ${install_work}/$SHRC 2>/dev/null
-#echo '' >> ${install_work}/$SHRC 2>/dev/null
+#echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> ${install_work}/${SHRC} 2>/dev/null
+#echo '' >> ${install_work}/${SHRC} 2>/dev/null
#else
-#echo 'export LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH}' >> ${install_work}/$SHRC 2>/dev/null
-#echo '' >> ${install_work}/$SHRC 2>/dev/null
+#echo 'export LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH}' >> ${install_work}/${SHRC} 2>/dev/null
+#echo '' >> ${install_work}/${SHRC} 2>/dev/null
#fi
# Licence activation
# Source of license environment file
-echo '#------ License activation ------' >> ${install_work}/$SHRC 2>/dev/null
-echo 'export LICENSE_FILE=/product/distene/dlim8.var.sh' >> ${install_work}/$SHRC 2>/dev/null
-echo '' >> ${install_work}/$SHRC 2>/dev/null
-echo 'if [ -e "${LICENSE_FILE}" ] ; then' >> ${install_work}/$SHRC 2>/dev/null
-echo 'export SIMULOGD_LICENSE_FILE=29029@amun' >> ${install_work}/$SHRC 2>/dev/null
-echo 'source ${LICENSE_FILE}' >> ${install_work}/$SHRC 2>/dev/null
-echo 'fi' >> ${install_work}/$SHRC 2>/dev/null
-echo '' >> ${install_work}/$SHRC 2>/dev/null
+echo '#------ License activation ------' >> ${install_work}/${SHRC} 2>/dev/null
+echo 'export LICENSE_FILE=/product/distene/dlim8.var.sh' >> ${install_work}/${SHRC} 2>/dev/null
+echo '' >> ${install_work}/${SHRC} 2>/dev/null
+echo 'if [ -e "${LICENSE_FILE}" ] ; then' >> ${install_work}/${SHRC} 2>/dev/null
+echo 'export SIMULOGD_LICENSE_FILE=29029@soleil' >> ${install_work}/${SHRC} 2>/dev/null
+echo 'source ${LICENSE_FILE}' >> ${install_work}/${SHRC} 2>/dev/null
+echo 'fi' >> ${install_work}/${SHRC} 2>/dev/null
+echo '' >> ${install_work}/${SHRC} 2>/dev/null
-# 1. first dump all environment files into the $SHRC file
+# 1. first dump all environment files into the ${SHRC} file
product_sequence="$2"
install_products="$3"
-for i in $product_sequence ; do
+for i in ${product_sequence} ; do
env_file=${install_work}/env_${i}.sh
_env_file=${install_work}/_env_${i}.sh
- if [ -e $_env_file ] ; then
- cat $_env_file >> ${install_work}/$SHRC 2>/dev/null
- elif [ -e $env_file ] ; then
- echo $install_products | grep -q "\b${i}\b"
+ if [ -e ${_env_file} ] ; then
+ cat ${_env_file} >> ${install_work}/${SHRC} 2>/dev/null
+ elif [ -e ${env_file} ] ; then
+ echo ${install_products} | grep -q "\b${i}\b"
if [ $? -eq 1 ] ; then
- cat $env_file | sed 's/^/## /' >> ${install_work}/$SHRC 2>/dev/null
+ cat ${env_file} | sed 's/^/## /' >> ${install_work}/${SHRC} 2>/dev/null
else
- cat $env_file >> ${install_work}/$SHRC 2>/dev/null
+ cat ${env_file} >> ${install_work}/${SHRC} 2>/dev/null
fi
fi
done
# 2. writing global functions to _salome.sh file
-cat >> ${install_work}/_$SHRC <<EOF
+cat >> ${install_work}/_${SHRC} <<EOF
##########################################################################
# Functions exporta and exportp are used to append/prepend correspondingly
# one directory or a set of directories separated by semicolon symbol (':')
} \\
} \\
}' | sed -e 's/\(.*\):/\1/g'\`
-echo \$out_var
+echo \${out_var}
}
### exporta ###
# appends directory or set of directories, separated by ':' (second parameter)
# 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
+xenv=\${!1}
+if [ -z "\${xenv}" ]; then xenv="<empty>"; fi
+out_var=\`cleandup \${xenv} \$2 0\`
+export \$1=\${out_var}
}
### exportp ###
# prepends directory or set of directories, separated by ':' (second parameter)
# 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
+xenv=\${!1}
+if [ -z "\${xenv}" ]; then xenv="<empty>"; fi
+out_var=\`cleandup \${xenv} \$2 1\`
+export \$1=\${out_var}
}
###########################################################################
EOF
# 3. writing global functions to _salome.csh file
-cat >> ${install_work}/_$CSHRC <<EOF
+cat >> ${install_work}/_${CSHRC} <<EOF
###########################################################################
# Aliases setenva and setenvp are used to append/prepend correspondingly
### setenva ###
# appends directory or set of directories, separated by ':' (second parameter)
# to the variable (first parameter)
-alias setenva 'set a=\!:1 ; set b=\!:2 ; \\
- set c=\`printenv \$a\` ; \\
- set b=\`cleandup \$c \$b 0\` ; \\
- setenv \$a \$b ; \\
+alias setenva 'set a=\!:1 ; set b=\!:2 ; \\
+ set c=\`printenv \${a}\` ; \\
+ set b=\`cleandup \${c} \${b} 0\` ; \\
+ setenv \${a} \${b} ; \\
unset a, b, c'
### setenvp ###
# prepends directory or set of directories, separated by ':' (second parameter)
# to the variable (first parameter)
-alias setenvp 'set a=\!:1 ; set b=\!:2 ; \\
- set c=\`printenv \$a\` ; \\
- set b=\`cleandup \$c \$b 1\` ; \\
- setenv \$a \$b ; \\
+alias setenvp 'set a=\!:1 ; set b=\!:2 ; \\
+ set c=\`printenv \${a}\` ; \\
+ set b=\`cleandup \${c} \${b} 1\` ; \\
+ setenv \${a} \${b} ; \\
unset a, b, c'
###########################################################################
EOF
-cat ${install_work}/$CSHRC >> ${install_work}/_$CSHRC
+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:]]*\)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
#echo 'export LD_LIBRARY_PATH=/usr/X11R6/lib:${LD_LIBRARY_PATH}' >> ${INSTALL_WORK}/_tmp2
#fi
-cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/_$SHRC
+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
-cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/$CSHRC
+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%exportp \([[:alnum:]_[:blank:]]*\)%setenvp \1%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
sed -e 's%if \[ -n "\${PYTHONPATH}" \] ; then%if ( ${?PYTHONPATH} ) then%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
sed -e 's%if \[ -n "\${ENV_FOR_LAUNCH}" \] ; then%if ( ${?ENV_FOR_LAUNCH} ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
-sed -e 's%if \[ "\${ENV_FOR_LAUNCH}" == "1" \] ; then%if ( "\${ENV_FOR_LAUNCH}" == "1" ) 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}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
sed -e 's%^\([[:blank:]]*\)fi\([[:blank:]]*\)$%\1endif\2%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
sed -e 's%var.sh%var.csh%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
sed -e 's%if \[ -e "\${LICENSE_FILE}" \] ; then%if ( -e ${LICENSE_FILE} ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
-cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/_$CSHRC 2>/dev/null
+cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/_${CSHRC} 2>/dev/null
rm -f ${INSTALL_WORK}/_tmp1 ${INSTALL_WORK}/_tmp2
if [ $# -eq 5 ] ; then
product_dir=$5
if [ -e ${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}/${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}
fi
fi
-sed -e 's%setenv ENV_FOR_LAUNCH 1%setenv ENV_FOR_LAUNCH 0%' ${install_work}/_$CSHRC > ${install_root}/env_build.csh
-sed -e 's%export ENV_FOR_LAUNCH=1%export ENV_FOR_LAUNCH=0%' ${install_work}/_$SHRC > ${install_root}/env_build.sh
+sed -e 's%setenv ENV_FOR_LAUNCH 1%setenv ENV_FOR_LAUNCH 0%' ${install_work}/_${CSHRC} > ${install_root}/env_build.csh
+sed -e 's%export ENV_FOR_LAUNCH=1%export ENV_FOR_LAUNCH=0%' ${install_work}/_${SHRC} > ${install_root}/env_build.sh
-cp -f ${install_work}/_$CSHRC ${install_root}/env_products.csh
-cp -f ${install_work}/_$SHRC ${install_root}/env_products.sh
+cp -f ${install_work}/_${CSHRC} ${install_root}/env_products.csh
+cp -f ${install_work}/_${SHRC} ${install_root}/env_products.sh
-rm -f ${install_work}/_$SHRC ${install_work}/_$CSHRC
+rm -f ${install_work}/_${SHRC} ${install_work}/_${CSHRC}
### !!! copying build.csh and build.sh scripts
-if [ -e ./build.csh ]; then
+if [ -e ./build.csh ] && [ ! -e ${install_root}/build.csh ]; then
cp -f ./build.csh ${install_root}
fi
-if [ -e ./build.sh ]; then
+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}'`
if [ "${pdf}" = "pdf" ]; then
- export RN=$p
+ export RN=${p}
if [ ! -e ${install_root}/${RN} ]; then
cp -f ../${RN} ${install_root}
fi
if [ -f ${env_file} ] ; then
cp -f ${env_file} ${install_work}/_env_${product_type}.sh
make_env ${install_root} ${install_work} "${product_sequence}" "${installed_products}"
- source ${install_work}/$SHRC
+ source ${install_work}/${SHRC}
check_version
if [ $? -eq 0 ] ; then
return 0
#check existance of lib passed as first parameter
#return 0 if lib exists
#if you pass second parameter search will be done in it
-#otherwise search will be done in $LD_LIBRARY_PATH
+#otherwise search will be done in ${LD_LIBRARY_PATH}
#you should use : as dilimeter if you are going to pass second parameter
check_lib_version(){
if [ -n "$2" ]; then
whereIs=$2
else
- whereIs=$LD_LIBRARY_PATH
+ whereIs=${LD_LIBRARY_PATH}
fi
-for L in `echo ${whereIs} | sed -e"s%:% %g"` ; do
- ret=`find $L -name $1 2>/dev/null`
- if [ -n "$ret" ] ; then
- #echo "The $1 exists on yours system in a $L folder"
+for d in `echo ${whereIs} | sed -e"s%:% %g"` ; do
+ ret=`find ${d} -name $1 2>/dev/null`
+ if [ -n "${ret}" ] ; then
+ #echo "The $1 exists on yours system in a ${d} folder"
return 0
fi
done
file=$1; shift;
path=$*
for i in `echo ${path} | sed -e"s%:% %g"` ; do
- ret=`find $i -name $file -maxdepth 1 2>/dev/null`
- if [ -n "$ret" ] ; then
- ret=`echo $ret | sed -e"s%/\$file$%%g"`
- echo $ret
+ ret=`find ${i} -name ${file} -maxdepth 1 2>/dev/null`
+ if [ -n "${ret}" ] ; then
+ ret=`echo ${ret} | sed -e"s%/\${file}$%%g"`
+ echo ${ret}
return 0
fi
done
sort_path(){
arg1=$1; val1=$2; arg2=$3; val2=$4
-tmp="^$val1$|^$val1:|:$val1$|:$val1:"
-#echo $val2 | grep -E "$tmp" >/dev/null 2>&1
+tmp="^${val1}$|^${val1}:|:${val1}$|:${val1}:"
+#echo ${val2} | grep -E "${tmp}" >/dev/null 2>&1
#if [ $? -eq 0 ] ; then
-# echo "$arg2"
+# echo "${arg2}"
# return
#fi
to_tail=1
exclude_list="usr lib bin sbin etc"
for i in ${exclude_list} ; do
- tmp="^/$i/|^/$i\$"
- echo ${val1} | grep -E "$tmp" >/dev/null 2>&1
- if [ $? == 0 ] ; then to_tail=0; break; fi
+ tmp="^/${i}/|^/${i}\$"
+ echo ${val1} | grep -E "${tmp}" >/dev/null 2>&1
+ if [ "$?" = "0" ] ; then to_tail=0; break; fi
done
-if [ $to_tail -eq 0 ] ; then
- echo $arg2:$arg1
+if [ ${to_tail} -eq 0 ] ; then
+ echo ${arg2}:${arg1}
else
- echo $arg1:$arg2
+ echo ${arg1}:${arg2}
fi
-return $to_tail
+return ${to_tail}
}
where_gcc(){
maj_ver=`echo $1 | awk -F. '{if(NF>0) print $1; else print 0}'`
min_ver=`echo $1 | awk -F. '{if(NF>1) print $2; else print 0}'`
rel_ver=`echo $1 | awk -F. '{if(NF>2) print $3; else print 0}'`
-let ver=$maj_ver*10000+$min_ver*100+$rel_ver
+let ver=${maj_ver}*10000+${min_ver}*100+${rel_ver}
newer=""
newerver=0
for i in `echo ${PATH}:/usr/bin:/usr/local/bin | sed -e"s%:% %g"` ; do
- ret=`find $i -name gcc -maxdepth 1 2>/dev/null`
- if [ -n "$ret" ] ; then
- maj_ver=`$ret -dumpversion | awk -F. '{if(NF>0) print $1; else print 0}'`
- min_ver=`$ret -dumpversion | awk -F. '{if(NF>1) print $2; else print 0}'`
- rel_ver=`$ret -dumpversion | awk -F. '{if(NF>2) print $3; else print 0}'`
- let ver1=$maj_ver*10000+$min_ver*100+$rel_ver
- if [ $ver1 -eq $ver ] ; then
- ret=`echo $ret | sed -e"s%/gcc$%%g"`
- echo $ret
+ ret=`find ${i} -name gcc -maxdepth 1 2>/dev/null`
+ if [ -n "${ret}" ] ; then
+ maj_ver=`${ret} -dumpversion | awk -F. '{if(NF>0) print $1; else print 0}'`
+ min_ver=`${ret} -dumpversion | awk -F. '{if(NF>1) print $2; else print 0}'`
+ rel_ver=`${ret} -dumpversion | awk -F. '{if(NF>2) print $3; else print 0}'`
+ let ver1=${maj_ver}*10000+${min_ver}*100+${rel_ver}
+ if [ ${ver1} -eq ${ver} ] ; then
+ ret=`echo ${ret} | sed -e"s%/gcc$%%g"`
+ echo ${ret}
return 0
fi
- if [ $ver1 -gt $ver ] && [ $ver1 -gt $newerver ] ; then
- let newerver=$ver1
- newer=`echo $ret | sed -e"s%/gcc$%%g"`
+ if [ ${ver1} -gt ${ver} ] && [ ${ver1} -gt ${newerver} ] ; then
+ let newerver=${ver1}
+ newer=`echo ${ret} | sed -e"s%/gcc$%%g"`
fi
fi
done
-if [ -n "$newer" ] ; then
- echo $newer
+if [ -n "${newer}" ] ; then
+ echo ${newer}
return 0
fi
return 1
tclcfg=`find ${TCLHOME}/lib -name "tclConfig.sh" 2> /dev/null`
file=""
maxver=0
-for f in $tclcfg; do
- ver=`cat $f | grep -e "TCL_VERSION=.*" | sed -e "s%TCL_VERSION=[\'|\"]\(.*\)[\'|\"]%\1%g" | awk -F. '{x=0;for(i=1;i<=3;i++){x=x*100;if(i<=NF)x+=$i;}print x;}'`
- if [ $maxver -lt $ver ]; then
- maxver=$ver
- file=$f
+for f in ${tclcfg} ; do
+ ver=`cat ${f} | grep -e "TCL_VERSION=.*" | sed -e "s%TCL_VERSION=[\'|\"]\(.*\)[\'|\"]%\1%g" | awk -F. '{x=0;for(i=1;i<=3;i++){x=x*100;if(i<=NF)x+=$i;}print x;}'`
+ if [ ${maxver} -lt ${ver} ]; then
+ maxver=${ver}
+ file=${f}
fi
done
-if test -n "$file"; then
- echo `dirname $file`
+if test -n "${file}"; then
+ echo `dirname ${file}`
return 0
else
echo ""
tclcfg=`find ${TCLHOME}/lib -name "tkConfig.sh" 2> /dev/null`
file=""
maxver=0
-for f in $tclcfg; do
- ver=`cat $f | grep -e "TK_VERSION=.*" | sed -e "s%TK_VERSION=[\'|\"]\(.*\)[\'|\"]%\1%g" | awk -F. '{x=0;for(i=1;i<=3;i++){x=x*100;if(i<=NF)x+=$i;}print x;}'`
- if [ $maxver -lt $ver ]; then
- maxver=$ver
- file=$f
+for f in ${tclcfg} ; do
+ ver=`cat ${f} | grep -e "TK_VERSION=.*" | sed -e "s%TK_VERSION=[\'|\"]\(.*\)[\'|\"]%\1%g" | awk -F. '{x=0;for(i=1;i<=3;i++){x=x*100;if(i<=NF)x+=$i;}print x;}'`
+ if [ ${maxver} -lt ${ver} ]; then
+ maxver=${ver}
+ file=${f}
fi
done
-if test -n "$file"; then
- echo `dirname $file`
+if test -n "${file}"; then
+ echo `dirname ${file}`
return 0
else
echo ""
where_gl_includes(){
for d in /usr/X11R6/include /usr/include ; do
if [ -d ${d}/GL ] && [ -f ${d}/GL/gl.h ] ; then
- echo "$d"
+ echo "${d}"
return 0
fi
done
}
where_gl_libs(){
+local d
+local libdir
# search libGL.so* file and correct libGL.la in the same directory
for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
if [ "`ls ${d}/libGL.so* 2>/dev/null`" ] && [ -f ${d}/libGL.la ]; then
libdir=`grep "libdir=" ${d}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%" -e "s%/*$%%g"`
- if [ "$libdir" == "$d" ] ; then
- echo "$d"
+ if [ "${libdir}" = "${d}" ] ; then
+ echo "${d}"
return 0
fi
fi
for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
if [ -f ${d}/libGL.la ] ; then
libdir=`grep "libdir=" ${d}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"`
- if [ "`ls $libdir/libGL.so* 2>/dev/null`" ] ; then
- echo "$d"
+ if [ "`ls ${libdir}/libGL.so* 2>/dev/null`" ] ; then
+ echo "${d}"
return 0
fi
fi
# then search libGL.so* file
for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
if [ "`ls ${d}/libGL.so* 2>/dev/null`" ] ; then
- echo "$d"
+ echo "${d}"
return 0
fi
done
return 1
}
+fix_gl_libs(){
+ local gllibdir="`where_gl_libs`"
+ if [ "${gllibdir}" != "" ] ; then
+#VSR: 02/04/2013 - next block is commented as it seems to be wrong :( libGL.la should not be ever mentioned
+# if [ -f ${gllibdir}/libGL.la ] ; then
+# libdir=`grep "libdir=" ${gllibdir}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"`
+# if [ "`ls ${libdir}/libGL.so* 2>/dev/null`" ] ; then
+# str_to_replace="${gllibdir}/libGL.la"
+# fi
+# fi
+ if [ "${str_to_replace}" = "" ] ; then
+ str_to_replace="-L${gllibdir} -lGL"
+ fi
+
+ la_files=`find . -name "*.la"`
+ for la_file in ${la_files} XXX ; do
+ if [ "${la_file}" = "XXX" ] ; then continue; fi
+ grep -e "libGL.la" ${la_file} >& /dev/null || grep -e "-lGL\b" ${la_file} >& /dev/null && \
+ sed -e "s%-lGL\b%%g" \
+ -e "s%[^[:space:]']*libGL.la[[:space:]]%%g" \
+ -e "s%^dependency_libs='\(.*\)%dependency_libs='${str_to_replace} \1%" \
+ ${la_file} > ${la_file}.new && \
+ mv -f ${la_file}.new ${la_file}
+ done
+ fi
+}
+
modif_la_files(){
+return 0
+# obsolete
ldir=$1
-if [ -z "$ldir" ] || [ ! -d "$ldir" ]; then return 1; fi
+if [ -z "${ldir}" ] || [ ! -d "${ldir}" ]; then return 1; fi
srcdir=`pwd`
-#SALOME_MODULES="`env | awk -F_ '/[[:alnum:]]*_ROOT_DIR/ { print $1 }'`"
SALOME_MODULES="`env | awk -F_ '/[a-zA-Z0-9]*_ROOT_DIR/ { print $1 }'`"
-cd $ldir
+cd ${ldir}
ldir=`pwd`
la_files=`find . -name "*.la"`
+# netgen dir
+netgendir=${NETGEN_ROOT_DIR}
+# freetype dir
+freetypedir=${FREETYPE_ROOT_DIR}
+# ftgl dir
+ftgldir=${FTGL_ROOT_DIR}
+# gl2ps dir
+gl2psdir=${GL2PS_ROOT_DIR}
+# freeimage dir
+freeimagedir=${FREEIMAGE_ROOT_DIR}
+# tbb dir
+tbbbasedir=${TBB_ROOT_DIR}
+TBBKERNEL='cc4.1.0_libc2.4_kernel2.6.16.21'
+if test `uname -m` = "x86_64" ; then
+ export TBBMODE="intel64/${TBBKERNEL}"
+else
+ export TBBMODE="ia32/${TBBKERNEL}"
+fi
+tbbdir=${tbbbasedir}/lib/${TBBMODE}
+# cgns dir
+cgnslibdir=${CGNS_ROOT_DIR}
+# occt dir
+casdir=${CAS_ROOT_DIR}/lib
+if [ ! -d ${casdir} ] ; then casdir=${CAS_ROOT_DIR}/Linux/lib ; fi
+if [ ! -d ${casdir} ] ; then casdir=${CAS_ROOT_DIR}/lin/lib ; fi
+# omniorb dir
+omnidir=${OMNIORB_ROOT_DIR}/lib
+# vtk dir
+vtkpath=${VTK_DIR}
+if [ `uname -m` = "x86_64" ] && [ -d ${vtkpath}/lib64 ] ; then
+ LIB_PREFIX=64
+elif [ -d ${vtkpath}/lib ] ; then
+ LIB_PREFIX=""
+else
+ LIB_PREFIX=64
+fi
+vtkldir=${vtkpath}/lib${LIB_PREFIX}
+vtkdir=${vtkldir}/vtk-5.0
+# hdf dir
+hdfdir=${HDF5_ROOT_DIR}/lib
+# med dir
+meddir=${MEDFILE_ROOT_DIR}/lib
+# qwt dir
+qwtdir=`find_in_path libqwt.so ${LD_LIBRARY_PATH}`
+# python dir
+where_python=`which python` # e.g. /usr/bin/python
+if [ -n "${where_python}" ] ; then
+ where_python=`dirname ${where_python}` # --> /usr/bin
+ where_python=`dirname ${where_python}` # --> /usr
+ python_version=`python -c "import sys; print sys.version[:3]"`
+ pythondir=${where_python}/lib/python${python_version}
+fi
+# sip dir
+sipdir=`find_in_path sip.so ${LD_LIBRARY_PATH}`
+# pyqt dir
+pyqtdir=`find_in_path Qt.so ${LD_LIBRARY_PATH}`
+# tcl/tk dir
+tcldir=${TCLHOME}/lib
+# boost dir
+boostdir=${BOOST_ROOT_DIR}/lib
+# blsurf dir
+blsurfdir=${BLSURFHOME}/lib
+# libxml2 dir
+libxmldir=${LIBXML2_ROOT_DIR}/lib
+# metis dir
+metisdir=${METIS_ROOT_DIR}
+# scotch dir
+scotchbindir=${SCOTCH_ROOT_DIR}/bin
+scotchlibdir=${SCOTCH_ROOT_DIR}/lib
+# gl dir
+if test `uname -m` = "x86_64" ; then
+ libGLpath=/usr/lib64/libGL.la
+else
+ libGLpath=/usr/lib/libGL.la
+fi
+# graphviz dir
+graphvizdir=${GRAPHVIZ_ROOT_DIR}/lib
+# qscintilla dir
+qscintilladir=${QSCINTILLA_ROOT_DIR}/lib
+# expat dir
+expatdir=${EXPAT_ROOT_DIR}/lib
+# paraview dir
+paraviewdir=${PARAVIEW_ROOT_DIR}/lib
+# qt dir
+qtdir=${QT4_ROOT_DIR}/lib
+# distene meshgems dir
+if test `uname -m` = "x86_64" ; then
+ mgemsdir=${MESHGEMS_ROOT_DIR}/lib/Linux_64
+else
+ mgemsdir=${MESHGEMS_ROOT_DIR}/lib/Linux
+fi
+
for l in X ${la_files}; do
-if [ "$l" != "X" ] ; then
- d=`dirname $l`
- l=`basename $l`
- cd $ldir; cd $d
- # 1. process salome modules dependencies
-
- for mod in $SALOME_MODULES; do
- moddir=`printenv ${mod}_ROOT_DIR`
+
+if [ "${l}" != "X" ] ; then
+ d=`dirname ${l}`
+ l=`basename ${l}`
+ cd ${ldir}; cd ${d}
+
+ # . process salome modules dependencies
+ for mod in ${SALOME_MODULES} ; do
+ moddir=${mod}_ROOT_DIR
+ moddir=${!moddir}
if [ -n "${moddir}" ] ; then
- #echo $l $mod $moddir
-# sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[^[:space:]/]*/\(lib\|lib64\)% \1${moddir}/${myldir}%g" $l > $l"_"
-# sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[^[:space:]/]*/lib% \1${moddir}/lib%g" $l > $l"_"
- sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[^[:space:]/]*/lib% \1${moddir}/lib%g" \
- -e "s%^libdir='[^[:space:]]*${mod}[^[:space:]]*/\(lib.*\)'%libdir='${moddir}/\1'%g" $l > $l"_"
- mv -f $l"_" $l
- for mod1 in $SALOME_MODULES; do
- sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod1}[^[:space:]]*/${mod1}_build%%g" $l > $l"_"
- mv -f $l"_" $l
- done
+ sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[1]\?/lib% \1${moddir}/lib%g" \
+ -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}WOGUI[1]\?/lib% \1${moddir}/lib%g" \
+ -e "s%^libdir='[^[:space:]]*${mod}[1]\?/\(lib.*\)'%libdir='${moddir}/\1'%g" \
+ -e "s%^libdir='[^[:space:]]*${mod}WOGUI[1]\?/\(lib.*\)'%libdir='${moddir}/\1'%g" ${l} > ${l}"_"
+ mv -f ${l}"_" ${l}
fi
done
- # 2. process CAS.CADE dependencies
- casdir=`printenv CASROOT`/lib
- if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/Linux/lib ; fi
- if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/lin/lib ; fi
- if [ -n "${CASROOT}" ] && [ -d "${casdir}" ] ; then
- # echo $l $CASROOT $casdir
- sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/Linux/lib% \1${casdir}%g" \
- -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/lin/lib% \1${casdir}%g" \
- -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/lib% \1${casdir}%g" $l > $l"_"
- mv -f $l"_" $l
- fi
- # 3. process omniORB dependencies
- omnidir=`printenv OMNIORBDIR`/lib/i586_linux_2.0_glibc2.1
- if [ ! -d ${omnidir} ] ; then omnidir=`printenv OMNIORBDIR`/lib ; fi
- if [ -n "${OMNIORBDIR}" ] && [ -d "${omnidir}" ] ; then
- # echo $l $OMNIORBDIR $omnidir
- sed -e "s%-L[^[:space:]]*omni[^[:space:]]*%-L${omnidir}%g" \
- -e "s%-R[^[:space:]]*omni[^[:space:]]*%-R${omnidir}%g" $l > $l"_"
- mv -f $l"_" $l
- fi
- # 4. process VTK dependencies
- vtkpath=`printenv VTKHOME`
- if [ `uname -m` = "x86_64" ] && [ -d ${vtkpath}/lib64 ] ; then
- LIB_PREFIX=64
- elif [ -d ${vtkpath}/lib ] ; then
- LIB_PREFIX=""
- else
- LIB_PREFIX=64
- fi
- vtkldir=${vtkpath}/lib${LIB_PREFIX}
- vtkdir=${vtkldir}/vtk-5.0
- if [ -n "${VTKHOME}" ] && [ -d "${vtkdir}" ] && [ -d "${vtkldir}" ] ; then
- # echo $l $VTKHOME $vtkdir
- sed -e "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)/vtk\-5\.0%-L${vtkdir}%g" \
- -e "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)%-L${vtkldir}%g" $l > $l"_"
- mv -f $l"_" $l
- fi
- # 5. process HDF dependencies
- hdfdir=`printenv HDF5HOME`/lib
- if [ -n "${HDF5HOME}" ] && [ -d "${hdfdir}" ] ; then
- # echo $l $HDF5HOME $hdfdir
- sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*hdf[^[:space:]/]*/lib% \1${hdfdir}%g" $l > $l"_"
- mv -f $l"_" $l
- fi
- # 6. process MED dependencies
- meddir=`printenv MED2HOME`/lib
- if [ -n "${MED2HOME}" ] && [ -d "${meddir}" ] ; then
- # echo $l $MED2HOME $meddir
- sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*med[^[:space:]/]*/lib% \1${meddir}%g" $l > $l"_"
- mv -f $l"_" $l
- fi
- # 7. process qwt dependencies
- qwtdir=`find_in_path libqwt.so ${LD_LIBRARY_PATH}`
+ # . process netgen dependencies
+ if [ -n "${netgendir}" ] && [ -d "${netgendir}" ] ; then
+ sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*netgen-[0-9.]\+/lib% \1${netgendir}/lib%g" ${l}
+ fi
+
+ # . process freetype dependencies
+ if [ -n "${freetypedir}" ] && [ -d "${freetypedir}" ] ; then
+ sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*freetype-[0-9.]\+/lib% \1${freetypedir}/lib%g" ${l}
+ fi
+
+ # . process ftgl dependencies
+ if [ -n "${ftgldir}" ] && [ -d "${ftgldir}" ] ; then
+ sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*ftgl-[0-9.]\+/lib% \1${ftgldir}/lib%g" ${l}
+ fi
+
+ # . process gl2ps dependencies
+ if [ -n "${gl2psdir}" ] && [ -d "${gl2psdir}" ] ; then
+ sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*gl2ps-[0-9.]\+/lib% \1${gl2psdir}/lib%g" ${l}
+ fi
+
+ # . process freeimage dependencies
+ if [ -n "${freeimagedir}" ] && [ -d "${freeimagedir}" ] ; then
+ sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*freeimage-[0-9.]\+/lib% \1${freeimagedir}/lib%g" ${l}
+ fi
+
+ # . process tbb dependencies
+ if [ -n "${tbbdir}" ] && [ -d "${tbbdir}" ] ; then
+ sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*tbb[^[:space:]]*/lib[^[:space:]]*% \1${tbbdir}%g" ${l}
+ fi
+
+ # . process cgns dependencies
+ if [ -n "${cgnslibdir}" ] && [ -d "${cgnslibdir}" ] ; then
+ sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*cgnslib-[0-9.]\+/lib% \1${cgnslibdir}/lib%g" ${l}
+ fi
+
+ # . process CAS.CADE dependencies
+ if [ -n "${CAS_ROOT_DIR}" ] && [ -d "${casdir}" ] ; then
+ sed -e "s%-L[^[:space:]]*OCCT[^[:space:]]*/install/lib%-L${casdir}%g" \
+ -e "s%[^[:space:]]*OCCT[^[:space:]]*/install/lib/%${casdir}/%g" \
+ -e "s%[[:space:]]-L[^[:space:]]*\(OCCT\|CAS\)[^[:space:]]*/lib\?% -L${CAS_ROOT_DIR}/lib%g" \
+ -e "s%[[:space:]][^[:space:]]*\(OCCT\|CAS\)[^[:space:]]*/lib/lib\?% ${CAS_ROOT_DIR}/lib/lib%g" ${l} > ${l}"_"
+ mv -f ${l}"_" ${l}
+ fi
+
+ # . process omniORB dependencies
+ if [ -n "${OMNIORB_ROOT_DIR}" ] && [ -d "${omnidir}" ] ; then
+ sed -i "s%-L[^[:space:]]*omni[^[:space:]]*%-L${omnidir}%g;s%-R[^[:space:]]*omni[^[:space:]]*%-R${omnidir}%g" ${l}
+ fi
+
+ # . process VTK dependencies
+ if [ -n "${VTK_DIR}" ] && [ -d "${vtkdir}" ] && [ -d "${vtkldir}" ] ; then
+ sed -i "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)/vtk\-5\.0%-L${vtkdir}%g;s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)%-L${vtkldir}%g" ${l}
+ fi
+
+ # . process HDF dependencies
+ if [ -n "${HDF5_ROOT_DIR}" ] && [ -d "${hdfdir}" ] ; then
+ sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*hdf[^[:space:]/]*/lib% \1${hdfdir}%g" ${l}
+ fi
+
+ # . process MED dependencies
+ if [ -n "${MEDFILE_ROOT_DIR}" ] && [ -d "${meddir}" ] ; then
+ sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*med[^[:space:]/]*/lib% \1${meddir}%g" ${l}
+ fi
+
+ # . process qwt dependencies
if [ -n "${qwtdir}" ] && [ -d "${qwtdir}" ] ; then
- # echo $l $qwtdir
- sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*qwt[^[:space:]/]*/lib% \1${qwtdir}%g" $l > $l"_"
- mv -f $l"_" $l
- fi
- # 8. process qt dependencies
- qtdir=`printenv QTDIR`/lib
- if [ -n "${QTDIR}" ] && [ -d "${qtdir}" ] ; then
- # echo $l $QTDIR $qtdir
- sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*qt[^[:space:]/]*/lib% \1${qtdir}%g" $l > $l"_"
-# sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*qt[^[:space:]/]*/\(lib\|lib64\)% \1${qtdir}%g" $l > $l"_"
- mv -f $l"_" $l
- fi
- # 9. process python dependencies
- where_python=`which python` # e.g. /usr/bin/python
- if [ -n "$where_python" ] ; then
- where_python=`dirname $where_python` # --> /usr/bin
- where_python=`dirname $where_python` # --> /usr
- python_version=`python -c "import sys; print sys.version[:3]"`
- # echo $l $where_python $python_version
- sed -e "s%-L[^[:space:]]*python[0-9]\.[0-9]\([^[:space:]]*\)%-L${where_python}/lib/python${python_version}\1%g" $l > $l"_"
- mv -f $l"_" $l
- fi
- # 10. process sip dependencies
- sipdir=`find_in_path sip.so ${LD_LIBRARY_PATH}`
+ sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*qwt[^[:space:]/]*/lib% \1${qwtdir}%g" ${l}
+ fi
+
+ # . process qt dependencies
+ if [ -n "${QT4_ROOT_DIR}" ] && [ -d "${qtdir}" ] ; then
+ sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*qt[^[:space:]/]*/lib% \1${qtdir}%g" ${l}
+ fi
+
+ # . process python dependencies
+ if [ -n "${pythondir}" ] && [ -d "${pythondir}" ] ; then
+ sed -i "s%-L[^[:space:]]*python[0-9]\.[0-9]\([^[:space:]]*\)%-L${pythondir}\1%g" ${l}
+ fi
+
+ # . process sip dependencies
if [ -n "${sipdir}" ] && [ -d "${sipdir}" ] ; then
- # echo $l $sipdir
- sed -e "s%-L[^[:space:]]*sip[^[:space:]]*%-L${sipdir}%g" $l > $l"_"
- mv -f $l"_" $l
+ sed -i "s%-L[^[:space:]]*sip[^[:space:]]*%-L${sipdir}%g" ${l}
fi
- # 11. process PyQt dependencies
- pyqtdir=`find_in_path Qt.so ${LD_LIBRARY_PATH}`
+
+ # . process PyQt dependencies
if [ -n "${pyqtdir}" ] && [ -d "${pyqtdir}" ] ; then
- # echo $l $pyqtdir
- sed -e "s%-L[^[:space:]]*PyQt[^[:space:]]*%-L${pyqtdir}%g" $l > $l"_"
- mv -f $l"_" $l
+ sed -i "s%-L[^[:space:]]*PyQt[^[:space:]]*%-L${pyqtdir}%g" ${l}
fi
- # 12. process tcl/tk dependencies
- tcldir=`printenv TCLHOME`/lib
+
+ # . process tcl/tk dependencies
if [ -n "${tcldir}" ] && [ -d "${tcldir}" ] ; then
- # echo $l $TCLHOME $tcldir
- sed -e "s%-L[^[:space:]]*tcltk[^[:space:]]*/lib%-L${tcldir}%g" $l > $l"_"
- mv -f $l"_" $l
+ sed -i "s%-L[^[:space:]]*tcltk[^[:space:]]*/lib%-L${tcldir}%g" ${l}
fi
- # 13. process boost dependencies
- boostdir=`printenv BOOSTDIR`/lib
+
+ # . process boost dependencies
if [ -n "${boostdir}" ] && [ -d "${boostdir}" ] ; then
- # echo $l $BOOSTDIR $boostdir
- sed -e "s%-L[^[:space:]]*boost[^[:space:]]*/lib%-L${boostdir}%g" $l > $l"_"
- mv -f $l"_" $l
+ sed -i "s%-L[^[:space:]]*boost[^[:space:]]*/lib%-L${boostdir}%g" ${l}
fi
- blsurfdir=`printenv BLSURFHOME`/lib
+ # . process blsurf dependencies
if [ -n "${blsurfdir}" ] && [ -d "${blsurfdir}" ] ; then
- # echo $l $BOOSTDIR $boostdir
- sed -e "s%-L[^[:space:]]*blsurf[^[:space:]]*/lib%-L${blsurfdir}%g" $l > $l"_"
- mv -f $l"_" $l
- fi
-
-# # 14. modify libdir
-# #sed -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib/salome'%g" $l > $l"_"
-# mod=`basename $ldir | awk -F_ '{print $1}'`
-# moddir=`printenv ${mod}_ROOT_DIR`
-# sed -e "s%^libdir='[^[:space:]]*${mod}[^[:space:]]*/\(lib.*\)'%libdir='${moddir}/\1'%g" $l > $l"_"
-# mv -f $l"_" $l
-
- # 15. process libxml dependencies
- libxmldir=`printenv LIBXML_DIR`/lib
- if [ ! -d ${libxmldir} ] ; then libxmldir=`printenv LIBXML_DIR`/lib ; fi
- sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*libxml2-[0-9]\.[0-9]\.[0-9][0-9]/lib% \1${libxmldir}%g" $l > $l"_"
- mv -f $l"_" $l
-
- # 16. process metis dependencies
- metisdir=`printenv METISDIR`
- if [ ! -d ${metisdir} ] ; then metisdir=`printenv METISDIR` ; fi
- sed -e "s%-L[^[:space:]]*metis[^[:space:]]*%-L${metisdir}%g" $l > $l"_"
- mv -f $l"_" $l
-
- # 17. process scotch dependencies
- scotchdir=`printenv SCOTCHDIR`/bin
- if [ ! -d ${scotchdir} ] ; then scotchdir=`printenv SCOTCHDIR`/bin ; fi
- sed -e "s%-L[^[:space:]]*scotch[^[:space:]]*/bin%-L${scotchdir}%g" $l > $l"_"
- mv -f $l"_" $l
-
- # 18. process libGL.la dependencies
- if test `uname -m` = "x86_64" ; then
- libGLpath=/usr/lib64/libGL.la
- else
- libGLpath=/usr/lib/libGL.la
+ sed -i "s%-L[^[:space:]]*BLSurf[^[:space:]]*/lib%-L${blsurfdir}%g" ${l}
+ fi
+
+ # . process libxml dependencies
+ if [ -n "${libxmldir}" ] && [ -d "${libxmldir}" ] ; then
+ sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*libxml2-[0-9]\.[0-9]\.[0-9]/lib% \1${libxmldir}%g;s%[[:space:]]\(-L\)\?[^[:space:]]*libxml2/lib% \1${libxmldir}%g" ${l}
fi
- sed -e "s%$libGLpath%""%g" $l > $l"_"
- mv -f $l"_" $l
- # 19. process graphviz dependencies
- graphvizdir=`printenv GRAPHVIZHOME`/lib
- if [ ! -d ${graphvizdir} ] ; then graphvizdir=`printenv GRAPHVIZHOME`/lib ; fi
- sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*graphviz-[0-9]\.[0-9]\+\.[0-9]/lib% \1${graphvizdir}%g" $l > $l"_"
- chmod -f --reference=$l $l"_"
- mv -f $l"_" $l
+ # . process metis dependencies
+ if [ -n "${metisdir}" ] && [ -d "${metisdir}" ] ; then
+ sed -i "s%-L[^[:space:]]*metis[^[:space:]]*%-L${metisdir}%g" ${l}
+ fi
+
+ # . process scotch dependencies
+ if [ -n "${scotchbindir}" ] && [ -d "${scotchbindir}" ] ; then
+ sed -i "s%-L[^[:space:]]*scotch[^[:space:]]*/bin%-L${scotchbindir}%g" ${l}
+ fi
+ if [ -n "${scotchlibdir}" ] && [ -d "${scotchlibdir}" ] ; then
+ sed -i "s%-L[^[:space:]]*scotch[^[:space:]]*/lib%-L${scotchlibdir}%g" ${l}
+ fi
+
+ # . process libGL.la dependencies
+ sed -i "s%${libGLpath}%""%g" ${l}
+
+ # . process graphviz dependencies
+ if [ -n "${graphvizdir}" ] && [ -d "${graphvizdir}" ] ; then
+ sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*graphviz-[0-9]\.[0-9]\+\.[0-9]/lib% \1${graphvizdir}%g;s%[[:space:]]\(-L\)\?[^[:space:]]*graphviz/lib% \1${graphvizdir}%g" ${l}
+ fi
+
+ # . process QScintilla dependencies
+ if [ -n "${qscintilladir}" ] && [ -d "${qscintilladir}" ] ; then
+ sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*QScintilla-[0-9]\.[0-9]\(\.[0-9]\)\?/lib% \1${qscintilladir}%g" ${l}
+ fi
+
+ # . process expat-2.0.1 dependencies
+ if [ -n "${expatdir}" ] && [ -d "${expatdir}" ] ; then
+ sed -i "s%-L[^[:space:]]*expat[^[:space:]]*/lib%-L${expatdir}%g;s%[^[:space:]]*expat[^[:space:]]*/lib/libexpat.la%-lexpat%g" ${l}
+ fi
+
+ # . process ParaView dependencies
+ if [ -n "${paraviewdir}" ] && [ -d "${paraviewdir}" ] ; then
+ sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*ParaView-[0-9]\.[0-9]\+\.[0-9]/lib% \1${paraviewdir}%g" ${l}
+ fi
+
+ # . process DISTENE MeshGems dependencies
+ if [ -n "${mgemsdir}" ] && [ -d "${mgemsdir}" ] ; then
+ sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*MeshGems-[0-9.]\+/Products/lib/Linux\(_64\)\?% \1${mgemsdir}%g" ${l}
+ fi
fi
done
-cd $srcdir
+cd ${srcdir}
return 0
}
+
+modif_cfg_file(){
+ local nf=$1
+ if [ "${nf}" = "" ] || [ ! -e ${nf} ] ; then
+ return
+ fi
+ if [ "${PYTHON_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/Python-[0-9.]\+%\1${PYTHON_ROOT_DIR}%g" $1
+ fi
+ if [ "${SWIG_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/swig-[0-9.]\+%\1${SWIG_ROOT_DIR}%g" $1
+ fi
+ if [ "${OMNIORB_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/omniORB-[0-9.]\+%\1${OMNIORB_ROOT_DIR}%g" $1
+ fi
+ if [ "${HDF5_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/hdf5-[0-9.]\+%\1${HDF5_ROOT_DIR}%g" $1
+ fi
+ if [ "${BOOST_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/boost-[0-9.]\+%\1${BOOST_ROOT_DIR}%g" $1
+ fi
+ if [ "${MEDFILE_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/med-[0-9.]\+%\1${MEDFILE_ROOT_DIR}%g" $1
+ fi
+ if [ "${QT4_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/qt-[0-9.]\+%\1${QT4_ROOT_DIR}%g" $1
+ fi
+ if [ "${QWT_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/qwt-[0-9.]\+%\1${QWT_ROOT_DIR}%g" $1
+ fi
+ if [ "${SIP_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/sip-[0-9.]\+%\1${SIP_ROOT_DIR}%g" $1
+ fi
+ if [ "${PYQT4_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/PyQt-[0-9.]\+%\1${PYQT4_ROOT_DIR}%g" $1
+ fi
+ if [ "${QSCINTILLA_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/QScintilla-[0-9.]\+%\1${QSCINTILLA_ROOT_DIR}%g" $1
+ fi
+ if [ "${PARAVIEW_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/ParaView-[0-9.]\+%\1${PARAVIEW_ROOT_DIR}%g" $1
+ fi
+ if [ "${LIBXML2_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/libxml2-[0-9.]\+%\1${LIBXML2_ROOT_DIR}%g" $1
+ fi
+ if [ "${EXPAT_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/expat-[0-9.]\+%\1${EXPAT_ROOT_DIR}%g" $1
+ fi
+ if [ "${FREETYPE_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/freetype-[0-9.]\+%\1${FREETYPE_ROOT_DIR}%g" $1
+ fi
+ if [ "${FREEIMAGE_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/freeimage-[0-9.]\+%\1${FREEIMAGE_ROOT_DIR}%g" $1
+ fi
+ if [ "${GL2PS_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/gl2ps-[0-9.]\+%\1${GL2PS_ROOT_DIR}%g" $1
+ fi
+ if [ "${TBB_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/tbb[^/]\+%\1${TBB_ROOT_DIR}%g" $1
+ fi
+ if [ "${CAS_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/OCCT[^/]*%\1${CAS_ROOT_DIR}%g" $1
+ fi
+ if [ "${NETGEN_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/netgen-[0-9.]\+%\1${NETGEN_ROOT_DIR}%g" $1
+ fi
+ if [ "${CGNS_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/cgnslib-[0-9.]\+%\1${CGNS_ROOT_DIR}%g" $1
+ fi
+ if [ "${NUMPY_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/numpy-[0-9.]\+%\1${NUMPY_ROOT_DIR}%g" $1
+ fi
+ if [ "${GRAPHVIZ_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/graphviz-[0-9.]\+%\1${GRAPHVIZ_ROOT_DIR}%g" $1
+ fi
+ if [ "${DOXYGEN_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/doxygen-[0-9.]\+%\1${DOXYGEN_ROOT_DIR}%g" $1
+ fi
+ if [ "${SPHINX_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/Sphinx-[0-9.]\+%\1${SPHINX_ROOT_DIR}%g" $1
+ fi
+ if [ "${WSO2_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/wso2-wsf-cpp-[0-9.]\+%\1${WSO2_ROOT_DIR}%g" $1
+ fi
+ if [ "$MESHGEMS{_ROOT_DIR}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/MeshGems-[0-9.]\+%\1${MESHGEMS_ROOT_DIR}%g" $1
+ fi
+ local sm
+ local smvar
+ for sm in LIBBATCH SIMANIO KERNEL GUI GEOM MED SMESH PARAVIS YACS HEXABLOCK HOMARD JOBMANAGER \
+ NETGENPLUGIN BLSURFPLUGIN GHS3DPLUGIN GHS3DPRLPLUGIN HexoticPLUGIN HEXABLOCKPLUGIN \
+ CALCULATOR PYCALCULATOR COMPONENT HELLO PYHELLO LIGHT PYLIGHT ATOMIC ATOMGEN ATOMSOLV RANDOMIZER SIERPINSKY ; do
+ smvar=${sm}_ROOT_DIR
+ if [ "${!smvar}" != "" ] ; then
+ sed -i "s%\([^/]*\)[^;]*/${sm}[^/]*%\1${!smvar}%g" $1
+ fi
+ done
+}