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.3.1"
23 export YACSGEN_VERSION="6.3.1"
24 export JOBMANAGER_VERSION="6.3.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
38 cfg_file=CMakeLists.txt
40 if [ -f ${root_dir}/${cfg_file} ] ; then
41 if [ "${cfg_file}" = "CMakeLists.txt" ] ; then
42 ver_maj=`cat ${root_dir}/${cfg_file} | grep SET\(VERSION_MAJOR | sed -e "s%[A-Z_() ]%%g"`
43 ver_min=`cat ${root_dir}/${cfg_file} | grep SET\(VERSION_MINOR | sed -e "s%[A-Z_() ]%%g"`
44 ver_maintenance=`cat ${root_dir}/${cfg_file} | grep SET\(VERSION_MAINTENANCE | sed -e "s%[A-Z_() ]%%g"`
45 ver="${ver_maj}.${ver_min}.${ver_maintenance}"
47 ver=`grep -e "^AC_INIT" ${root_dir}/${cfg_file} | sed -e "s%.*\[\([[:digit:].]*\)\].*%\1%g"`
50 if [ "$ver" = "${SALOME_VERSION}" ]; then
58 #this function takes several parameters
59 #first parameter contains descriptor of output file
60 #next parameters is command for execution
61 #in case of bad result of execution ask user about furher steps
62 #(user can cancel installation procedure)
68 if [ -n "$INSTALL_WORK" ] ; then errfile=$INSTALL_WORK/errlog; fi
70 if [ "$out" != "1" ] ; then cmd="$cmd >> $out" ; fi
72 if [ "$out" != "1" ] ; then
77 if [ "$?" -ne "0" ] ; then
78 if [ $out != "1" ] ; then
83 # VSR : 10/11/05: disable answer mode ==>
85 #echo -e "NOT DONE !!! => $*"
86 #echo -n "Would you like to continue to install this product: (Y,N) [Y] : "
88 #rep=`echo $rep | tr "[A-Z]" "[a-z]"`
89 #if test -z $rep || [ $rep = "y" ] ; then
92 # VSR : 10/11/05: disable answer mode <==
98 #invoke check_job function
99 #all output will be put into terminal
109 rm -rf "$1" > /dev/null
113 #create environment for sh and csh
116 install_root=$1; shift
119 for i in $SHRC $CSHRC ; do
120 if [ -e ${install_work}/$i ]; then
121 rm ${install_work}/$i
123 touch ${install_work}/$i
126 if [ $# -eq 4 ] ; then
128 product_env=${install_work}/env_${product_name}.sh
129 (test -e ${product_env} && rm ${product_env} )
131 ### !!! writing salome.sh file !!! -> define INST_ROOT
132 cat >> ${install_work}/$SHRC <<EOF
133 #${DELIM} Setting products installation directory ${DELIM}
134 export INST_ROOT=${install_root}
136 #${DELIM} Environment switch: 0 for SALOME building, 1 for SALOME launching ${DELIM}
137 export ENV_FOR_LAUNCH=1
140 ### !!! The next is for RedHat 9 only !!!
141 if [ -f /etc/redhat-release ] ; then
142 grep -e "Red Hat Linux release 9" /etc/redhat-release > /dev/null
143 if [ $? -eq 0 ] ; then
144 cat >> ${install_work}/$SHRC <<EOF
145 #${DELIM} Force RH9 to use old implementation of threads ${DELIM}
146 export LD_ASSUME_KERNEL=2.4.18
151 ### !!! writing salome.csh file !!! -> set inital variables
152 pre_vars="PATH LD_LIBRARY_PATH LD_RUN_PATH PYTHONPATH TCLLIBPATH"
153 for i in $pre_vars ; do
154 cat >> ${install_work}/$CSHRC <<EOF
155 #${DELIM} setting initial ${i} ${DELIM}
156 if (! (\$?${i}) ) then
163 ### !!! writing salome.(c)sh files !!! -> dump products environment files, changing 'export' by 'setenv(a|p)' where necessary
164 ### Note, that for performance reasons temporary environment files used during installation procedure itself
165 ### are created without using setenv(a|p) aliases.
167 # 0. add /usr/lib or /usr/lib64 dir to the LD_LIBRARY_PATH
168 #if test `uname -m` = "x86_64" ; then
169 #echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> ${install_work}/$SHRC 2>/dev/null
170 #echo '' >> ${install_work}/$SHRC 2>/dev/null
172 #echo 'export LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH}' >> ${install_work}/$SHRC 2>/dev/null
173 #echo '' >> ${install_work}/$SHRC 2>/dev/null
178 # Source of license environment file
180 echo '#------ License activation ------' >> ${install_work}/$SHRC 2>/dev/null
181 echo 'export LICENSE_FILE=/product/distene/dlim8.var.sh' >> ${install_work}/$SHRC 2>/dev/null
182 echo '' >> ${install_work}/$SHRC 2>/dev/null
183 echo 'if [ -e "${LICENSE_FILE}" ] ; then' >> ${install_work}/$SHRC 2>/dev/null
184 echo 'export SIMULOGD_LICENSE_FILE=29029@soleil' >> ${install_work}/$SHRC 2>/dev/null
185 echo 'source ${LICENSE_FILE}' >> ${install_work}/$SHRC 2>/dev/null
186 echo 'fi' >> ${install_work}/$SHRC 2>/dev/null
187 echo '' >> ${install_work}/$SHRC 2>/dev/null
189 # 1. first dump all environment files into the $SHRC file
190 product_sequence="$2"
191 install_products="$3"
192 for i in $product_sequence ; do
193 env_file=${install_work}/env_${i}.sh
194 _env_file=${install_work}/_env_${i}.sh
195 if [ -e $_env_file ] ; then
196 cat $_env_file >> ${install_work}/$SHRC 2>/dev/null
197 elif [ -e $env_file ] ; then
198 echo $install_products | grep -q "\b${i}\b"
199 if [ $? -eq 1 ] ; then
200 cat $env_file | sed 's/^/## /' >> ${install_work}/$SHRC 2>/dev/null
202 cat $env_file >> ${install_work}/$SHRC 2>/dev/null
207 # 2. writing global functions to _salome.sh file
208 cat >> ${install_work}/_$SHRC <<EOF
209 ##########################################################################
210 # Functions exporta and exportp are used to append/prepend correspondingly
211 # one directory or a set of directories separated by semicolon symbol (':')
212 # to the environment variables like PATH, LD_LIBRARY_PATH, PYTHONPATH,
214 # The main purpose is to replace default setenv command behavior:
215 # exporta, exportp also remove duplicated entries, shortening in that way
216 # the environment variables.
217 # If some directory being added is already included into the variable
218 # nothing is done for it.
219 # Note, that these functions work some slower that setenv command itself.
222 # appends/prepends set of directories (second parameter)
223 # to the another set of directories (first parameter) and
224 # removes duplicated entries;
225 # the third parameter defines the mode: 0 - append, 1 - prepend
227 out_var=\`echo \$1 \$2 | awk -v dir=\$3 '{ \\
228 na = split(\$2,a,":"); \\
232 if(\$1 != "<empty>") { \\
233 nb = split(\$1,b,":"); \\
234 for(i=1;i<=nb;i++) { \\
235 if(!(b[i] in ccc) ) { \\
243 for(i=1;i<=na;i++) { \\
244 if(!(a[i] in ccc)) { \\
251 for(i=1;i<k2;i++) { \\
254 for(i=1;i<k1;i++) { \\
259 for(i=1;i<k1;i++) { \\
262 for(i=1;i<k2;i++) { \\
266 }' | sed -e 's/\(.*\):/\1/g'\`
270 # appends directory or set of directories, separated by ':' (second parameter)
271 # to the variable (first parameter)
273 xenv=\`printenv \$1\`
274 if [ -z "\$xenv" ]; then xenv="<empty>"; fi
275 out_var=\`cleandup \$xenv \$2 0\`
279 # prepends directory or set of directories, separated by ':' (second parameter)
280 # to the variable (first parameter)
282 xenv=\`printenv \$1\`
283 if [ -z "\$xenv" ]; then xenv="<empty>"; fi
284 out_var=\`cleandup \$xenv \$2 1\`
287 ###########################################################################
291 # 3. writing global functions to _salome.csh file
292 cat >> ${install_work}/_$CSHRC <<EOF
294 ###########################################################################
295 # Aliases setenva and setenvp are used to append/prepend correspondingly
296 # one directory or a set of directories separated by semicolon symbol (':')
297 # to the environment variables like PATH, LD_LIBRARY_PATH, PYTHONPATH,
299 # The main purpose is to replace default setenv command behavior:
300 # setenva, setenvp also remove duplicated entries, shortening in that way
301 # the environment variables.
302 # If some directory being added is already included into the variable
303 # nothing is done for it.
304 # Note, that these aliases work some slower that setenv command itself.
307 # appends/prepends set of directories (second parameter)
308 # to the another set of directories (first parameter) and
309 # removes duplicated entries;
310 # the third parameter defines the mode: 0 - append, 1 - prepend
311 alias cleandup "echo \!:1 \!:2 | awk -v dir=\!:3 \\\\
312 '"'{ na = split(\$2,a,":"); \\\\
316 if(\$1 != "<empty>") { \\\\
317 nb = split(\$1,b,":"); \\\\
318 for(i=1;i<=nb;i++) { \\\\
319 if(!(b[i] in ccc) ) { \\\\
327 for(i=1;i<=na;i++) { \\\\
328 if(!(a[i] in ccc)) { \\\\
335 for(i=1;i<k2;i++) { \\\\
338 for(i=1;i<k1;i++) { \\\\
343 for(i=1;i<k1;i++) { \\\\
346 for(i=1;i<k2;i++) { \\\\
350 }'"' | sed -e 's/\(.*\):/\1/g'"
352 # appends directory or set of directories, separated by ':' (second parameter)
353 # to the variable (first parameter)
354 alias setenva 'set a=\!:1 ; set b=\!:2 ; \\
355 set c=\`printenv \$a\` ; \\
356 set b=\`cleandup \$c \$b 0\` ; \\
361 # prepends directory or set of directories, separated by ':' (second parameter)
362 # to the variable (first parameter)
363 alias setenvp 'set a=\!:1 ; set b=\!:2 ; \\
364 set c=\`printenv \$a\` ; \\
365 set b=\`cleandup \$c \$b 1\` ; \\
368 ###########################################################################
371 cat ${install_work}/$CSHRC >> ${install_work}/_$CSHRC
373 # 4. put the contents of salome.sh to _salome.sh replacing export by export(a|p) aliases where necessary
374 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
375 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
376 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
377 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
379 # Setting "/usr/X11R6/lib" path in LD_LIBRARY_PATH for the libGL.so.1 file
380 #if test `uname -m` = "x86_64" ; then
381 #echo '# Setting /usr/X11R6/lib64 path in LD_LIBRARY_PATH for the libGL.so.1 file' >> ${INSTALL_WORK}/_tmp2
382 #echo 'export LD_LIBRARY_PATH=/usr/X11R6/lib64:${LD_LIBRARY_PATH}' >> ${INSTALL_WORK}/_tmp2
384 #echo '# Setting /usr/X11R6/lib path in LD_LIBRARY_PATH for the libGL.so.1 file' >> ${INSTALL_WORK}/_tmp2
385 #echo 'export LD_LIBRARY_PATH=/usr/X11R6/lib:${LD_LIBRARY_PATH}' >> ${INSTALL_WORK}/_tmp2
388 cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/_$SHRC
390 # 5. Create a salome.csh file from salome.sh by replacing export by setenv, etc.
391 sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${install_work}/$SHRC > ${INSTALL_WORK}/_tmp1 2>/dev/null
392 cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/$CSHRC
394 # 6. Create a _salome.csh file from _salome.sh by replacing export by setenv, exporta by setenva, etc.
395 sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
396 sed -e 's%exporta \([[:alnum:]_[:blank:]]*\)%setenva \1%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
397 sed -e 's%exportp \([[:alnum:]_[:blank:]]*\)%setenvp \1%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
398 sed -e 's%if \[ -n "\${PYTHONPATH}" \] ; then%if ( ${?PYTHONPATH} ) then%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
399 sed -e 's%if \[ -n "\${ENV_FOR_LAUNCH}" \] ; then%if ( ${?ENV_FOR_LAUNCH} ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
400 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
401 sed -e 's%^\([[:blank:]]*\)fi\([[:blank:]]*\)$%\1endif\2%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
402 sed -e 's%var.sh%var.csh%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
403 sed -e 's%if \[ -e "\${LICENSE_FILE}" \] ; then%if ( -e ${LICENSE_FILE} ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
405 cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/_$CSHRC 2>/dev/null
407 rm -f ${INSTALL_WORK}/_tmp1 ${INSTALL_WORK}/_tmp2
409 if [ $# -eq 5 ] ; then
411 if [ -e ${product_dir} ] ; then
412 test -e ${product_dir}/$SHRC && mv ${product_dir}/$SHRC ${product_dir}/${SHRC}_`date +%F_%T`
413 cp ${install_work}/_$SHRC ${product_dir}/$SHRC
414 test -e ${product_dir}/$CSHRC && mv ${product_dir}/$CSHRC ${product_dir}/${CSHRC}_`date +%F_%T`
415 cp ${install_work}/_$CSHRC ${product_dir}/$CSHRC
418 sed -e 's%setenv ENV_FOR_LAUNCH 1%setenv ENV_FOR_LAUNCH 0%' ${install_work}/_$CSHRC > ${install_root}/env_build.csh
419 sed -e 's%export ENV_FOR_LAUNCH=1%export ENV_FOR_LAUNCH=0%' ${install_work}/_$SHRC > ${install_root}/env_build.sh
421 cp -f ${install_work}/_$CSHRC ${install_root}/env_products.csh
422 cp -f ${install_work}/_$SHRC ${install_root}/env_products.sh
424 rm -f ${install_work}/_$SHRC ${install_work}/_$CSHRC
425 ### !!! copying build.csh and build.sh scripts
426 if [ -e ./build.csh ]; then
427 cp -f ./build.csh ${install_root}
429 if [ -e ./build.sh ]; then
430 cp -f ./build.sh ${install_root}
432 ### !!! copying release notes
433 for p in `ls ../` ; do
434 export pdf=`echo ${p} | sed s/[.]/" "/g | awk '{print $2}'`
435 if [ "${pdf}" = "pdf" ]; then
437 if [ ! -e ${install_root}/${RN} ]; then
438 cp -f ../${RN} ${install_root}
445 #try use already existing product
448 product_dir=$1; install_root=$2; install_work=$3;
449 product_sequence="$4"; installed_products="$5"; product_type=$6
450 env_file=${product_dir}/env_${product_type}.sh
451 if [ -f ${env_file} ] ; then
452 cp -f ${env_file} ${install_work}/_env_${product_type}.sh
453 make_env ${install_root} ${install_work} "${product_sequence}" "${installed_products}"
454 source ${install_work}/$SHRC
456 if [ $? -eq 0 ] ; then
460 echo ${product_type} | grep -q '_src$'
461 if [ $? -eq 1 ] ; then
469 #check existance of lib passed as first parameter
470 #return 0 if lib exists
471 #if you pass second parameter search will be done in it
472 #otherwise search will be done in $LD_LIBRARY_PATH
473 #you should use : as dilimeter if you are going to pass second parameter
478 whereIs=$LD_LIBRARY_PATH
480 for L in `echo ${whereIs} | sed -e"s%:% %g"` ; do
481 ret=`find $L -name $1 2>/dev/null`
482 if [ -n "$ret" ] ; then
483 #echo "The $1 exists on yours system in a $L folder"
493 for i in `echo ${path} | sed -e"s%:% %g"` ; do
494 ret=`find $i -name $file -maxdepth 1 2>/dev/null`
495 if [ -n "$ret" ] ; then
496 ret=`echo $ret | sed -e"s%/\$file$%%g"`
505 arg1=$1; val1=$2; arg2=$3; val2=$4
506 tmp="^$val1$|^$val1:|:$val1$|:$val1:"
507 #echo $val2 | grep -E "$tmp" >/dev/null 2>&1
508 #if [ $? -eq 0 ] ; then
513 exclude_list="usr lib bin sbin etc"
514 for i in ${exclude_list} ; do
516 echo ${val1} | grep -E "$tmp" >/dev/null 2>&1
517 if [ $? == 0 ] ; then to_tail=0; break; fi
519 if [ $to_tail -eq 0 ] ; then
528 maj_ver=`echo $1 | awk -F. '{if(NF>0) print $1; else print 0}'`
529 min_ver=`echo $1 | awk -F. '{if(NF>1) print $2; else print 0}'`
530 rel_ver=`echo $1 | awk -F. '{if(NF>2) print $3; else print 0}'`
531 let ver=$maj_ver*10000+$min_ver*100+$rel_ver
534 for i in `echo ${PATH}:/usr/bin:/usr/local/bin | sed -e"s%:% %g"` ; do
535 ret=`find $i -name gcc -maxdepth 1 2>/dev/null`
536 if [ -n "$ret" ] ; then
537 maj_ver=`$ret -dumpversion | awk -F. '{if(NF>0) print $1; else print 0}'`
538 min_ver=`$ret -dumpversion | awk -F. '{if(NF>1) print $2; else print 0}'`
539 rel_ver=`$ret -dumpversion | awk -F. '{if(NF>2) print $3; else print 0}'`
540 let ver1=$maj_ver*10000+$min_ver*100+$rel_ver
541 if [ $ver1 -eq $ver ] ; then
542 ret=`echo $ret | sed -e"s%/gcc$%%g"`
546 if [ $ver1 -gt $ver ] && [ $ver1 -gt $newerver ] ; then
548 newer=`echo $ret | sed -e"s%/gcc$%%g"`
552 if [ -n "$newer" ] ; then
560 if test -z "${TCLHOME}"; then
563 tclcfg=`find ${TCLHOME}/lib -name "tclConfig.sh" 2> /dev/null`
567 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;}'`
568 if [ $maxver -lt $ver ]; then
573 if test -n "$file"; then
583 if test -z "${TCLHOME}"; then
586 tclcfg=`find ${TCLHOME}/lib -name "tkConfig.sh" 2> /dev/null`
590 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;}'`
591 if [ $maxver -lt $ver ]; then
596 if test -n "$file"; then
606 if test -f /usr/X11R6/include/DPS/dpsconfig.h ; then
610 if test -f /usr/include/DPS/dpsconfig.h ; then
619 for d in /usr/X11R6/include /usr/include ; do
620 if [ -d ${d}/GL ] && [ -f ${d}/GL/gl.h ] ; then
630 # search libGL.so* file and correct libGL.la in the same directory
631 for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
632 if [ "`ls ${d}/libGL.so* 2>/dev/null`" ] && [ -f ${d}/libGL.la ]; then
633 libdir=`grep "libdir=" ${d}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%" -e "s%/*$%%g"`
634 if [ "$libdir" == "$d" ] ; then
640 # search libGL.la file and check if this file is correct
641 for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
642 if [ -f ${d}/libGL.la ] ; then
643 libdir=`grep "libdir=" ${d}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"`
644 if [ "`ls $libdir/libGL.so* 2>/dev/null`" ] ; then
650 # then search libGL.so* file
651 for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
652 if [ "`ls ${d}/libGL.so* 2>/dev/null`" ] ; then
663 if [ -z "$ldir" ] || [ ! -d "$ldir" ]; then return 1; fi
667 #SALOME_MODULES="`env | awk -F_ '/[[:alnum:]]*_ROOT_DIR/ { print $1 }'`"
668 SALOME_MODULES="`env | awk -F_ '/[a-zA-Z0-9]*_ROOT_DIR/ { print $1 }'`"
672 la_files=`find . -name "*.la"`
674 for l in X ${la_files}; do
675 if [ "$l" != "X" ] ; then
680 # . process salome modules dependencies
681 for mod in $SALOME_MODULES; do
682 moddir=`printenv ${mod}_ROOT_DIR`
683 if [ -n "${moddir}" ] ; then
684 #echo $l $mod $moddir
685 # sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[^[:space:]/]*/\(lib\|lib64\)% \1${moddir}/${myldir}%g" $l > $l"_"
686 # sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[^[:space:]/]*/lib% \1${moddir}/lib%g" $l > $l"_"
687 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[1]\?/lib% \1${moddir}/lib%g" \
688 -e "s%^libdir='[^[:space:]]*${mod}[1]\?/\(lib.*\)'%libdir='${moddir}/\1'%g" $l > $l"_"
690 # for mod1 in $SALOME_MODULES; do
691 # sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod1}[^[:space:]]*/${mod1}_build%%g" $l > $l"_"
697 # . process netgen dependencies (WARNING! It should be before CAS.CADE)
698 netgendir=`printenv NETGENHOME`/lib
699 sed -e "s%[[:space:]]-L[^[:space:]]*Netgen[^[:space:]]*/lib\?% -L${netgendir}%g" \
700 -e "s%[[:space:]][^[:space:]]*Netgen[^[:space:]]*/lib/lib\?% ${netgendir}/lib%g" $l > $l"_"
701 chmod -f --reference=$l $l"_"
704 # . process CAS.CADE dependencies
705 casdir=`printenv CASROOT`/lib
706 if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/Linux/lib ; fi
707 if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/lin/lib ; fi
708 if [ -n "${CASROOT}" ] && [ -d "${casdir}" ] ; then
709 # echo $l $CASROOT $casdir
710 # sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/Linux/lib% \1${casdir}%g" \
711 # -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/lin/lib% \1${casdir}%g" \
712 # -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/lib% \1${casdir}%g" $l > $l"_"
714 # sed -e "s%-L[^[:space:]]*OCCT[^[:space:]]*/install/lib%-L${casdir}%g" \
715 # -e "s%[^[:space:]]*OCCT[^[:space:]]*/install/lib/%${casdir}/%g" $l > $l"_"
716 sed -e "s%-L[^[:space:]]*OCCT[^[:space:]]*/install/lib%-L${casdir}%g" \
717 -e "s%[^[:space:]]*OCCT[^[:space:]]*/install/lib/%${casdir}/%g" \
718 -e "s%[[:space:]]-L[^[:space:]]*\(OCCT\|CAS\)[^[:space:]]*/lib\?% -L${CASROOT}/lib%g" \
719 -e "s%[[:space:]][^[:space:]]*\(OCCT\|CAS\)[^[:space:]]*/lib/lib\?% ${CASROOT}/lib/lib%g" $l > $l"_"
723 # . process omniORB dependencies
724 omnidir=`printenv OMNIORBDIR`/lib/i586_linux_2.0_glibc2.1
725 if [ ! -d ${omnidir} ] ; then omnidir=`printenv OMNIORBDIR`/lib ; fi
726 if [ -n "${OMNIORBDIR}" ] && [ -d "${omnidir}" ] ; then
727 # echo $l $OMNIORBDIR $omnidir
728 sed -e "s%-L[^[:space:]]*omni[^[:space:]]*%-L${omnidir}%g" \
729 -e "s%-R[^[:space:]]*omni[^[:space:]]*%-R${omnidir}%g" $l > $l"_"
733 # . process VTK dependencies
734 vtkpath=`printenv VTKHOME`
735 if [ `uname -m` = "x86_64" ] && [ -d ${vtkpath}/lib64 ] ; then
737 elif [ -d ${vtkpath}/lib ] ; then
742 vtkldir=${vtkpath}/lib${LIB_PREFIX}
743 vtkdir=${vtkldir}/vtk-5.0
744 if [ -n "${VTKHOME}" ] && [ -d "${vtkdir}" ] && [ -d "${vtkldir}" ] ; then
745 # echo $l $VTKHOME $vtkdir
746 sed -e "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)/vtk\-5\.0%-L${vtkdir}%g" \
747 -e "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)%-L${vtkldir}%g" $l > $l"_"
751 # . process HDF dependencies
752 hdfdir=`printenv HDF5HOME`/lib
753 if [ -n "${HDF5HOME}" ] && [ -d "${hdfdir}" ] ; then
754 # echo $l $HDF5HOME $hdfdir
755 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*hdf[^[:space:]/]*/lib% \1${hdfdir}%g" $l > $l"_"
759 # . process MED dependencies
760 meddir=`printenv MED2HOME`/lib
761 if [ -n "${MED2HOME}" ] && [ -d "${meddir}" ] ; then
762 # echo $l $MED2HOME $meddir
763 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*med[^[:space:]/]*/lib% \1${meddir}%g" $l > $l"_"
767 # . process qwt dependencies
768 qwtdir=`find_in_path libqwt.so ${LD_LIBRARY_PATH}`
769 if [ -n "${qwtdir}" ] && [ -d "${qwtdir}" ] ; then
771 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*qwt[^[:space:]/]*/lib% \1${qwtdir}%g" $l > $l"_"
775 # . process qt dependencies
776 qtdir=`printenv QTDIR`/lib
777 if [ -n "${QTDIR}" ] && [ -d "${qtdir}" ] ; then
778 # echo $l $QTDIR $qtdir
779 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*qt[^[:space:]/]*/lib% \1${qtdir}%g" $l > $l"_"
783 # . process python dependencies
784 where_python=`which python` # e.g. /usr/bin/python
785 if [ -n "$where_python" ] ; then
786 where_python=`dirname $where_python` # --> /usr/bin
787 where_python=`dirname $where_python` # --> /usr
788 python_version=`python -c "import sys; print sys.version[:3]"`
789 # echo $l $where_python $python_version
790 sed -e "s%-L[^[:space:]]*python[0-9]\.[0-9]\([^[:space:]]*\)%-L${where_python}/lib/python${python_version}\1%g" $l > $l"_"
794 # . process sip dependencies
795 sipdir=`find_in_path sip.so ${LD_LIBRARY_PATH}`
796 if [ -n "${sipdir}" ] && [ -d "${sipdir}" ] ; then
798 sed -e "s%-L[^[:space:]]*sip[^[:space:]]*%-L${sipdir}%g" $l > $l"_"
802 # . process PyQt dependencies
803 pyqtdir=`find_in_path Qt.so ${LD_LIBRARY_PATH}`
804 if [ -n "${pyqtdir}" ] && [ -d "${pyqtdir}" ] ; then
806 sed -e "s%-L[^[:space:]]*PyQt[^[:space:]]*%-L${pyqtdir}%g" $l > $l"_"
810 # . process tcl/tk dependencies
811 tcldir=`printenv TCLHOME`/lib
812 if [ -n "${tcldir}" ] && [ -d "${tcldir}" ] ; then
813 # echo $l $TCLHOME $tcldir
814 sed -e "s%-L[^[:space:]]*tcltk[^[:space:]]*/lib%-L${tcldir}%g" $l > $l"_"
818 # . process boost dependencies
819 boostdir=`printenv BOOSTDIR`/lib
820 if [ -n "${boostdir}" ] && [ -d "${boostdir}" ] ; then
821 # echo $l $BOOSTDIR $boostdir
822 sed -e "s%-L[^[:space:]]*boost[^[:space:]]*/lib%-L${boostdir}%g" $l > $l"_"
826 # . process blsurf dependencies
827 blsurfdir=`printenv BLSURFHOME`/lib
828 if [ -n "${blsurfdir}" ] && [ -d "${blsurfdir}" ] ; then
829 # echo $l $BOOSTDIR $boostdir
830 sed -e "s%-L[^[:space:]]*BLSurf[^[:space:]]*/lib%-L${blsurfdir}%g" $l > $l"_"
835 # #sed -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib/salome'%g" $l > $l"_"
836 # mod=`basename $ldir | awk -F_ '{print $1}'`
837 # moddir=`printenv ${mod}_ROOT_DIR`
838 # sed -e "s%^libdir='[^[:space:]]*${mod}[^[:space:]]*/\(lib.*\)'%libdir='${moddir}/\1'%g" $l > $l"_"
841 # . process libxml dependencies
842 libxmldir=`printenv LIBXML_DIR`/lib
843 if [ ! -d ${libxmldir} ] ; then libxmldir=`printenv LIBXML_DIR`/lib ; fi
844 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*libxml2-[0-9]\.[0-9]\.[0-9]/lib% \1${libxmldir}%g" $l > $l"_"
846 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*libxml2/lib% \1${libxmldir}%g" $l > $l"_"
849 # . process metis dependencies
850 metisdir=`printenv METISDIR`
851 if [ ! -d ${metisdir} ] ; then metisdir=`printenv METISDIR` ; fi
852 sed -e "s%-L[^[:space:]]*metis[^[:space:]]*%-L${metisdir}%g" $l > $l"_"
855 # . process scotch dependencies
856 scotchdir=`printenv SCOTCHDIR`/bin
857 if [ ! -d ${scotchdir} ] ; then scotchdir=`printenv SCOTCHDIR`/bin ; fi
858 sed -e "s%-L[^[:space:]]*scotch[^[:space:]]*/bin%-L${scotchdir}%g" $l > $l"_"
860 scotchlib=`printenv SCOTCHDIR`/lib
861 if [ ! -d ${scotchlib} ] ; then scotchlib=`printenv SCOTCHDIR`/lib ; fi
862 sed -e "s%-L[^[:space:]]*scotch[^[:space:]]*/lib%-L${scotchlib}%g" $l > $l"_"
865 # . process libGL.la dependencies
866 if test `uname -m` = "x86_64" ; then
867 libGLpath=/usr/lib64/libGL.la
869 libGLpath=/usr/lib/libGL.la
871 sed -e "s%$libGLpath%""%g" $l > $l"_"
874 # . process graphviz dependencies
875 graphvizdir=`printenv GRAPHVIZHOME`/lib
876 if [ ! -d ${graphvizdir} ] ; then graphvizdir=`printenv GRAPHVIZHOME`/lib ; fi
877 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*graphviz-[0-9]\.[0-9]\+\.[0-9]/lib% \1${graphvizdir}%g" \
878 -e "s%[[:space:]]\(-L\)\?[^[:space:]]*graphviz/lib% \1${graphvizdir}%g" $l > $l"_"
879 chmod -f --reference=$l $l"_"
882 # . process QScintilla dependencies
883 qscintilladir=`printenv QSCINTILLA_DIR`/lib
884 if [ ! -d ${qscintilladir} ] ; then qscintilladir=`printenv QSCINTILLA_DIR`/lib ; fi
885 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*QScintilla-[0-9]\.[0-9]\(\.[0-9]\)\?/lib% \1${qscintilladir}%g" $l > $l"_"
886 chmod -f --reference=$l $l"_"
889 # . process expat-2.0.1 dependencies
890 expatdir=${EXPAT_ROOT}/lib
891 sed -e "s%-L[^[:space:]]*expat[^[:space:]]*/lib%-L${expatdir}%g" \
892 -e "s%[^[:space:]]*expat[^[:space:]]*/lib/libexpat.la%-lexpat%g" $l > $l"_"
893 chmod -f --reference=$l $l"_"
896 # . process ParaView dependencies
897 paraviewdir=`printenv PVHOME`/lib
898 if [ ! -d ${paraviewdir} ] ; then paraviewdir=`printenv PVHOME`/lib ; fi
899 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*ParaView-[0-9]\.[0-9]\+\.[0-9]/lib% \1${paraviewdir}%g" $l > $l"_"
900 chmod -f --reference=$l $l"_"