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-2007 CEA
11 # This script is the part of the SALOME installation procedure.
13 ####################################################################################
16 export SHRC="salome.sh"
17 export CSHRC="salome.csh"
20 #this function takes several parameters
21 #first parameter contains path to module source filder
22 #second parameters is value of $VERSION variables form MODULE.sh file
24 check_salome_src_version(){
25 root_dir=`printenv $1`
28 if [ -n "$root_dir" ]; then
30 if [ ! -f ${root_dir}/${cfg_file} ] ; then
31 cfg_file=configure.in.base
33 if [ -f ${root_dir}/${cfg_file} ] ; then
34 ver=`grep -e "^AC_INIT" ${root_dir}/${cfg_file} | sed -e "s%.*\[\([[:digit:].]*\)\].*%\1%g"`
35 if [ "$ver" = "${module_version}" ]; then
43 #this function takes several parameters
44 #first parameter contains descriptor of output file
45 #next parameters is command for execution
46 #in case of bad result of execution ask user about furher steps
47 #(user can cancel installation procedure)
53 if [ -n "$INSTALL_WORK" ] ; then errfile=$INSTALL_WORK/errlog; fi
55 if [ "$out" != "1" ] ; then cmd="$cmd >> $out" ; fi
57 if [ "$out" != "1" ] ; then
62 if [ "$?" -ne "0" ] ; then
63 if [ $out != "1" ] ; then
68 # VSR : 10/11/05: disable answer mode ==>
70 #echo -e "NOT DONE !!! => $*"
71 #echo -n "Would you like to continue to install this product: (Y,N) [Y] : "
73 #rep=`echo $rep | tr "[A-Z]" "[a-z]"`
74 #if test -z $rep || [ $rep = "y" ] ; then
77 # VSR : 10/11/05: disable answer mode <==
83 #invoke check_job function
84 #all output will be put into terminal
94 rm -rf "$1" > /dev/null
98 #create environment for sh and csh
101 install_root=$1; shift
104 for i in $SHRC $CSHRC ; do
105 if [ -e ${install_work}/$i ]; then
106 rm ${install_work}/$i
108 touch ${install_work}/$i
111 if [ $# -eq 4 ] ; then
113 product_env=${install_work}/env_${product_name}.sh
114 (test -e ${product_env} && rm ${product_env} )
116 ### !!! writing salome.sh file !!! -> define INSTALL_ROOT
117 cat >> ${install_work}/$SHRC <<EOF
118 #${DELIM} Setting products installation directory ${DELIM}
119 export INSTALL_ROOT=${install_root}
121 #${DELIM} Environment switch: 0 for SALOME building, 1 for SALOME launching ${DELIM}
122 export ENV_FOR_LAUNCH=1
125 ### !!! The next is for RedHat 9 only !!!
126 if [ -f /etc/redhat-release ] ; then
127 grep -e "Red Hat Linux release 9" /etc/redhat-release > /dev/null
128 if [ $? -eq 0 ] ; then
129 cat >> ${install_work}/$SHRC <<EOF
130 #${DELIM} Force RH9 to use old implementation of threads ${DELIM}
131 export LD_ASSUME_KERNEL=2.4.18
136 ### !!! writing salome.csh file !!! -> set inital variables
137 pre_vars="PATH LD_LIBRARY_PATH LD_RUN_PATH PYTHONPATH TCLLIBPATH"
138 for i in $pre_vars ; do
139 cat >> ${install_work}/$CSHRC <<EOF
140 #${DELIM} setting initial ${i} ${DELIM}
141 if (! (\$?${i}) ) then
148 ### !!! writing salome.(c)sh files !!! -> dump products environment files, changing 'export' by 'setenv(a|p)' where necessary
149 ### Note, that for performance reasons temporary environment files used during installation procedure itself
150 ### are created without using setenv(a|p) aliases.
152 # 0. add /usr/lib or /usr/lib64 dir to the LD_LIBRARY_PATH
153 #if test `uname -m` = "x86_64" ; then
154 #echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> ${install_work}/$SHRC 2>/dev/null
155 #echo '' >> ${install_work}/$SHRC 2>/dev/null
157 #echo 'export LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH}' >> ${install_work}/$SHRC 2>/dev/null
158 #echo '' >> ${install_work}/$SHRC 2>/dev/null
163 # Source of license environment file
165 echo '#------ License activation ------' >> ${install_work}/$SHRC 2>/dev/null
166 echo 'export LICENSE_FILE=/product/distene/dlim8.var.sh' >> ${install_work}/$SHRC 2>/dev/null
167 echo '' >> ${install_work}/$SHRC 2>/dev/null
168 echo 'if [ -e "${LICENSE_FILE}" ] ; then' >> ${install_work}/$SHRC 2>/dev/null
169 echo 'export SIMULOGD_LICENSE_FILE=29029@amun' >> ${install_work}/$SHRC 2>/dev/null
170 echo 'source ${LICENSE_FILE}' >> ${install_work}/$SHRC 2>/dev/null
171 echo 'fi' >> ${install_work}/$SHRC 2>/dev/null
172 echo '' >> ${install_work}/$SHRC 2>/dev/null
174 # 1. first dump all environment files into the $SHRC file
175 product_sequence="$2"
176 install_products="$3"
177 for i in $product_sequence ; do
178 env_file=${install_work}/env_${i}.sh
179 _env_file=${install_work}/_env_${i}.sh
180 if [ -e $_env_file ] ; then
181 cat $_env_file >> ${install_work}/$SHRC 2>/dev/null
182 elif [ -e $env_file ] ; then
183 echo $install_products | grep -q "\b${i}\b"
184 if [ $? -eq 1 ] ; then
185 cat $env_file | sed 's/^/## /' >> ${install_work}/$SHRC 2>/dev/null
187 cat $env_file >> ${install_work}/$SHRC 2>/dev/null
192 # 2. writing global functions to _salome.sh file
193 cat >> ${install_work}/_$SHRC <<EOF
194 ##########################################################################
195 # Functions exporta and exportp are used to append/prepend correspondingly
196 # one directory or a set of directories separated by semicolon symbol (':')
197 # to the environment variables like PATH, LD_LIBRARY_PATH, PYTHONPATH,
199 # The main purpose is to replace default setenv command behavior:
200 # exporta, exportp also remove duplicated entries, shortening in that way
201 # the environment variables.
202 # If some directory being added is already included into the variable
203 # nothing is done for it.
204 # Note, that these functions work some slower that setenv command itself.
207 # appends/prepends set of directories (second parameter)
208 # to the another set of directories (first parameter) and
209 # removes duplicated entries;
210 # the third parameter defines the mode: 0 - append, 1 - prepend
212 out_var=\`echo \$1 \$2 | awk -v dir=\$3 '{ \\
213 na = split(\$2,a,":"); \\
217 if(\$1 != "<empty>") { \\
218 nb = split(\$1,b,":"); \\
219 for(i=1;i<=nb;i++) { \\
220 if(!(b[i] in ccc) ) { \\
228 for(i=1;i<=na;i++) { \\
229 if(!(a[i] in ccc)) { \\
236 for(i=1;i<k2;i++) { \\
239 for(i=1;i<k1;i++) { \\
244 for(i=1;i<k1;i++) { \\
247 for(i=1;i<k2;i++) { \\
251 }' | sed -e 's/\(.*\):/\1/g'\`
255 # appends directory or set of directories, separated by ':' (second parameter)
256 # to the variable (first parameter)
258 xenv=\`printenv \$1\`
259 if [ -z "\$xenv" ]; then xenv="<empty>"; fi
260 out_var=\`cleandup \$xenv \$2 0\`
264 # prepends directory or set of directories, separated by ':' (second parameter)
265 # to the variable (first parameter)
267 xenv=\`printenv \$1\`
268 if [ -z "\$xenv" ]; then xenv="<empty>"; fi
269 out_var=\`cleandup \$xenv \$2 1\`
272 ###########################################################################
276 # 3. writing global functions to _salome.csh file
277 cat >> ${install_work}/_$CSHRC <<EOF
279 ###########################################################################
280 # Aliases setenva and setenvp are used to append/prepend correspondingly
281 # one directory or a set of directories separated by semicolon symbol (':')
282 # to the environment variables like PATH, LD_LIBRARY_PATH, PYTHONPATH,
284 # The main purpose is to replace default setenv command behavior:
285 # setenva, setenvp also remove duplicated entries, shortening in that way
286 # the environment variables.
287 # If some directory being added is already included into the variable
288 # nothing is done for it.
289 # Note, that these aliases work some slower that setenv command itself.
292 # appends/prepends set of directories (second parameter)
293 # to the another set of directories (first parameter) and
294 # removes duplicated entries;
295 # the third parameter defines the mode: 0 - append, 1 - prepend
296 alias cleandup "echo \!:1 \!:2 | awk -v dir=\!:3 \\\\
297 '"'{ na = split(\$2,a,":"); \\\\
301 if(\$1 != "<empty>") { \\\\
302 nb = split(\$1,b,":"); \\\\
303 for(i=1;i<=nb;i++) { \\\\
304 if(!(b[i] in ccc) ) { \\\\
312 for(i=1;i<=na;i++) { \\\\
313 if(!(a[i] in ccc)) { \\\\
320 for(i=1;i<k2;i++) { \\\\
323 for(i=1;i<k1;i++) { \\\\
328 for(i=1;i<k1;i++) { \\\\
331 for(i=1;i<k2;i++) { \\\\
335 }'"' | sed -e 's/\(.*\):/\1/g'"
337 # appends directory or set of directories, separated by ':' (second parameter)
338 # to the variable (first parameter)
339 alias setenva 'set a=\!:1 ; set b=\!:2 ; \\
340 set c=\`printenv \$a\` ; \\
341 set b=\`cleandup \$c \$b 0\` ; \\
346 # prepends directory or set of directories, separated by ':' (second parameter)
347 # to the variable (first parameter)
348 alias setenvp 'set a=\!:1 ; set b=\!:2 ; \\
349 set c=\`printenv \$a\` ; \\
350 set b=\`cleandup \$c \$b 1\` ; \\
353 ###########################################################################
356 cat ${install_work}/$CSHRC >> ${install_work}/_$CSHRC
358 # 4. put the contents of salome.sh to _salome.sh replacing export by export(a|p) aliases where necessary
359 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
360 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
361 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
362 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
364 # Setting "/usr/X11R6/lib" path in LD_LIBRARY_PATH for the libGL.so.1 file
365 #if test `uname -m` = "x86_64" ; then
366 #echo '# Setting /usr/X11R6/lib64 path in LD_LIBRARY_PATH for the libGL.so.1 file' >> ${INSTALL_WORK}/_tmp2
367 #echo 'export LD_LIBRARY_PATH=/usr/X11R6/lib64:${LD_LIBRARY_PATH}' >> ${INSTALL_WORK}/_tmp2
369 #echo '# Setting /usr/X11R6/lib path in LD_LIBRARY_PATH for the libGL.so.1 file' >> ${INSTALL_WORK}/_tmp2
370 #echo 'export LD_LIBRARY_PATH=/usr/X11R6/lib:${LD_LIBRARY_PATH}' >> ${INSTALL_WORK}/_tmp2
373 cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/_$SHRC
375 # 5. Create a salome.csh file from salome.sh by replacing export by setenv, etc.
376 sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${install_work}/$SHRC > ${INSTALL_WORK}/_tmp1 2>/dev/null
377 cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/$CSHRC
379 # 6. Create a _salome.csh file from _salome.sh by replacing export by setenv, exporta by setenva, etc.
380 sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
381 sed -e 's%exporta \([[:alnum:]_[:blank:]]*\)%setenva \1%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
382 sed -e 's%exportp \([[:alnum:]_[:blank:]]*\)%setenvp \1%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
383 sed -e 's%if \[ -n "\${PYTHONPATH}" \] ; then%if ( ${?PYTHONPATH} ) then%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
384 sed -e 's%if \[ -n "\${ENV_FOR_LAUNCH}" \] ; then%if ( ${?ENV_FOR_LAUNCH} ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
385 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
386 sed -e 's%^\([[:blank:]]*\)fi\([[:blank:]]*\)$%\1endif\2%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
387 sed -e 's%var.sh%var.csh%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
388 sed -e 's%if \[ -e "\${LICENSE_FILE}" \] ; then%if ( -e ${LICENSE_FILE} ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
390 cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/_$CSHRC 2>/dev/null
392 rm -f ${INSTALL_WORK}/_tmp1 ${INSTALL_WORK}/_tmp2
394 if [ $# -eq 5 ] ; then
396 if [ -e ${product_dir} ] ; then
397 test -e ${product_dir}/$SHRC && mv ${product_dir}/$SHRC ${product_dir}/${SHRC}_`date +%F_%T`
398 cp ${install_work}/_$SHRC ${product_dir}/$SHRC
399 test -e ${product_dir}/$CSHRC && mv ${product_dir}/$CSHRC ${product_dir}/${CSHRC}_`date +%F_%T`
400 cp ${install_work}/_$CSHRC ${product_dir}/$CSHRC
403 sed -e 's%setenv ENV_FOR_LAUNCH 1%setenv ENV_FOR_LAUNCH 0%' ${install_work}/_$CSHRC > ${install_root}/env_build.csh
404 sed -e 's%export ENV_FOR_LAUNCH=1%export ENV_FOR_LAUNCH=0%' ${install_work}/_$SHRC > ${install_root}/env_build.sh
406 cp -f ${install_work}/_$CSHRC ${install_root}/env_products.csh
407 cp -f ${install_work}/_$SHRC ${install_root}/env_products.sh
409 rm -f ${install_work}/_$SHRC ${install_work}/_$CSHRC
410 ### !!! copying build.csh and build.sh scripts
411 if [ -e ./build.csh ]; then
412 cp -f ./build.csh ${install_root}
414 if [ -e ./build.sh ]; then
415 cp -f ./build.sh ${install_root}
417 ### !!! copying release notes
418 for p in `ls ../` ; do
419 export pdf=`echo ${p} | sed s/[.]/" "/g | awk '{print $2}'`
420 if [ "${pdf}" = "pdf" ]; then
422 if [ ! -e ${install_root}/${RN} ]; then
423 cp -f ../${RN} ${install_root}
430 #try use already existing product
433 product_dir=$1; install_root=$2; install_work=$3;
434 product_sequence="$4"; installed_products="$5"; product_type=$6
435 env_file=${product_dir}/env_${product_type}.sh
436 if [ -f ${env_file} ] ; then
437 cp -f ${env_file} ${install_work}/_env_${product_type}.sh
438 make_env ${install_root} ${install_work} "${product_sequence}" "${installed_products}"
439 source ${install_work}/$SHRC
441 if [ $? -eq 0 ] ; then
445 echo ${product_type} | grep -q '_src$'
446 if [ $? -eq 1 ] ; then
454 #check existance of lib passed as first parameter
455 #return 0 if lib exists
456 #if you pass second parameter search will be done in it
457 #otherwise search will be done in $LD_LIBRARY_PATH
458 #you should use : as dilimeter if you are going to pass second parameter
463 whereIs=$LD_LIBRARY_PATH
465 for L in `echo ${whereIs} | sed -e"s%:% %g"` ; do
466 ret=`find $L -name $1 2>/dev/null`
467 if [ -n "$ret" ] ; then
468 #echo "The $1 exists on yours system in a $L folder"
478 for i in `echo ${path} | sed -e"s%:% %g"` ; do
479 ret=`find $i -name $file -maxdepth 1 2>/dev/null`
480 if [ -n "$ret" ] ; then
481 ret=`echo $ret | sed -e"s%/\$file$%%g"`
490 arg1=$1; val1=$2; arg2=$3; val2=$4
491 tmp="^$val1$|^$val1:|:$val1$|:$val1:"
492 #echo $val2 | grep -E "$tmp" >/dev/null 2>&1
493 #if [ $? -eq 0 ] ; then
498 exclude_list="usr lib bin sbin etc"
499 for i in ${exclude_list} ; do
501 echo ${val1} | grep -E "$tmp" >/dev/null 2>&1
502 if [ $? == 0 ] ; then to_tail=0; break; fi
504 if [ $to_tail -eq 0 ] ; then
513 maj_ver=`echo $1 | awk -F. '{if(NF>0) print $1; else print 0}'`
514 min_ver=`echo $1 | awk -F. '{if(NF>1) print $2; else print 0}'`
515 rel_ver=`echo $1 | awk -F. '{if(NF>2) print $3; else print 0}'`
516 let ver=$maj_ver*10000+$min_ver*100+$rel_ver
519 for i in `echo ${PATH}:/usr/bin:/usr/local/bin | sed -e"s%:% %g"` ; do
520 ret=`find $i -name gcc -maxdepth 1 2>/dev/null`
521 if [ -n "$ret" ] ; then
522 maj_ver=`$ret -dumpversion | awk -F. '{if(NF>0) print $1; else print 0}'`
523 min_ver=`$ret -dumpversion | awk -F. '{if(NF>1) print $2; else print 0}'`
524 rel_ver=`$ret -dumpversion | awk -F. '{if(NF>2) print $3; else print 0}'`
525 let ver1=$maj_ver*10000+$min_ver*100+$rel_ver
526 if [ $ver1 -eq $ver ] ; then
527 ret=`echo $ret | sed -e"s%/gcc$%%g"`
531 if [ $ver1 -gt $ver ] && [ $ver1 -gt $newerver ] ; then
533 newer=`echo $ret | sed -e"s%/gcc$%%g"`
537 if [ -n "$newer" ] ; then
545 if test -z "${TCLHOME}"; then
548 tclcfg=`find ${TCLHOME}/lib -name "tclConfig.sh" 2> /dev/null`
552 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;}'`
553 if [ $maxver -lt $ver ]; then
558 if test -n "$file"; then
568 if test -z "${TCLHOME}"; then
571 tclcfg=`find ${TCLHOME}/lib -name "tkConfig.sh" 2> /dev/null`
575 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;}'`
576 if [ $maxver -lt $ver ]; then
581 if test -n "$file"; then
591 if test -f /usr/X11R6/include/DPS/dpsconfig.h ; then
595 if test -f /usr/include/DPS/dpsconfig.h ; then
604 for d in /usr/X11R6/include /usr/include ; do
605 if [ -d ${d}/GL ] && [ -f ${d}/GL/gl.h ] ; then
615 # search libGL.so* file and correct libGL.la in the same directory
616 for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
617 if [ "`ls ${d}/libGL.so* 2>/dev/null`" ] && [ -f ${d}/libGL.la ]; then
618 libdir=`grep "libdir=" ${d}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%" -e "s%/*$%%g"`
619 if [ "$libdir" == "$d" ] ; then
625 # search libGL.la file and check if this file is correct
626 for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
627 if [ -f ${d}/libGL.la ] ; then
628 libdir=`grep "libdir=" ${d}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"`
629 if [ "`ls $libdir/libGL.so* 2>/dev/null`" ] ; then
635 # then search libGL.so* file
636 for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
637 if [ "`ls ${d}/libGL.so* 2>/dev/null`" ] ; then
648 if [ -z "$ldir" ] || [ ! -d "$ldir" ]; then return 1; fi
652 #SALOME_MODULES="`env | awk -F_ '/[[:alnum:]]*_ROOT_DIR/ { print $1 }'`"
653 SALOME_MODULES="`env | awk -F_ '/[a-zA-Z0-9]*_ROOT_DIR/ { print $1 }'`"
657 la_files=`find . -name "*.la"`
659 for l in X ${la_files}; do
660 if [ "$l" != "X" ] ; then
664 # 1. process salome modules dependencies
666 for mod in $SALOME_MODULES; do
667 moddir=`printenv ${mod}_ROOT_DIR`
668 if [ -n "${moddir}" ] ; then
669 #echo $l $mod $moddir
670 # sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[^[:space:]/]*/\(lib\|lib64\)% \1${moddir}/${myldir}%g" $l > $l"_"
671 # sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[^[:space:]/]*/lib% \1${moddir}/lib%g" $l > $l"_"
672 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[^[:space:]/]*/lib% \1${moddir}/lib%g" \
673 -e "s%^libdir='[^[:space:]]*${mod}[^[:space:]]*/\(lib.*\)'%libdir='${moddir}/\1'%g" $l > $l"_"
675 for mod1 in $SALOME_MODULES; do
676 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod1}[^[:space:]]*/${mod1}_build%%g" $l > $l"_"
682 # 2. process CAS.CADE dependencies
683 casdir=`printenv CASROOT`/lib
684 if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/Linux/lib ; fi
685 if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/lin/lib ; fi
686 if [ -n "${CASROOT}" ] && [ -d "${casdir}" ] ; then
687 # echo $l $CASROOT $casdir
688 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/Linux/lib% \1${casdir}%g" \
689 -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/lin/lib% \1${casdir}%g" \
690 -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/lib% \1${casdir}%g" $l > $l"_"
693 # 3. process omniORB dependencies
694 omnidir=`printenv OMNIORBDIR`/lib/i586_linux_2.0_glibc2.1
695 if [ ! -d ${omnidir} ] ; then omnidir=`printenv OMNIORBDIR`/lib ; fi
696 if [ -n "${OMNIORBDIR}" ] && [ -d "${omnidir}" ] ; then
697 # echo $l $OMNIORBDIR $omnidir
698 sed -e "s%-L[^[:space:]]*omni[^[:space:]]*%-L${omnidir}%g" \
699 -e "s%-R[^[:space:]]*omni[^[:space:]]*%-R${omnidir}%g" $l > $l"_"
702 # 4. process VTK dependencies
703 if test `uname -m` = "x86_64" ; then
704 vtkdir=`printenv VTKHOME`/lib64/vtk-5.0
705 vtkldir=`printenv VTKHOME`/lib64
707 vtkdir=`printenv VTKHOME`/lib/vtk-5.0
708 vtkldir=`printenv VTKHOME`/lib
710 if [ -n "${VTKHOME}" ] && [ -d "${vtkdir}" ] && [ -d "${vtkldir}" ] ; then
711 # echo $l $VTKHOME $vtkdir
712 sed -e "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)/vtk\-5\.0%-L${vtkdir}%g" \
713 -e "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)%-L${vtkldir}%g" $l > $l"_"
716 # 5. process HDF dependencies
717 hdfdir=`printenv HDF5HOME`/lib
718 if [ -n "${HDF5HOME}" ] && [ -d "${hdfdir}" ] ; then
719 # echo $l $HDF5HOME $hdfdir
720 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*hdf[^[:space:]/]*/lib% \1${hdfdir}%g" $l > $l"_"
723 # 6. process MED dependencies
724 meddir=`printenv MED2HOME`/lib
725 if [ -n "${MED2HOME}" ] && [ -d "${meddir}" ] ; then
726 # echo $l $MED2HOME $meddir
727 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*med[^[:space:]/]*/lib% \1${meddir}%g" $l > $l"_"
730 # 7. process qwt dependencies
731 qwtdir=`find_in_path libqwt.so ${LD_LIBRARY_PATH}`
732 if [ -n "${qwtdir}" ] && [ -d "${qwtdir}" ] ; then
734 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*qwt[^[:space:]/]*/lib% \1${qwtdir}%g" $l > $l"_"
737 # 8. process qt dependencies
738 qtdir=`printenv QTDIR`/lib
739 if [ -n "${QTDIR}" ] && [ -d "${qtdir}" ] ; then
740 # echo $l $QTDIR $qtdir
741 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*qt[^[:space:]/]*/lib% \1${qtdir}%g" $l > $l"_"
744 # 9. process python dependencies
745 where_python=`which python` # e.g. /usr/bin/python
746 if [ -n "$where_python" ] ; then
747 where_python=`dirname $where_python` # --> /usr/bin
748 where_python=`dirname $where_python` # --> /usr
749 python_version=`python -c "import sys; print sys.version[:3]"`
750 # echo $l $where_python $python_version
751 sed -e "s%-L[^[:space:]]*python[0-9]\.[0-9]\([^[:space:]]*\)%-L${where_python}/lib/python${python_version}\1%g" $l > $l"_"
754 # 10. process sip dependencies
755 sipdir=`find_in_path sip.so ${LD_LIBRARY_PATH}`
756 if [ -n "${sipdir}" ] && [ -d "${sipdir}" ] ; then
758 sed -e "s%-L[^[:space:]]*sip[^[:space:]]*%-L${sipdir}%g" $l > $l"_"
761 # 11. process PyQt dependencies
762 pyqtdir=`find_in_path qt.so ${LD_LIBRARY_PATH}`
763 if [ -n "${pyqtdir}" ] && [ -d "${pyqtdir}" ] ; then
765 sed -e "s%-L[^[:space:]]*PyQt[^[:space:]]*%-L${pyqtdir}%g" $l > $l"_"
768 # 12. process tcl/tk dependencies
769 tcldir=`printenv TCLHOME`/lib
770 if [ -n "${tcldir}" ] && [ -d "${tcldir}" ] ; then
771 # echo $l $TCLHOME $tcldir
772 sed -e "s%-L[^[:space:]]*tcltk[^[:space:]]*/lib%-L${tcldir}%g" $l > $l"_"
775 # 13. process boost dependencies
776 boostdir=`printenv BOOSTDIR`/lib
777 if [ -n "${boostdir}" ] && [ -d "${boostdir}" ] ; then
778 # echo $l $BOOSTDIR $boostdir
779 sed -e "s%-L[^[:space:]]*boost[^[:space:]]*/lib%-L${boostdir}%g" $l > $l"_"
783 blsurfdir=`printenv BLSURFHOME`/lib
784 if [ -n "${blsurfdir}" ] && [ -d "${blsurfdir}" ] ; then
785 # echo $l $BOOSTDIR $boostdir
786 sed -e "s%-L[^[:space:]]*blsurf[^[:space:]]*/lib%-L${blsurfdir}%g" $l > $l"_"
790 # # 14. modify libdir
791 # #sed -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib/salome'%g" $l > $l"_"
792 # mod=`basename $ldir | awk -F_ '{print $1}'`
793 # moddir=`printenv ${mod}_ROOT_DIR`
794 # sed -e "s%^libdir='[^[:space:]]*${mod}[^[:space:]]*/\(lib.*\)'%libdir='${moddir}/\1'%g" $l > $l"_"
797 # 15. process libxml dependencies
798 libxmldir=`printenv LIBXML_DIR`/lib
799 if [ ! -d ${libxmldir} ] ; then libxmldir=`printenv LIBXML_DIR`/lib ; fi
800 sed -e "s%\(.*\)\([[:space:]].*/lib/libxml2.la[[:space:]]\)\(.*\)%\1 ${libxmldir}/libxml2.la \3%g" \
801 -e "s%-L[^[:space:]]*libxml2[^[:space:]]*/lib%-L${libxmldir}%g" $l > $l"_"
804 # 16. process metis dependencies
805 metisdir=`printenv METISDIR`
806 if [ ! -d ${metisdir} ] ; then metisdir=`printenv METISDIR` ; fi
807 sed -e "s%-L[^[:space:]]*metis[^[:space:]]*%-L${metisdir}%g" $l > $l"_"
810 # 17. process scotch dependencies
811 scotchdir=`printenv SCOTCHDIR`/bin
812 if [ ! -d ${scotchdir} ] ; then scotchdir=`printenv SCOTCHDIR`/bin ; fi
813 sed -e "s%-L[^[:space:]]*scotch[^[:space:]]*/bin%-L${scotchdir}%g" $l > $l"_"
816 # 18. process libGL.la dependencies
817 if test `uname -m` = "x86_64" ; then
818 libGLpath=/usr/lib64/libGL.la
820 libGLpath=/usr/lib/libGL.la
822 sed -e "s%$libGLpath%""%g" $l > $l"_"
825 # 19. process graphviz dependencies
826 graphvizdir=`printenv GRAPHVIZHOME`
827 if [ -n "${graphvizdir}" ] && [ -d "${graphvizdir}" ] ; then
828 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*graphviz-[0-9]\+\.[0-9]\+\.[0-9]\+% \1${graphvizdir}%g" $l > $l"_"
829 chmod -f --reference=$l $l"_"