]> SALOME platform Git repositories - tools/install.git/blob - config_files/common.sh
Salome HOME
f8c08cab39794108d112257e480b88e74baa4fa6
[tools/install.git] / config_files / common.sh
1 #!/bin/sh
2
3 # This script installs a subset of products necessary for SALOME application
4 #
5 # Usage: install <target-directory> [all]
6 #        install <target-directory> <product> ... <product>
7 #
8 # Type 'install --help' to get more information
9 #
10 # Important note: 
11 #   <target-directory> must be an absolute path
12 #
13 # The script is the part of the SALOME PRO installation procedure.
14 #
15 # Copyright : 2003 CEA/DEN, EDF R&D
16 ####################################################################################
17
18 export DELIM="------"
19 export SHRC="salome.sh"
20 export CSHRC="salome.csh"
21 export DEBUG=1
22
23 #this function takes several parameters
24 #first parameter contains descriptor of output file
25 #next parameters is command for execution
26 #in case of bad result of execution ask user about furher steps
27 #(user can cancel installation procedure)
28 check_job()
29 {
30   out=$1
31   shift
32   echo -e "`pwd` -> $* >> $out" 
33   if [ $DEBUG == 0 ] ; then
34     $* | tee $out
35   else
36     if [ $out == "1" ] ; then
37       $*
38     else
39       $* >> $out 2>&1
40     fi 
41   fi
42   if [ "$?" -ne "0" ] ; then
43     if [ $out != "1" ] ; then
44       cat $out
45     fi
46     # VSR : 10/11/05: disable answer mode ==>
47     #echo -n " " >&2
48     #echo -e "NOT DONE !!! => $*"
49     #echo -n "Would you like to continue to install this product: (Y,N) [Y] : "
50     #read rep;
51     #rep=`echo $rep  | tr "[A-Z]" "[a-z]"`
52     #if test -z $rep || [ $rep = "y" ] ; then
53     #  return 1
54     #fi
55     # VSR : 10/11/05: disable answer mode <==
56     exit 1
57   fi
58   return 0
59 }
60
61 #invoke check_job function
62 #all output will be put into terminal
63 check_jb()
64 {
65   check_job 1 $*
66   return
67 }
68
69 # make directory
70 makedir()
71 {
72   rm -rf "$1" > /dev/null
73   mkdir -p "$1"
74 }
75
76 #create environment for sh and csh
77 make_env()
78 {
79 install_root=$1;  shift
80 install_work=$1; 
81 for i in $SHRC $CSHRC ; do
82     if [ -e ${install_work}/$i ]; then
83         rm ${install_work}/$i
84     fi
85     touch ${install_work}/$i
86 done
87
88 if [ $# -eq 3 ] ; then
89     product_name=$3;
90     product_env=${install_work}/env_${product_name}.sh
91     (test -e ${product_env} && rm ${product_env} )
92 fi
93 ### !!! writing salome.sh file !!!  -> define INSTALL_ROOT
94 cat >> ${install_work}/$SHRC <<EOF
95 #${DELIM} Setting products installation directory ${DELIM}
96 export INSTALL_ROOT=${install_root}
97
98 #${DELIM} Environment switch: 0 for SALOME building, 1 for SALOME launching ${DELIM}
99 export ENV_FOR_LAUNCH=1
100
101 EOF
102 ### !!! The next is for RedHat 9 only !!! 
103 if [ -f /etc/redhat-release ] ; then
104   grep -e "Red Hat Linux release 9" /etc/redhat-release > /dev/null
105   if [ $? -eq 0 ] ; then
106     cat >> ${install_work}/$SHRC <<EOF
107 #${DELIM} Force RH9 to use old implementation of threads ${DELIM}
108 export LD_ASSUME_KERNEL=2.4.18
109
110 EOF
111   fi
112 fi
113 ### !!! writing salome.csh file !!! -> set inital variables
114 pre_vars="PATH LD_LIBRARY_PATH LD_RUN_PATH PYTHONPATH TCLLIBPATH"
115 for i in $pre_vars ; do
116 cat >> ${install_work}/$CSHRC <<EOF
117 #${DELIM} setting initial ${i} ${DELIM}
118 if (! (\$?${i}) ) then
119   setenv $i
120 endif
121
122 EOF
123 done
124
125 ### !!! writing salome.(c)sh files !!! -> dump products environment files, changing 'export' by 'setenv(a|p)' where necessary
126 ### Note, that for performance reasons temporary environment files used during installation procedure itself
127 ### are created without using setenv(a|p) aliases.
128
129 # 1. first dump all environment files into the $SHRC file
130 product_sequence="$2"
131 for i in $product_sequence ; do
132     cat ${install_work}/env_${i}.sh >> ${install_work}/$SHRC 2>/dev/null
133 done
134
135 # 2. writing global functions to _salome.sh file
136 cat >> ${install_work}/_$SHRC <<EOF
137 ##########################################################################
138 # Functions exporta and exportp are used to append/prepend correspondingly 
139 # one directory or a set of directories separated by semicolon symbol (':')
140 # to the environment variables like PATH, LD_LIBRARY_PATH, PYTHONPATH,
141 # LD_RUN_PATH etc. 
142 # The main purpose is to replace default setenv command behavior:
143 # exporta, exportp also remove duplicated entries, shortening in that way
144 # the environment variables.
145 # If some directory being added is already included into the variable
146 # nothing is done for it.
147 # Note, that these functions work some slower that setenv command itself.
148 #
149 #### cleandup ###
150 # appends/prepends set of directories (second parameter) 
151 # to the another set of directories (first parameter) and
152 # removes duplicated entries;
153 # the third parameter defines the mode: 0 - append, 1 - prepend
154 cleandup() {
155 out_var=\`echo \$1 \$2 | awk -v dir=\$3 '{                   \\
156     na = split(\$2,a,":");                                \\
157     if ( \$1 == "<empty>") nb = split("",b,":");          \\
158     else nb = split(\$1,b,":");                           \\
159     s = "" ;                                             \\
160     for(i=1;i<=nb;i++) {                                 \\
161         if(!(b[i] in ccc)) {                             \\
162             if(length(s)!=0)                             \\
163                 s = sprintf("%s:",s);                    \\
164             s = sprintf("%s%s",s,b[i]);                  \\
165             ccc[b[i]];                                   \\
166         };                                               \\
167     };                                                   \\
168     s1 = "";                                             \\
169     for(i=1;i<=na;i++) {                                 \\
170         if(!(a[i] in ccc)) {                             \\
171             if(length(s1)!=0)                            \\
172                 s1 = sprintf("%s:",s1);                  \\
173             s1 = sprintf("%s%s",s1,a[i]);                \\
174             ccc[a[i]];                                   \\
175         };                                               \\
176     };                                                   \\
177     if(dir)                                              \\
178         s = length(s) == 0 ? s1 : sprintf("%s:%s",s1,s); \\
179     else                                                 \\
180         s = length(s1) == 0 ? s : sprintf("%s:%s",s,s1); \\
181     printf("%s\n",s);                                    \\
182     }'\`
183 echo \$out_var
184 }
185 ### exporta ###
186 # appends directory or set of directories, separated by ':' (second parameter)
187 # to the variable (first parameter)
188 exporta () { 
189 xenv=\`printenv \$1\`
190 if [ -z "\$xenv" ]; then xenv="<empty>"; fi
191 out_var=\`cleandup \$xenv \$2 0\`
192 export \$1=\$out_var
193 }
194 ### exportp ###
195 # prepends directory or set of directories, separated by ':' (second parameter)
196 # to the variable (first parameter)
197 exportp () { 
198 xenv=\`printenv \$1\`
199 if [ -z "\$xenv" ]; then xenv="<empty>"; fi
200 out_var=\`cleandup \$xenv \$2 1\`
201 export \$1=\$out_var
202 }
203 ###########################################################################
204
205 EOF
206
207 # 3. writing global functions to _salome.csh file
208 cat >> ${install_work}/_$CSHRC <<EOF
209 ###########################################################################
210 # Aliases setenva and setenvp 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,
213 # LD_RUN_PATH etc. 
214 # The main purpose is to replace default setenv command behavior:
215 # setenva, setenvp 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 aliases work some slower that setenv command itself.
220 #
221 #### cleandup ###
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
226 alias cleandup "echo \!:1 \!:2 | awk -v dir=\!:3         \\\\
227 '"'{ na = split(\$2,a,":");                               \\\\
228      nb = split(\$1,b,":");                               \\\\
229      s = "" ;                                            \\\\
230      for(i=1;i<=nb;i++) {                                \\\\
231         if(!(b[i] in ccc)) {                             \\\\
232             if(length(s)!=0)                             \\\\
233                 s = sprintf("%s:",s);                    \\\\
234             s = sprintf("%s%s",s,b[i]);                  \\\\
235             ccc[b[i]];                                   \\\\
236         };                                               \\\\
237     };                                                   \\\\
238     s1 = "";                                             \\\\
239     for(i=1;i<=na;i++) {                                 \\\\
240         if(!(a[i] in ccc)) {                             \\\\
241             if(length(s1)!=0)                            \\\\
242                 s1 = sprintf("%s:",s1);                  \\\\
243             s1 = sprintf("%s%s",s1,a[i]);                \\\\
244             ccc[a[i]];                                   \\\\
245         };                                               \\\\
246     };                                                   \\\\
247     if(dir)                                              \\\\
248         s = length(s) == 0 ? s1 : sprintf("%s:%s",s1,s); \\\\
249     else                                                 \\\\
250         s = length(s1) == 0 ? s : sprintf("%s:%s",s,s1); \\\\
251     printf("%s\n",s);                                    \\\\
252     }'"'"
253 ### setenva ###
254 # appends directory or set of directories, separated by ':' (second parameter)
255 # to the variable (first parameter)
256 alias setenva 'set a=\!:1 ; set b=\!:2 ;  \\
257                set c=\`printenv \$a\` ;      \\
258                set b=\`cleandup \$c \$b 0\` ; \\
259                setenv \$a \$b ;             \\
260                unset a, b, c'
261
262 ### setenvp ###
263 # prepends directory or set of directories, separated by ':' (second parameter)
264 # to the variable (first parameter)
265 alias setenvp 'set a=\!:1 ; set b=\!:2 ;  \\
266                set c=\`printenv \$a\` ;      \\
267                set b=\`cleandup \$c \$b 1\` ; \\
268                setenv \$a \$b ;             \\
269                unset a, b, c'
270 ###########################################################################
271
272 EOF
273 cat ${install_work}/$CSHRC >> ${install_work}/_$CSHRC
274
275 # 4. put the contents of salome.sh to _salome.sh replacing export by export(a|p) aliases where necessary
276 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
277 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
278 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
279 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
280 cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/_$SHRC
281
282 # 5. Create a salome.csh file from salome.sh by replacing export by setenv, etc.
283 sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${install_work}/$SHRC > ${INSTALL_WORK}/_tmp1 2>/dev/null
284 cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/$CSHRC
285
286 # 6. Create a _salome.csh file from _salome.sh by replacing export by setenv, exporta by setenva, etc.
287 sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
288 sed -e 's%exporta \([[:alnum:]_[:blank:]]*\)%setenva \1%g'  ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
289 sed -e 's%exportp \([[:alnum:]_[:blank:]]*\)%setenvp \1%g'  ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
290 sed -e 's%if \[ -n "\${ENV_FOR_LAUNCH}" \] ; then%if ( ${?ENV_FOR_LAUNCH} ) then%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
291 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
292 sed -e 's%^\([[:blank:]]*\)fi\([[:blank:]]*\)$%\1endif\2%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
293 cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/_$CSHRC 2>/dev/null
294
295 rm -f ${INSTALL_WORK}/_tmp1 ${INSTALL_WORK}/_tmp2
296
297 if [ $# -eq 4 ] ; then
298     product_dir=$4
299     if [ -e ${product_dir} ] ; then
300         cp -f ${install_work}/_$SHRC  ${product_dir}/$SHRC
301         cp -f ${install_work}/_$CSHRC ${product_dir}/$CSHRC
302     fi
303 fi
304 sed -e 's%setenv ENV_FOR_LAUNCH 1%setenv ENV_FOR_LAUNCH 0%' ${install_work}/_$CSHRC > ${install_root}/env_build.csh
305 sed -e 's%export ENV_FOR_LAUNCH=1%export ENV_FOR_LAUNCH=0%' ${install_work}/_$SHRC  > ${install_root}/env_build.sh
306 cp -f ${install_work}/_$CSHRC ${install_root}/env_products.csh
307 cp -f ${install_work}/_$SHRC  ${install_root}/env_products.sh
308 rm -f ${install_work}/_$SHRC ${install_work}/_$CSHRC
309 ### !!! copying build.csh script
310 if [ -e ./build.csh ]; then
311     cp -f ./build.csh ${install_root}
312 fi
313 }
314
315 #try use already existing product
316 try_existing()
317 {
318 product_dir=$1;  install_root=$2;  install_work=$3;  product_sequence="$4";  product_type=$5
319 env_file=${product_dir}/env_${product_type}.sh
320 if [ -f ${env_file} ] ; then
321     cp -f ${env_file} ${install_work}
322     make_env ${install_root} ${install_work} "${product_sequence}"
323     source ${install_work}/$SHRC
324     check_version
325     if [ $? -eq 0 ] ; then
326         if [ -d ${product_dir} ] && [ -w ${product_dir} ] ; then
327             #makedir ${product_dir}
328             print_env
329             return 0    
330         fi
331     fi
332 fi
333 return 1;
334 }
335
336 #check existance of lib passed as first parameter
337 #return 0 if lib exists
338 #if you pass second parameter search will be done in it 
339 #otherwise search will be done in $LD_LIBRARY_PATH
340 #you should use : as dilimeter if you are going to pass second parameter
341 check_lib_version(){
342 if [ -n "$2" ]; then
343    whereIs=$2
344 else
345    whereIs=$LD_LIBRARY_PATH
346 fi
347 for L in `echo ${whereIs} | sed -e"s%:% %g"` ;  do
348     ret=`find $L -name $1 2>/dev/null`
349     if [ -n "$ret" ] ; then
350         #echo "The $1 exists on yours system in a $L folder"
351         return 0
352     fi
353 done
354 return 1
355 }
356
357 find_in_path(){
358 file=$1;  shift; 
359 path=$*
360 for i in `echo ${path} | sed -e"s%:% %g"` ; do 
361     ret=`find $i -name $file 2>/dev/null`
362     if [ -n "$ret" ] ; then
363         ret=`echo $ret | sed -e"s%/\$file$%%g"`
364         echo $ret
365         return 0
366     fi
367 done
368 return 1
369 }
370
371 sort_path(){
372 arg1=$1;  val1=$2;  arg2=$3;  val2=$4
373 tmp="^$val1$|^$val1:|:$val1$|:$val1:"
374 #echo $val2 | grep -E "$tmp" >/dev/null 2>&1
375 #if [ $? -eq 0 ] ; then 
376 #    echo "$arg2"
377 #    return
378 #fi
379 to_tail=1
380 exclude_list="usr lib bin sbin etc"
381 for i in ${exclude_list} ; do
382     tmp="^/$i/|^/$i\$"
383     echo ${val1} | grep -E "$tmp" >/dev/null 2>&1
384     if [ $? == 0 ] ; then to_tail=0; break; fi
385 done
386 if [ $to_tail -eq 0 ] ; then
387     echo $arg2:$arg1
388 else
389     echo $arg1:$arg2
390 fi
391 return $to_tail
392 }
393
394 where_tcl(){
395 if test -z "${TCLHOME}"; then
396     TCLHOME=/usr
397 fi
398 tclcfg=`find ${TCLHOME}/lib -name "tclConfig.sh" 2> /dev/null`
399 file=""
400 maxver=0
401 for f in $tclcfg; do
402     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;}'`
403     if [ $maxver -lt $ver ]; then
404         maxver=$ver
405         file=$f
406     fi
407 done
408 if test -n "$file"; then
409     echo `dirname $file`
410     return 0
411 else
412     echo ""
413     return 1
414 fi
415 }
416
417 where_tk(){
418 if test -z "${TCLHOME}"; then
419     TCLHOME=/usr
420 fi
421 tclcfg=`find ${TCLHOME}/lib -name "tkConfig.sh" 2> /dev/null`
422 file=""
423 maxver=0
424 for f in $tclcfg; do
425     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;}'`
426     if [ $maxver -lt $ver ]; then
427         maxver=$ver
428         file=$f
429     fi
430 done
431 if test -n "$file"; then
432     echo `dirname $file`
433     return 0
434 else
435     echo ""
436     return 1
437 fi
438 }
439
440 modif_la_files(){
441 ldir=$1
442 if [ -z "$ldir" ] || [ ! -d "$ldir" ]; then return 1; fi
443
444 srcdir=`pwd`
445
446 SALOME_MODULES="`env | awk -F_ '/[[:alnum:]]*_ROOT_DIR/ { print $1 }'`"
447
448 cd $ldir
449 la_files=`find . -name "*.la" -maxdepth 1`
450
451 for l in X ${la_files}; do
452 if [ "$l" != "X" ] ; then
453     l=`basename $l`
454     # 1. process salome modules dependencies
455     for mod in $SALOME_MODULES; do
456         moddir=`printenv ${mod}_ROOT_DIR`
457         if [ -n "${moddir}" ] ; then
458             #echo $l $mod $moddir
459             sed -e "s%-L[^[:space:]]*${mod}[^[:space:]]*/lib/salome%-L${moddir}/lib/salome%g" $l > _$l
460             mv -f _$l $l
461         fi
462     done
463     # 2. process CAS.CADE dependencies
464     casdir=`printenv CASROOT`/lib
465     if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/Linux/lib ; fi
466     if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/lin/lib ; fi
467     if [ -n "${CASROOT}" ] && [ -d "${casdir}" ] ; then
468         # echo $l $CASROOT $casdir
469         sed -e "s%-L[^[:space:]]*\(OCT\|CAS\)[^[:space:]]*%-L${casdir}%g" $l > _$l
470         mv -f _$l $l
471     fi
472     # 3. process omniORB dependencies
473     omnidir=`printenv OMNIORBDIR`/lib/i586_linux_2.0_glibc2.1
474     if [ ! -d ${omnidir} ] ; then omnidir=`printenv OMNIORBDIR`/lib ; fi
475     if [ -n "${OMNIORBDIR}" ] && [ -d "${omnidir}" ] ; then
476         # echo $l $OMNIORBDIR $omnidir
477         sed -e "s%-L[^[:space:]]*omni[^[:space:]]*%-L${omnidir}%g" $l > _$l
478         mv -f _$l $l
479     fi
480     # 4. process VTK dependencies
481     vtkdir=`printenv VTKHOME`/lib/vtk
482     if [ -n "${VTKHOME}" ] && [ -d "${vtkdir}" ] ; then
483         # echo $l $VTKHOME $vtkdir
484         sed -e "s%-L[^[:space:]]*VTK[^[:space:]]*/lib/vtk%-L${vtkdir}%g" $l > _$l
485         mv -f _$l $l
486     fi
487     # 5. process HDF dependencies
488     hdfdir=`printenv HDF5HOME`/lib
489     if [ -n "${HDF5HOME}" ] && [ -d "${hdfdir}" ] ; then
490         # echo $l $HDF5HOME $hdfdir
491         sed -e "s%-L[^[:space:]]*hdf[^[:space:]]*/lib%-L${hdfdir}%g" $l > _$l
492         mv -f _$l $l
493     fi
494     # 6. process MED dependencies
495     meddir=`printenv MED2HOME`/lib
496     if [ -n "${MED2HOME}" ] && [ -d "${meddir}" ] ; then
497         # echo $l $MED2HOME $meddir
498         sed -e "s%-L[^[:space:]]*med[^[:space:]]*/lib%-L${meddir}%g" $l > _$l
499         mv -f _$l $l
500     fi
501     # 7. process qwt dependencies
502     qwtdir=`printenv QWTHOME`/lib
503     if [ -n "${QWTHOME}" ] && [ -d "${qwtdir}" ] ; then
504         # echo $l $QWTHOME $qwtdir
505         sed -e "s%-L[^[:space:]]*qwt[^[:space:]]*/lib%-L${qwtdir}%g" $l > _$l
506         mv -f _$l $l
507     fi
508     # 8. process qt dependencies
509     qtdir=`printenv QTDIR`/lib
510     if [ -n "${QTDIR}" ] && [ -d "${qtdir}" ] ; then
511         # echo $l $QTDIR $qtdir
512         sed -e "s%-L[^[:space:]]*qt[^[:space:]]*/lib%-L${qtdir}%g" $l > _$l
513         mv -f _$l $l
514     fi
515     # 9. process python dependencies
516     where_python=`which python`                 # e.g. /usr/bin/python
517     if [ -n "$where_python" ] ; then
518         where_python=`dirname $where_python`    # --> /usr/bin
519         where_python=`dirname $where_python`    # --> /usr
520         python_version=`python -c "import sys; print sys.version[:3]"`
521         # echo $l $where_python $python_version
522         sed -e "s%-L[^[:space:]]*python[0-9]\.[0-9]\([^[:space:]]*\)%-L${where_python}/lib/python${python_version}\1%g" $l > _$l
523         mv -f _$l $l
524     fi
525     # 10. process sip dependencies
526     sipdir=`find_in_path sip.so ${LD_LIBRARY_PATH}`
527     if [ -n "${sipdir}" ] && [ -d "${sipdir}" ] ; then
528         # echo $l $sipdir
529         sed -e "s%-L[^[:space:]]*sip[^[:space:]]*%-L${sipdir}%g" $l > _$l
530         mv -f _$l $l
531     fi
532     # 11. process PyQt dependencies
533     pyqtdir=`find_in_path qt.so ${LD_LIBRARY_PATH}`
534     if [ -n "${pyqtdir}" ] && [ -d "${pyqtdir}" ] ; then
535         # echo $l $pyqtdir
536         sed -e "s%-L[^[:space:]]*PyQt[^[:space:]]*%-L${pyqtdir}%g" $l > _$l
537         mv -f _$l $l
538     fi
539     # 12. process tcl/tk dependencies
540     tcldir=`printenv TCLHOME`/lib
541     if [ -n "${tcldir}" ] && [ -d "${tcldir}" ] ; then
542         # echo $l $TCLHOME $tcldir
543         sed -e "s%-L[^[:space:]]*tcltk[^[:space:]]*/lib%-L${tcldir}%g" $l > _$l
544         mv -f _$l $l
545     fi
546     # 13. modify libdir
547     sed -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib/salome'%g" $l > _$l
548     mv -f _$l $l
549 fi
550 done
551
552 cd $srcdir
553 return 0
554 }