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"
19 #this function takes several parameters
20 #first parameter contains descriptor of output file
21 #next parameters is command for execution
22 #in case of bad result of execution ask user about furher steps
23 #(user can cancel installation procedure)
29 if [ -n "$INSTALL_WORK" ] ; then errfile=$INSTALL_WORK/errlog; fi
31 if [ "$out" != "1" ] ; then cmd="$cmd >> $out" ; fi
33 if [ "$out" != "1" ] ; then
38 if [ "$?" -ne "0" ] ; then
39 if [ $out != "1" ] ; then
44 # VSR : 10/11/05: disable answer mode ==>
46 #echo -e "NOT DONE !!! => $*"
47 #echo -n "Would you like to continue to install this product: (Y,N) [Y] : "
49 #rep=`echo $rep | tr "[A-Z]" "[a-z]"`
50 #if test -z $rep || [ $rep = "y" ] ; then
53 # VSR : 10/11/05: disable answer mode <==
59 #invoke check_job function
60 #all output will be put into terminal
70 rm -rf "$1" > /dev/null
74 #create environment for sh and csh
77 install_root=$1; shift
80 for i in $SHRC $CSHRC ; do
81 if [ -e ${install_work}/$i ]; then
84 touch ${install_work}/$i
87 if [ $# -eq 4 ] ; then
89 product_env=${install_work}/env_${product_name}.sh
90 (test -e ${product_env} && rm ${product_env} )
92 ### !!! writing salome.sh file !!! -> define INSTALL_ROOT
93 cat >> ${install_work}/$SHRC <<EOF
94 #${DELIM} Setting products installation directory ${DELIM}
95 export INSTALL_ROOT=${install_root}
97 #${DELIM} Environment switch: 0 for SALOME building, 1 for SALOME launching ${DELIM}
98 export ENV_FOR_LAUNCH=1
101 ### !!! The next is for RedHat 9 only !!!
102 if [ -f /etc/redhat-release ] ; then
103 grep -e "Red Hat Linux release 9" /etc/redhat-release > /dev/null
104 if [ $? -eq 0 ] ; then
105 cat >> ${install_work}/$SHRC <<EOF
106 #${DELIM} Force RH9 to use old implementation of threads ${DELIM}
107 export LD_ASSUME_KERNEL=2.4.18
112 ### !!! writing salome.csh file !!! -> set inital variables
113 pre_vars="PATH LD_LIBRARY_PATH LD_RUN_PATH PYTHONPATH TCLLIBPATH"
114 for i in $pre_vars ; do
115 cat >> ${install_work}/$CSHRC <<EOF
116 #${DELIM} setting initial ${i} ${DELIM}
117 if (! (\$?${i}) ) then
124 ### !!! writing salome.(c)sh files !!! -> dump products environment files, changing 'export' by 'setenv(a|p)' where necessary
125 ### Note, that for performance reasons temporary environment files used during installation procedure itself
126 ### are created without using setenv(a|p) aliases.
128 # 0. add /usr/lib or /usr/lib64 dir to the LD_LIBRARY_PATH
129 if test `uname -m` = "x86_64" ; then
130 echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> ${install_work}/$SHRC 2>/dev/null
131 echo '' >> ${install_work}/$SHRC 2>/dev/null
133 echo 'export LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH}' >> ${install_work}/$SHRC 2>/dev/null
134 echo '' >> ${install_work}/$SHRC 2>/dev/null
137 # 1. first dump all environment files into the $SHRC file
138 product_sequence="$2"
139 install_products="$3"
140 for i in $product_sequence ; do
141 env_file=${install_work}/env_${i}.sh
142 _env_file=${install_work}/_env_${i}.sh
143 if [ -e $_env_file ] ; then
144 cat $_env_file >> ${install_work}/$SHRC 2>/dev/null
145 elif [ -e $env_file ] ; then
146 echo $install_products | grep -q "\b${i}\b"
147 if [ $? -eq 1 ] ; then
148 cat $env_file | sed 's/^/## /' >> ${install_work}/$SHRC 2>/dev/null
150 cat $env_file >> ${install_work}/$SHRC 2>/dev/null
155 # 2. writing global functions to _salome.sh file
156 cat >> ${install_work}/_$SHRC <<EOF
157 ##########################################################################
158 # Functions exporta and exportp are used to append/prepend correspondingly
159 # one directory or a set of directories separated by semicolon symbol (':')
160 # to the environment variables like PATH, LD_LIBRARY_PATH, PYTHONPATH,
162 # The main purpose is to replace default setenv command behavior:
163 # exporta, exportp also remove duplicated entries, shortening in that way
164 # the environment variables.
165 # If some directory being added is already included into the variable
166 # nothing is done for it.
167 # Note, that these functions work some slower that setenv command itself.
170 # appends/prepends set of directories (second parameter)
171 # to the another set of directories (first parameter) and
172 # removes duplicated entries;
173 # the third parameter defines the mode: 0 - append, 1 - prepend
175 out_var=\`echo \$1 \$2 | awk -v dir=\$3 '{ \\
176 na = split(\$2,a,":"); \\
180 if(\$1 != "<empty>") { \\
181 nb = split(\$1,b,":"); \\
182 for(i=1;i<=nb;i++) { \\
183 if(!(b[i] in ccc) ) { \\
191 for(i=1;i<=na;i++) { \\
192 if(!(a[i] in ccc)) { \\
199 for(i=1;i<k2;i++) { \\
202 for(i=1;i<k1;i++) { \\
207 for(i=1;i<k1;i++) { \\
210 for(i=1;i<k2;i++) { \\
214 }' | sed -e 's/\(.*\):/\1/g'\`
218 # appends directory or set of directories, separated by ':' (second parameter)
219 # to the variable (first parameter)
221 xenv=\`printenv \$1\`
222 if [ -z "\$xenv" ]; then xenv="<empty>"; fi
223 out_var=\`cleandup \$xenv \$2 0\`
227 # prepends directory or set of directories, separated by ':' (second parameter)
228 # to the variable (first parameter)
230 xenv=\`printenv \$1\`
231 if [ -z "\$xenv" ]; then xenv="<empty>"; fi
232 out_var=\`cleandup \$xenv \$2 1\`
235 ###########################################################################
239 # 3. writing global functions to _salome.csh file
240 cat >> ${install_work}/_$CSHRC <<EOF
242 ###########################################################################
243 # Aliases setenva and setenvp are used to append/prepend correspondingly
244 # one directory or a set of directories separated by semicolon symbol (':')
245 # to the environment variables like PATH, LD_LIBRARY_PATH, PYTHONPATH,
247 # The main purpose is to replace default setenv command behavior:
248 # setenva, setenvp also remove duplicated entries, shortening in that way
249 # the environment variables.
250 # If some directory being added is already included into the variable
251 # nothing is done for it.
252 # Note, that these aliases work some slower that setenv command itself.
255 # appends/prepends set of directories (second parameter)
256 # to the another set of directories (first parameter) and
257 # removes duplicated entries;
258 # the third parameter defines the mode: 0 - append, 1 - prepend
259 alias cleandup "echo \!:1 \!:2 | awk -v dir=\!:3 \\\\
260 '"'{ na = split(\$2,a,":"); \\\\
264 if(\$1 != "<empty>") { \\\\
265 nb = split(\$1,b,":"); \\\\
266 for(i=1;i<=nb;i++) { \\\\
267 if(!(b[i] in ccc) ) { \\\\
275 for(i=1;i<=na;i++) { \\\\
276 if(!(a[i] in ccc)) { \\\\
283 for(i=1;i<k2;i++) { \\\\
286 for(i=1;i<k1;i++) { \\\\
291 for(i=1;i<k1;i++) { \\\\
294 for(i=1;i<k2;i++) { \\\\
298 }'"' | sed -e 's/\(.*\):/\1/g'"
300 # appends directory or set of directories, separated by ':' (second parameter)
301 # to the variable (first parameter)
302 alias setenva 'set a=\!:1 ; set b=\!:2 ; \\
303 set c=\`printenv \$a\` ; \\
304 set b=\`cleandup \$c \$b 0\` ; \\
309 # prepends directory or set of directories, separated by ':' (second parameter)
310 # to the variable (first parameter)
311 alias setenvp 'set a=\!:1 ; set b=\!:2 ; \\
312 set c=\`printenv \$a\` ; \\
313 set b=\`cleandup \$c \$b 1\` ; \\
316 ###########################################################################
319 cat ${install_work}/$CSHRC >> ${install_work}/_$CSHRC
321 # 4. put the contents of salome.sh to _salome.sh replacing export by export(a|p) aliases where necessary
322 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
323 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
324 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
325 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
327 # Setting "/usr/X11R6/lib" path in LD_LIBRARY_PATH for the libGL.so.1 file
328 if test `uname -m` = "x86_64" ; then
329 echo '# Setting /usr/X11R6/lib64 path in LD_LIBRARY_PATH for the libGL.so.1 file' >> ${INSTALL_WORK}/_tmp2
330 echo 'export LD_LIBRARY_PATH=/usr/X11R6/lib64:${LD_LIBRARY_PATH}' >> ${INSTALL_WORK}/_tmp2
332 echo '# Setting /usr/X11R6/lib path in LD_LIBRARY_PATH for the libGL.so.1 file' >> ${INSTALL_WORK}/_tmp2
333 echo 'export LD_LIBRARY_PATH=/usr/X11R6/lib:${LD_LIBRARY_PATH}' >> ${INSTALL_WORK}/_tmp2
336 cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/_$SHRC
338 # 5. Create a salome.csh file from salome.sh by replacing export by setenv, etc.
339 sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${install_work}/$SHRC > ${INSTALL_WORK}/_tmp1 2>/dev/null
340 cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/$CSHRC
342 # 6. Create a _salome.csh file from _salome.sh by replacing export by setenv, exporta by setenva, etc.
343 sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
344 sed -e 's%exporta \([[:alnum:]_[:blank:]]*\)%setenva \1%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
345 sed -e 's%exportp \([[:alnum:]_[:blank:]]*\)%setenvp \1%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
346 sed -e 's%if \[ -n "\${ENV_FOR_LAUNCH}" \] ; then%if ( ${?ENV_FOR_LAUNCH} ) then%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
347 sed -e 's%if \[ "\${ENV_FOR_LAUNCH}" == "1" \] ; then%if ( "\${ENV_FOR_LAUNCH}" == "1" ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
348 sed -e 's%^\([[:blank:]]*\)fi\([[:blank:]]*\)$%\1endif\2%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
349 cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/_$CSHRC 2>/dev/null
351 rm -f ${INSTALL_WORK}/_tmp1 ${INSTALL_WORK}/_tmp2
353 if [ $# -eq 5 ] ; then
355 if [ -e ${product_dir} ] ; then
356 test -e ${product_dir}/$SHRC && mv ${product_dir}/$SHRC ${product_dir}/${SHRC}_`date +%F_%T`
357 cp ${install_work}/_$SHRC ${product_dir}/$SHRC
358 test -e ${product_dir}/$CSHRC && mv ${product_dir}/$CSHRC ${product_dir}/${CSHRC}_`date +%F_%T`
359 cp ${install_work}/_$CSHRC ${product_dir}/$CSHRC
362 sed -e 's%setenv ENV_FOR_LAUNCH 1%setenv ENV_FOR_LAUNCH 0%' ${install_work}/_$CSHRC > ${install_root}/env_build.csh
363 sed -e 's%export ENV_FOR_LAUNCH=1%export ENV_FOR_LAUNCH=0%' ${install_work}/_$SHRC > ${install_root}/env_build.sh
365 cp -f ${install_work}/_$CSHRC ${install_root}/env_products.csh
366 cp -f ${install_work}/_$SHRC ${install_root}/env_products.sh
368 rm -f ${install_work}/_$SHRC ${install_work}/_$CSHRC
369 ### !!! copying build.csh and build.sh scripts
370 if [ -e ./build.csh ]; then
371 cp -f ./build.csh ${install_root}
373 if [ -e ./build.sh ]; then
374 cp -f ./build.sh ${install_root}
376 ### !!! copying release notes
377 for p in `ls ../` ; do
378 export pdf=`echo ${p} | sed s/[.]/" "/g | awk '{print $2}'`
379 if [ "${pdf}" = "pdf" ]; then
381 if [ ! -e ${install_root}/${RN} ]; then
382 cp -f ../${RN} ${install_root}
389 #try use already existing product
392 product_dir=$1; install_root=$2; install_work=$3;
393 product_sequence="$4"; installed_products="$5"; product_type=$6
394 env_file=${product_dir}/env_${product_type}.sh
395 if [ -f ${env_file} ] ; then
396 cp -f ${env_file} ${install_work}/_env_${product_type}.sh
397 make_env ${install_root} ${install_work} "${product_sequence}" "${installed_products}"
398 source ${install_work}/$SHRC
400 if [ $? -eq 0 ] ; then
404 echo ${product_type} | grep -q '_src$'
405 if [ $? -eq 1 ] ; then
413 #check existance of lib passed as first parameter
414 #return 0 if lib exists
415 #if you pass second parameter search will be done in it
416 #otherwise search will be done in $LD_LIBRARY_PATH
417 #you should use : as dilimeter if you are going to pass second parameter
422 whereIs=$LD_LIBRARY_PATH
424 for L in `echo ${whereIs} | sed -e"s%:% %g"` ; do
425 ret=`find $L -name $1 2>/dev/null`
426 if [ -n "$ret" ] ; then
427 #echo "The $1 exists on yours system in a $L folder"
437 for i in `echo ${path} | sed -e"s%:% %g"` ; do
438 ret=`find $i -name $file -maxdepth 1 2>/dev/null`
439 if [ -n "$ret" ] ; then
440 ret=`echo $ret | sed -e"s%/\$file$%%g"`
449 arg1=$1; val1=$2; arg2=$3; val2=$4
450 tmp="^$val1$|^$val1:|:$val1$|:$val1:"
451 #echo $val2 | grep -E "$tmp" >/dev/null 2>&1
452 #if [ $? -eq 0 ] ; then
457 exclude_list="usr lib bin sbin etc"
458 for i in ${exclude_list} ; do
460 echo ${val1} | grep -E "$tmp" >/dev/null 2>&1
461 if [ $? == 0 ] ; then to_tail=0; break; fi
463 if [ $to_tail -eq 0 ] ; then
472 maj_ver=`echo $1 | awk -F. '{if(NF>0) print $1; else print 0}'`
473 min_ver=`echo $1 | awk -F. '{if(NF>1) print $2; else print 0}'`
474 rel_ver=`echo $1 | awk -F. '{if(NF>2) print $3; else print 0}'`
475 let ver=$maj_ver*10000+$min_ver*100+$rel_ver
478 for i in `echo ${PATH}:/usr/bin:/usr/local/bin | sed -e"s%:% %g"` ; do
479 ret=`find $i -name gcc -maxdepth 1 2>/dev/null`
480 if [ -n "$ret" ] ; then
481 maj_ver=`$ret -dumpversion | awk -F. '{if(NF>0) print $1; else print 0}'`
482 min_ver=`$ret -dumpversion | awk -F. '{if(NF>1) print $2; else print 0}'`
483 rel_ver=`$ret -dumpversion | awk -F. '{if(NF>2) print $3; else print 0}'`
484 let ver1=$maj_ver*10000+$min_ver*100+$rel_ver
485 if [ $ver1 -eq $ver ] ; then
486 ret=`echo $ret | sed -e"s%/gcc$%%g"`
490 if [ $ver1 -gt $ver ] && [ $ver1 -gt $newerver ] ; then
492 newer=`echo $ret | sed -e"s%/gcc$%%g"`
496 if [ -n "$newer" ] ; then
504 if test -z "${TCLHOME}"; then
507 tclcfg=`find ${TCLHOME}/lib -name "tclConfig.sh" 2> /dev/null`
511 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;}'`
512 if [ $maxver -lt $ver ]; then
517 if test -n "$file"; then
527 if test -z "${TCLHOME}"; then
530 tclcfg=`find ${TCLHOME}/lib -name "tkConfig.sh" 2> /dev/null`
534 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;}'`
535 if [ $maxver -lt $ver ]; then
540 if test -n "$file"; then
550 if test -f /usr/X11R6/include/DPS/dpsconfig.h ; then
554 if test -f /usr/include/DPS/dpsconfig.h ; then
563 for d in /usr/X11R6/include /usr/include ; do
564 if [ -d ${d}/GL ] && [ -f ${d}/GL/gl.h ] ; then
574 # search libGL.so* file and correct libGL.la in the same directory
575 for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
576 if [ "`ls ${d}/libGL.so* 2>/dev/null`" ] && [ -f ${d}/libGL.la ]; then
577 libdir=`grep "libdir=" ${d}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%" -e "s%/*$%%g"`
578 if [ "$libdir" == "$d" ] ; then
584 # search libGL.la file and check if this file is correct
585 for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
586 if [ -f ${d}/libGL.la ] ; then
587 libdir=`grep "libdir=" ${d}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"`
588 if [ "`ls $libdir/libGL.so* 2>/dev/null`" ] ; then
594 # then search libGL.so* file
595 for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
596 if [ "`ls ${d}/libGL.so* 2>/dev/null`" ] ; then
607 if [ -z "$ldir" ] || [ ! -d "$ldir" ]; then return 1; fi
611 SALOME_MODULES="`env | awk -F_ '/[[:alnum:]]*_ROOT_DIR/ { print $1 }'`"
615 la_files=`find . -name "*.la"`
617 for l in X ${la_files}; do
618 if [ "$l" != "X" ] ; then
622 # 1. process salome modules dependencies
623 for mod in $SALOME_MODULES; do
624 moddir=`printenv ${mod}_ROOT_DIR`
625 if [ -n "${moddir}" ] ; then
626 #echo $l $mod $moddir
627 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[^[:space:]/]*/lib% \1${moddir}/lib%g" $l > $l"_"
631 # 2. process CAS.CADE dependencies
632 casdir=`printenv CASROOT`/lib
633 if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/Linux/lib ; fi
634 if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/lin/lib ; fi
635 if [ -n "${CASROOT}" ] && [ -d "${casdir}" ] ; then
636 # echo $l $CASROOT $casdir
637 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/Linux/lib% \1${casdir}%g" \
638 -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/lin/lib% \1${casdir}%g" \
639 -e "s%[[:space:]]\(-L\)\?[^[:space:]]*\(OCT\|CAS\)[^[:space:]/]*/lib% \1${casdir}%g" $l > $l"_"
642 # 3. process omniORB dependencies
643 omnidir=`printenv OMNIORBDIR`/lib/i586_linux_2.0_glibc2.1
644 if [ ! -d ${omnidir} ] ; then omnidir=`printenv OMNIORBDIR`/lib ; fi
645 if [ -n "${OMNIORBDIR}" ] && [ -d "${omnidir}" ] ; then
646 # echo $l $OMNIORBDIR $omnidir
647 sed -e "s%-L[^[:space:]]*omni[^[:space:]]*%-L${omnidir}%g" $l > $l"_"
650 # 4. process VTK dependencies
651 if test `uname -m` = "x86_64" ; then
652 vtkdir=`printenv VTKHOME`/lib64/vtk
654 vtkdir=`printenv VTKHOME`/lib/vtk
656 if [ -n "${VTKHOME}" ] && [ -d "${vtkdir}" ] ; then
657 # echo $l $VTKHOME $vtkdir
658 sed -e "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)/vtk%-L${vtkdir}%g" $l > $l"_"
661 # 5. process HDF dependencies
662 hdfdir=`printenv HDF5HOME`/lib
663 if [ -n "${HDF5HOME}" ] && [ -d "${hdfdir}" ] ; then
664 # echo $l $HDF5HOME $hdfdir
665 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*hdf[^[:space:]/]*/lib% \1${hdfdir}%g" $l > $l"_"
668 # 6. process MED dependencies
669 meddir=`printenv MED2HOME`/lib
670 if [ -n "${MED2HOME}" ] && [ -d "${meddir}" ] ; then
671 # echo $l $MED2HOME $meddir
672 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*med[^[:space:]/]*/lib% \1${meddir}%g" $l > $l"_"
675 # 7. process qwt dependencies
676 qwtdir=`find_in_path libqwt.so ${LD_LIBRARY_PATH}`
677 if [ -n "${qwtdir}" ] && [ -d "${qwtdir}" ] ; then
679 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*qwt[^[:space:]/]*/lib% \1${qwtdir}%g" $l > $l"_"
682 # 8. process qt dependencies
683 qtdir=`printenv QTDIR`/lib
684 if [ -n "${QTDIR}" ] && [ -d "${qtdir}" ] ; then
685 # echo $l $QTDIR $qtdir
686 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*qt[^[:space:]/]*/lib% \1${qtdir}%g" $l > $l"_"
689 # 9. process python dependencies
690 where_python=`which python` # e.g. /usr/bin/python
691 if [ -n "$where_python" ] ; then
692 where_python=`dirname $where_python` # --> /usr/bin
693 where_python=`dirname $where_python` # --> /usr
694 python_version=`python -c "import sys; print sys.version[:3]"`
695 # echo $l $where_python $python_version
696 sed -e "s%-L[^[:space:]]*python[0-9]\.[0-9]\([^[:space:]]*\)%-L${where_python}/lib/python${python_version}\1%g" $l > $l"_"
699 # 10. process sip dependencies
700 sipdir=`find_in_path sip.so ${LD_LIBRARY_PATH}`
701 if [ -n "${sipdir}" ] && [ -d "${sipdir}" ] ; then
703 sed -e "s%-L[^[:space:]]*sip[^[:space:]]*%-L${sipdir}%g" $l > $l"_"
706 # 11. process PyQt dependencies
707 pyqtdir=`find_in_path qt.so ${LD_LIBRARY_PATH}`
708 if [ -n "${pyqtdir}" ] && [ -d "${pyqtdir}" ] ; then
710 sed -e "s%-L[^[:space:]]*PyQt[^[:space:]]*%-L${pyqtdir}%g" $l > $l"_"
713 # 12. process tcl/tk dependencies
714 tcldir=`printenv TCLHOME`/lib
715 if [ -n "${tcldir}" ] && [ -d "${tcldir}" ] ; then
716 # echo $l $TCLHOME $tcldir
717 sed -e "s%-L[^[:space:]]*tcltk[^[:space:]]*/lib%-L${tcldir}%g" $l > $l"_"
720 # 13. process boost dependencies
721 boostdir=`printenv BOOSTDIR`/lib
722 if [ -n "${boostdir}" ] && [ -d "${boostdir}" ] ; then
723 # echo $l $BOOSTDIR $boostdir
724 sed -e "s%-L[^[:space:]]*boost[^[:space:]]*/lib%-L${boostdir}%g" $l > $l"_"
728 #sed -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib/salome'%g" $l > $l"_"
729 mod=`basename $ldir | awk -F_ '{print $1}'`
730 moddir=`printenv ${mod}_ROOT_DIR`
731 sed -e "s%^libdir='[^[:space:]]*${mod}[^[:space:]]*/\(lib.*\)'%libdir='${moddir}/\1'%g" $l > $l"_"