3 ####################################################################################
5 # Created : Thu Dec 18 12:01:00 2002
6 # Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
8 # Module : Installation Wizard
9 # Copyright : 2002-2008 CEA
11 # This script is the part of the SALOME installation procedure.
13 ####################################################################################
16 export SHRC="salome.sh"
17 export CSHRC="salome.csh"
19 #####################################################
20 # !WARNING! This is current SALOME version number
21 ####################################################
22 export SALOME_VERSION="6.1.0"
23 export YACSGEN_VERSION="6.1.0"
24 export JOBMANAGER_VERSION="0.1"
26 # Name of the single directory for SALOME modules
27 export SDIR_NAME="SALOME_${SALOME_VERSION}"
29 #this function takes one parameter - path to module source folder
30 check_salome_src_version(){
31 root_dir=`printenv $1`
33 if [ -n "$root_dir" ]; then
35 if [ ! -f ${root_dir}/${cfg_file} ] ; then
36 cfg_file=configure.in.base
37 if [ ! -f ${root_dir}/${cfg_file} ] ; then
38 cfg_file=CMakeLists.txt
41 if [ -f ${root_dir}/${cfg_file} ] ; then
42 if [ "${cfg_file}" = "CMakeLists.txt" ] ; then
43 ver_maj=`cat ${root_dir}/${cfg_file} | grep SET\(VERSION_MAJOR | sed -e "s%[A-Z_() ]%%g"`
44 ver_min=`cat ${root_dir}/${cfg_file} | grep SET\(VERSION_MINOR | sed -e "s%[A-Z_() ]%%g"`
45 ver_maintenance=`cat ${root_dir}/${cfg_file} | grep SET\(VERSION_MAINTENANCE | sed -e "s%[A-Z_() ]%%g"`
46 ver="${ver_maj}.${ver_min}.${ver_maintenance}"
48 ver=`grep -e "^AC_INIT" ${root_dir}/${cfg_file} | sed -e "s%.*\[\([[:digit:].]*\)\].*%\1%g"`
51 if [ "$ver" = "${SALOME_VERSION}" ]; then
59 #this function takes several parameters
60 #first parameter contains descriptor of output file
61 #next parameters is command for execution
62 #in case of bad result of execution ask user about furher steps
63 #(user can cancel installation procedure)
69 if [ -n "$INSTALL_WORK" ] ; then errfile=$INSTALL_WORK/errlog; fi
71 if [ "$out" != "1" ] ; then cmd="$cmd >> $out" ; fi
73 if [ "$out" != "1" ] ; then
78 if [ "$?" -ne "0" ] ; then
79 if [ $out != "1" ] ; then
84 # VSR : 10/11/05: disable answer mode ==>
86 #echo -e "NOT DONE !!! => $*"
87 #echo -n "Would you like to continue to install this product: (Y,N) [Y] : "
89 #rep=`echo $rep | tr "[A-Z]" "[a-z]"`
90 #if test -z $rep || [ $rep = "y" ] ; then
93 # VSR : 10/11/05: disable answer mode <==
99 #invoke check_job function
100 #all output will be put into terminal
110 rm -rf "$1" > /dev/null
114 #create environment for sh and csh
117 install_root=$1; shift
120 for i in $SHRC $CSHRC ; do
121 if [ -e ${install_work}/$i ]; then
122 rm ${install_work}/$i
124 touch ${install_work}/$i
127 if [ $# -eq 4 ] ; then
129 product_env=${install_work}/env_${product_name}.sh
130 (test -e ${product_env} && rm ${product_env} )
132 ### !!! writing salome.sh file !!! -> define INST_ROOT
133 cat >> ${install_work}/$SHRC <<EOF
134 #${DELIM} Setting products installation directory ${DELIM}
135 export INST_ROOT=${install_root}
137 #${DELIM} Environment switch: 0 for SALOME building, 1 for SALOME launching ${DELIM}
138 export ENV_FOR_LAUNCH=1
141 ### !!! The next is for RedHat 9 only !!!
142 if [ -f /etc/redhat-release ] ; then
143 grep -e "Red Hat Linux release 9" /etc/redhat-release > /dev/null
144 if [ $? -eq 0 ] ; then
145 cat >> ${install_work}/$SHRC <<EOF
146 #${DELIM} Force RH9 to use old implementation of threads ${DELIM}
147 export LD_ASSUME_KERNEL=2.4.18
152 ### !!! writing salome.csh file !!! -> set inital variables
153 pre_vars="PATH LD_LIBRARY_PATH LD_RUN_PATH PYTHONPATH TCLLIBPATH"
154 for i in $pre_vars ; do
155 cat >> ${install_work}/$CSHRC <<EOF
156 #${DELIM} setting initial ${i} ${DELIM}
157 if (! (\$?${i}) ) then
164 ### !!! writing salome.(c)sh files !!! -> dump products environment files, changing 'export' by 'setenv(a|p)' where necessary
165 ### Note, that for performance reasons temporary environment files used during installation procedure itself
166 ### are created without using setenv(a|p) aliases.
168 # 0. add /usr/lib or /usr/lib64 dir to the LD_LIBRARY_PATH
169 #if test `uname -m` = "x86_64" ; then
170 #echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> ${install_work}/$SHRC 2>/dev/null
171 #echo '' >> ${install_work}/$SHRC 2>/dev/null
173 #echo 'export LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH}' >> ${install_work}/$SHRC 2>/dev/null
174 #echo '' >> ${install_work}/$SHRC 2>/dev/null
179 # Source of license environment file
181 echo '#------ License activation ------' >> ${install_work}/$SHRC 2>/dev/null
182 echo 'export LICENSE_FILE=/product/distene/dlim8.var.sh' >> ${install_work}/$SHRC 2>/dev/null
183 echo '' >> ${install_work}/$SHRC 2>/dev/null
184 echo 'if [ -e "${LICENSE_FILE}" ] ; then' >> ${install_work}/$SHRC 2>/dev/null
185 echo 'export SIMULOGD_LICENSE_FILE=29029@amun' >> ${install_work}/$SHRC 2>/dev/null
186 echo 'source ${LICENSE_FILE}' >> ${install_work}/$SHRC 2>/dev/null
187 echo 'fi' >> ${install_work}/$SHRC 2>/dev/null
188 echo '' >> ${install_work}/$SHRC 2>/dev/null
190 # 1. first dump all environment files into the $SHRC file
191 product_sequence="$2"
192 install_products="$3"
193 for i in $product_sequence ; do
194 env_file=${install_work}/env_${i}.sh
195 _env_file=${install_work}/_env_${i}.sh
196 if [ -e $_env_file ] ; then
197 cat $_env_file >> ${install_work}/$SHRC 2>/dev/null
198 elif [ -e $env_file ] ; then
199 echo $install_products | grep -q "\b${i}\b"
200 if [ $? -eq 1 ] ; then
201 cat $env_file | sed 's/^/## /' >> ${install_work}/$SHRC 2>/dev/null
203 cat $env_file >> ${install_work}/$SHRC 2>/dev/null
208 # 2. writing global functions to _salome.sh file
209 cat >> ${install_work}/_$SHRC <<EOF
210 ##########################################################################
211 # Functions exporta and exportp are used to append/prepend correspondingly
212 # one directory or a set of directories separated by semicolon symbol (':')
213 # to the environment variables like PATH, LD_LIBRARY_PATH, PYTHONPATH,
215 # The main purpose is to replace default setenv command behavior:
216 # exporta, exportp also remove duplicated entries, shortening in that way
217 # the environment variables.
218 # If some directory being added is already included into the variable
219 # nothing is done for it.
220 # Note, that these functions work some slower that setenv command itself.
223 # appends/prepends set of directories (second parameter)
224 # to the another set of directories (first parameter) and
225 # removes duplicated entries;
226 # the third parameter defines the mode: 0 - append, 1 - prepend
228 out_var=\`echo \$1 \$2 | awk -v dir=\$3 '{ \\
229 na = split(\$2,a,":"); \\
233 if(\$1 != "<empty>") { \\
234 nb = split(\$1,b,":"); \\
235 for(i=1;i<=nb;i++) { \\
236 if(!(b[i] in ccc) ) { \\
244 for(i=1;i<=na;i++) { \\
245 if(!(a[i] in ccc)) { \\
252 for(i=1;i<k2;i++) { \\
255 for(i=1;i<k1;i++) { \\
260 for(i=1;i<k1;i++) { \\
263 for(i=1;i<k2;i++) { \\
267 }' | sed -e 's/\(.*\):/\1/g'\`
271 # appends directory or set of directories, separated by ':' (second parameter)
272 # to the variable (first parameter)
274 xenv=\`printenv \$1\`
275 if [ -z "\$xenv" ]; then xenv="<empty>"; fi
276 out_var=\`cleandup \$xenv \$2 0\`
280 # prepends directory or set of directories, separated by ':' (second parameter)
281 # to the variable (first parameter)
283 xenv=\`printenv \$1\`
284 if [ -z "\$xenv" ]; then xenv="<empty>"; fi
285 out_var=\`cleandup \$xenv \$2 1\`
288 ###########################################################################
292 # 3. writing global functions to _salome.csh file
293 cat >> ${install_work}/_$CSHRC <<EOF
295 ###########################################################################
296 # Aliases setenva and setenvp are used to append/prepend correspondingly
297 # one directory or a set of directories separated by semicolon symbol (':')
298 # to the environment variables like PATH, LD_LIBRARY_PATH, PYTHONPATH,
300 # The main purpose is to replace default setenv command behavior:
301 # setenva, setenvp also remove duplicated entries, shortening in that way
302 # the environment variables.
303 # If some directory being added is already included into the variable
304 # nothing is done for it.
305 # Note, that these aliases work some slower that setenv command itself.
308 # appends/prepends set of directories (second parameter)
309 # to the another set of directories (first parameter) and
310 # removes duplicated entries;
311 # the third parameter defines the mode: 0 - append, 1 - prepend
312 alias cleandup "echo \!:1 \!:2 | awk -v dir=\!:3 \\\\
313 '"'{ na = split(\$2,a,":"); \\\\
317 if(\$1 != "<empty>") { \\\\
318 nb = split(\$1,b,":"); \\\\
319 for(i=1;i<=nb;i++) { \\\\
320 if(!(b[i] in ccc) ) { \\\\
328 for(i=1;i<=na;i++) { \\\\
329 if(!(a[i] in ccc)) { \\\\
336 for(i=1;i<k2;i++) { \\\\
339 for(i=1;i<k1;i++) { \\\\
344 for(i=1;i<k1;i++) { \\\\
347 for(i=1;i<k2;i++) { \\\\
351 }'"' | sed -e 's/\(.*\):/\1/g'"
353 # appends directory or set of directories, separated by ':' (second parameter)
354 # to the variable (first parameter)
355 alias setenva 'set a=\!:1 ; set b=\!:2 ; \\
356 set c=\`printenv \$a\` ; \\
357 set b=\`cleandup \$c \$b 0\` ; \\
362 # prepends directory or set of directories, separated by ':' (second parameter)
363 # to the variable (first parameter)
364 alias setenvp 'set a=\!:1 ; set b=\!:2 ; \\
365 set c=\`printenv \$a\` ; \\
366 set b=\`cleandup \$c \$b 1\` ; \\
369 ###########################################################################
372 cat ${install_work}/$CSHRC >> ${install_work}/_$CSHRC
374 # 4. put the contents of salome.sh to _salome.sh replacing export by export(a|p) aliases where necessary
375 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
376 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
377 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
378 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
380 # Setting "/usr/X11R6/lib" path in LD_LIBRARY_PATH for the libGL.so.1 file
381 #if test `uname -m` = "x86_64" ; then
382 #echo '# Setting /usr/X11R6/lib64 path in LD_LIBRARY_PATH for the libGL.so.1 file' >> ${INSTALL_WORK}/_tmp2
383 #echo 'export LD_LIBRARY_PATH=/usr/X11R6/lib64:${LD_LIBRARY_PATH}' >> ${INSTALL_WORK}/_tmp2
385 #echo '# Setting /usr/X11R6/lib path in LD_LIBRARY_PATH for the libGL.so.1 file' >> ${INSTALL_WORK}/_tmp2
386 #echo 'export LD_LIBRARY_PATH=/usr/X11R6/lib:${LD_LIBRARY_PATH}' >> ${INSTALL_WORK}/_tmp2
389 cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/_$SHRC
391 # 5. Create a salome.csh file from salome.sh by replacing export by setenv, etc.
392 sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${install_work}/$SHRC > ${INSTALL_WORK}/_tmp1 2>/dev/null
393 cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/$CSHRC
395 # 6. Create a _salome.csh file from _salome.sh by replacing export by setenv, exporta by setenva, etc.
396 sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
397 sed -e 's%exporta \([[:alnum:]_[:blank:]]*\)%setenva \1%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
398 sed -e 's%exportp \([[:alnum:]_[:blank:]]*\)%setenvp \1%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
399 sed -e 's%if \[ -n "\${PYTHONPATH}" \] ; then%if ( ${?PYTHONPATH} ) then%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
400 sed -e 's%if \[ -n "\${ENV_FOR_LAUNCH}" \] ; then%if ( ${?ENV_FOR_LAUNCH} ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
401 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
402 sed -e 's%^\([[:blank:]]*\)fi\([[:blank:]]*\)$%\1endif\2%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
403 sed -e 's%var.sh%var.csh%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
404 sed -e 's%if \[ -e "\${LICENSE_FILE}" \] ; then%if ( -e ${LICENSE_FILE} ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
406 cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/_$CSHRC 2>/dev/null
408 rm -f ${INSTALL_WORK}/_tmp1 ${INSTALL_WORK}/_tmp2
410 if [ $# -eq 5 ] ; then
412 if [ -e ${product_dir} ] ; then
413 test -e ${product_dir}/$SHRC && mv ${product_dir}/$SHRC ${product_dir}/${SHRC}_`date +%F_%T`
414 cp ${install_work}/_$SHRC ${product_dir}/$SHRC
415 test -e ${product_dir}/$CSHRC && mv ${product_dir}/$CSHRC ${product_dir}/${CSHRC}_`date +%F_%T`
416 cp ${install_work}/_$CSHRC ${product_dir}/$CSHRC
419 sed -e 's%setenv ENV_FOR_LAUNCH 1%setenv ENV_FOR_LAUNCH 0%' ${install_work}/_$CSHRC > ${install_root}/env_build.csh
420 sed -e 's%export ENV_FOR_LAUNCH=1%export ENV_FOR_LAUNCH=0%' ${install_work}/_$SHRC > ${install_root}/env_build.sh
422 cp -f ${install_work}/_$CSHRC ${install_root}/env_products.csh
423 cp -f ${install_work}/_$SHRC ${install_root}/env_products.sh
425 rm -f ${install_work}/_$SHRC ${install_work}/_$CSHRC
426 ### !!! copying build.csh and build.sh scripts
427 if [ -e ./build.csh ]; then
428 cp -f ./build.csh ${install_root}
430 if [ -e ./build.sh ]; then
431 cp -f ./build.sh ${install_root}
433 ### !!! copying release notes
434 for p in `ls ../` ; do
435 export pdf=`echo ${p} | sed s/[.]/" "/g | awk '{print $2}'`
436 if [ "${pdf}" = "pdf" ]; then
438 if [ ! -e ${install_root}/${RN} ]; then
439 cp -f ../${RN} ${install_root}
446 #try use already existing product
449 product_dir=$1; install_root=$2; install_work=$3;
450 product_sequence="$4"; installed_products="$5"; product_type=$6
451 env_file=${product_dir}/env_${product_type}.sh
452 if [ -f ${env_file} ] ; then
453 cp -f ${env_file} ${install_work}/_env_${product_type}.sh
454 make_env ${install_root} ${install_work} "${product_sequence}" "${installed_products}"
455 source ${install_work}/$SHRC
457 if [ $? -eq 0 ] ; then
461 echo ${product_type} | grep -q '_src$'
462 if [ $? -eq 1 ] ; then
470 #check existance of lib passed as first parameter
471 #return 0 if lib exists
472 #if you pass second parameter search will be done in it
473 #otherwise search will be done in $LD_LIBRARY_PATH
474 #you should use : as dilimeter if you are going to pass second parameter
479 whereIs=$LD_LIBRARY_PATH
481 for L in `echo ${whereIs} | sed -e"s%:% %g"` ; do
482 ret=`find $L -name $1 2>/dev/null`
483 if [ -n "$ret" ] ; then
484 #echo "The $1 exists on yours system in a $L folder"
494 for i in `echo ${path} | sed -e"s%:% %g"` ; do
495 ret=`find $i -name $file -maxdepth 1 2>/dev/null`
496 if [ -n "$ret" ] ; then
497 ret=`echo $ret | sed -e"s%/\$file$%%g"`
506 arg1=$1; val1=$2; arg2=$3; val2=$4
507 tmp="^$val1$|^$val1:|:$val1$|:$val1:"
508 #echo $val2 | grep -E "$tmp" >/dev/null 2>&1
509 #if [ $? -eq 0 ] ; then
514 exclude_list="usr lib bin sbin etc"
515 for i in ${exclude_list} ; do
517 echo ${val1} | grep -E "$tmp" >/dev/null 2>&1
518 if [ $? == 0 ] ; then to_tail=0; break; fi
520 if [ $to_tail -eq 0 ] ; then
529 maj_ver=`echo $1 | awk -F. '{if(NF>0) print $1; else print 0}'`
530 min_ver=`echo $1 | awk -F. '{if(NF>1) print $2; else print 0}'`
531 rel_ver=`echo $1 | awk -F. '{if(NF>2) print $3; else print 0}'`
532 let ver=$maj_ver*10000+$min_ver*100+$rel_ver
535 for i in `echo ${PATH}:/usr/bin:/usr/local/bin | sed -e"s%:% %g"` ; do
536 ret=`find $i -name gcc -maxdepth 1 2>/dev/null`
537 if [ -n "$ret" ] ; then
538 maj_ver=`$ret -dumpversion | awk -F. '{if(NF>0) print $1; else print 0}'`
539 min_ver=`$ret -dumpversion | awk -F. '{if(NF>1) print $2; else print 0}'`
540 rel_ver=`$ret -dumpversion | awk -F. '{if(NF>2) print $3; else print 0}'`
541 let ver1=$maj_ver*10000+$min_ver*100+$rel_ver
542 if [ $ver1 -eq $ver ] ; then
543 ret=`echo $ret | sed -e"s%/gcc$%%g"`
547 if [ $ver1 -gt $ver ] && [ $ver1 -gt $newerver ] ; then
549 newer=`echo $ret | sed -e"s%/gcc$%%g"`
553 if [ -n "$newer" ] ; then
561 if test -z "${TCLHOME}"; then
564 tclcfg=`find ${TCLHOME}/lib -name "tclConfig.sh" 2> /dev/null`
568 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;}'`
569 if [ $maxver -lt $ver ]; then
574 if test -n "$file"; then
584 if test -z "${TCLHOME}"; then
587 tclcfg=`find ${TCLHOME}/lib -name "tkConfig.sh" 2> /dev/null`
591 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;}'`
592 if [ $maxver -lt $ver ]; then
597 if test -n "$file"; then
607 if test -f /usr/X11R6/include/DPS/dpsconfig.h ; then
611 if test -f /usr/include/DPS/dpsconfig.h ; then
620 for d in /usr/X11R6/include /usr/include ; do
621 if [ -d ${d}/GL ] && [ -f ${d}/GL/gl.h ] ; then
631 # search libGL.so* file and correct libGL.la in the same directory
632 for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
633 if [ "`ls ${d}/libGL.so* 2>/dev/null`" ] && [ -f ${d}/libGL.la ]; then
634 libdir=`grep "libdir=" ${d}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%" -e "s%/*$%%g"`
635 if [ "$libdir" == "$d" ] ; then
641 # search libGL.la file and check if this file is correct
642 for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
643 if [ -f ${d}/libGL.la ] ; then
644 libdir=`grep "libdir=" ${d}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"`
645 if [ "`ls $libdir/libGL.so* 2>/dev/null`" ] ; then
651 # then search libGL.so* file
652 for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
653 if [ "`ls ${d}/libGL.so* 2>/dev/null`" ] ; then
664 if [ -z "$ldir" ] || [ ! -d "$ldir" ]; then return 1; fi
668 #SALOME_MODULES="`env | awk -F_ '/[[:alnum:]]*_ROOT_DIR/ { print $1 }'`"
669 SALOME_MODULES="`env | awk -F_ '/[a-zA-Z0-9]*_ROOT_DIR/ { print $1 }'`"
673 la_files=`find . -name "*.la"`
675 for l in X ${la_files}; do
676 if [ "$l" != "X" ] ; then
680 # 1. process salome modules dependencies
682 for mod in $SALOME_MODULES; do
683 moddir=`printenv ${mod}_ROOT_DIR`
684 if [ -n "${moddir}" ] ; then
685 #echo $l $mod $moddir
686 # sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[^[:space:]/]*/\(lib\|lib64\)% \1${moddir}/${myldir}%g" $l > $l"_"
687 # sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[^[:space:]/]*/lib% \1${moddir}/lib%g" $l > $l"_"
688 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[^[:space:]/]*/lib% \1${moddir}/lib%g" \
689 -e "s%^libdir='[^[:space:]]*${mod}[^[:space:]]*/\(lib.*\)'%libdir='${moddir}/\1'%g" $l > $l"_"
691 # for mod1 in $SALOME_MODULES; do
692 # sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod1}[^[:space:]]*/${mod1}_build%%g" $l > $l"_"
698 # 2. process CAS.CADE dependencies
699 casdir=`printenv CASROOT`/lib
700 if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/Linux/lib ; fi
701 if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/lin/lib ; fi
702 if [ -n "${CASROOT}" ] && [ -d "${casdir}" ] ; then
703 # echo $l $CASROOT $casdir
704 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/Linux/lib% \1${casdir}%g" \
705 -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/lin/lib% \1${casdir}%g" \
706 -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/lib% \1${casdir}%g" $l > $l"_"
708 sed -e "s%-L[^[:space:]]*OCCT[^[:space:]]*/Linux/lib%-L${casdir}%g" \
709 -e "s%[^[:space:]]*OCCT[^[:space:]]*/lib/%${casdir}/%g" $l > $l"_"
712 # 3. process omniORB dependencies
713 omnidir=`printenv OMNIORBDIR`/lib/i586_linux_2.0_glibc2.1
714 if [ ! -d ${omnidir} ] ; then omnidir=`printenv OMNIORBDIR`/lib ; fi
715 if [ -n "${OMNIORBDIR}" ] && [ -d "${omnidir}" ] ; then
716 # echo $l $OMNIORBDIR $omnidir
717 sed -e "s%-L[^[:space:]]*omni[^[:space:]]*%-L${omnidir}%g" \
718 -e "s%-R[^[:space:]]*omni[^[:space:]]*%-R${omnidir}%g" $l > $l"_"
721 # 4. process VTK dependencies
722 vtkpath=`printenv VTKHOME`
723 if [ `uname -m` = "x86_64" ] && [ -d ${vtkpath}/lib64 ] ; then
725 elif [ -d ${vtkpath}/lib ] ; then
730 vtkldir=${vtkpath}/lib${LIB_PREFIX}
731 vtkdir=${vtkldir}/vtk-5.0
732 if [ -n "${VTKHOME}" ] && [ -d "${vtkdir}" ] && [ -d "${vtkldir}" ] ; then
733 # echo $l $VTKHOME $vtkdir
734 sed -e "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)/vtk\-5\.0%-L${vtkdir}%g" \
735 -e "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)%-L${vtkldir}%g" $l > $l"_"
738 # 5. process HDF dependencies
739 hdfdir=`printenv HDF5HOME`/lib
740 if [ -n "${HDF5HOME}" ] && [ -d "${hdfdir}" ] ; then
741 # echo $l $HDF5HOME $hdfdir
742 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*hdf[^[:space:]/]*/lib% \1${hdfdir}%g" $l > $l"_"
745 # 6. process MED dependencies
746 meddir=`printenv MED2HOME`/lib
747 if [ -n "${MED2HOME}" ] && [ -d "${meddir}" ] ; then
748 # echo $l $MED2HOME $meddir
749 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*med[^[:space:]/]*/lib% \1${meddir}%g" $l > $l"_"
752 # 7. process qwt dependencies
753 qwtdir=`find_in_path libqwt.so ${LD_LIBRARY_PATH}`
754 if [ -n "${qwtdir}" ] && [ -d "${qwtdir}" ] ; then
756 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*qwt[^[:space:]/]*/lib% \1${qwtdir}%g" $l > $l"_"
759 # 8. process qt dependencies
760 qtdir=`printenv QTDIR`/lib
761 if [ -n "${QTDIR}" ] && [ -d "${qtdir}" ] ; then
762 # echo $l $QTDIR $qtdir
763 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*qt[^[:space:]/]*/lib% \1${qtdir}%g" $l > $l"_"
766 # 9. process python dependencies
767 where_python=`which python` # e.g. /usr/bin/python
768 if [ -n "$where_python" ] ; then
769 where_python=`dirname $where_python` # --> /usr/bin
770 where_python=`dirname $where_python` # --> /usr
771 python_version=`python -c "import sys; print sys.version[:3]"`
772 # echo $l $where_python $python_version
773 sed -e "s%-L[^[:space:]]*python[0-9]\.[0-9]\([^[:space:]]*\)%-L${where_python}/lib/python${python_version}\1%g" $l > $l"_"
776 # 10. process sip dependencies
777 sipdir=`find_in_path sip.so ${LD_LIBRARY_PATH}`
778 if [ -n "${sipdir}" ] && [ -d "${sipdir}" ] ; then
780 sed -e "s%-L[^[:space:]]*sip[^[:space:]]*%-L${sipdir}%g" $l > $l"_"
783 # 11. process PyQt dependencies
784 pyqtdir=`find_in_path Qt.so ${LD_LIBRARY_PATH}`
785 if [ -n "${pyqtdir}" ] && [ -d "${pyqtdir}" ] ; then
787 sed -e "s%-L[^[:space:]]*PyQt[^[:space:]]*%-L${pyqtdir}%g" $l > $l"_"
790 # 12. process tcl/tk dependencies
791 tcldir=`printenv TCLHOME`/lib
792 if [ -n "${tcldir}" ] && [ -d "${tcldir}" ] ; then
793 # echo $l $TCLHOME $tcldir
794 sed -e "s%-L[^[:space:]]*tcltk[^[:space:]]*/lib%-L${tcldir}%g" $l > $l"_"
797 # 13. process boost dependencies
798 boostdir=`printenv BOOSTDIR`/lib
799 if [ -n "${boostdir}" ] && [ -d "${boostdir}" ] ; then
800 # echo $l $BOOSTDIR $boostdir
801 sed -e "s%-L[^[:space:]]*boost[^[:space:]]*/lib%-L${boostdir}%g" $l > $l"_"
805 blsurfdir=`printenv BLSURFHOME`/lib
806 if [ -n "${blsurfdir}" ] && [ -d "${blsurfdir}" ] ; then
807 # echo $l $BOOSTDIR $boostdir
808 sed -e "s%-L[^[:space:]]*BLSurf[^[:space:]]*/lib%-L${blsurfdir}%g" $l > $l"_"
812 # # 14. modify libdir
813 # #sed -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib/salome'%g" $l > $l"_"
814 # mod=`basename $ldir | awk -F_ '{print $1}'`
815 # moddir=`printenv ${mod}_ROOT_DIR`
816 # sed -e "s%^libdir='[^[:space:]]*${mod}[^[:space:]]*/\(lib.*\)'%libdir='${moddir}/\1'%g" $l > $l"_"
819 # 15. process libxml dependencies
820 libxmldir=`printenv LIBXML_DIR`/lib
821 if [ ! -d ${libxmldir} ] ; then libxmldir=`printenv LIBXML_DIR`/lib ; fi
822 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*libxml2-[0-9]\.[0-9]\.[0-9][0-9]/lib% \1${libxmldir}%g" $l > $l"_"
824 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*libxml2/lib% \1${libxmldir}%g" $l > $l"_"
827 # 16. process metis dependencies
828 metisdir=`printenv METISDIR`
829 if [ ! -d ${metisdir} ] ; then metisdir=`printenv METISDIR` ; fi
830 sed -e "s%-L[^[:space:]]*metis[^[:space:]]*%-L${metisdir}%g" $l > $l"_"
833 # 17. process scotch dependencies
834 scotchdir=`printenv SCOTCHDIR`/bin
835 if [ ! -d ${scotchdir} ] ; then scotchdir=`printenv SCOTCHDIR`/bin ; fi
836 sed -e "s%-L[^[:space:]]*scotch[^[:space:]]*/bin%-L${scotchdir}%g" $l > $l"_"
839 # 18. process libGL.la dependencies
840 if test `uname -m` = "x86_64" ; then
841 libGLpath=/usr/lib64/libGL.la
843 libGLpath=/usr/lib/libGL.la
845 sed -e "s%$libGLpath%""%g" $l > $l"_"
848 # 19. process graphviz dependencies
849 graphvizdir=`printenv GRAPHVIZHOME`/lib
850 if [ ! -d ${graphvizdir} ] ; then graphvizdir=`printenv GRAPHVIZHOME`/lib ; fi
851 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*graphviz-[0-9]\.[0-9]\+\.[0-9]/lib% \1${graphvizdir}%g" \
852 -e "s%[[:space:]]\(-L\)\?[^[:space:]]*graphviz/lib% \1${graphvizdir}%g" $l > $l"_"
853 chmod -f --reference=$l $l"_"
856 # 20. process QScintilla-2.3 dependencies
857 qscintilladir=`printenv QSCINTILLA_DIR`/lib
858 if [ ! -d ${qscintilladir} ] ; then qscintilladir=`printenv QSCINTILLA_DIR`/lib ; fi
859 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*QScintilla-[0-9]\.[0-9]\(\.[0-9]\)\?/lib% \1${qscintilladir}%g" $l > $l"_"
860 chmod -f --reference=$l $l"_"
863 # 21. process expat-2.0.1 dependencies
864 expatdir=${EXPAT_ROOT}/lib
865 sed -e "s%-L[^[:space:]]*expat[^[:space:]]*/lib%-L${expatdir}%g" \
866 -e "s%[^[:space:]]*expat[^[:space:]]*/lib/libexpat.la%-lexpat%g" $l > $l"_"
867 chmod -f --reference=$l $l"_"