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-2014 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="7.4.0"
23 export YACSGEN_VERSION=${SALOME_VERSION}
25 # Name of the single directory for SALOME modules
26 export SDIR_NAME="SALOME_${SALOME_VERSION}"
28 #this function takes one parameter - path to module source folder
29 check_salome_src_version(){
32 if [ -n "${root_dir}" ]; then
34 if [ ! -f ${root_dir}/${cfg_file} ] ; then
35 cfg_file=configure.in.base
37 cfg_file=CMakeLists.txt
39 if [ -f ${root_dir}/${cfg_file} ] ; then
40 if [ "${cfg_file}" = "CMakeLists.txt" ] ; then
41 ver_maj=`cat ${root_dir}/${cfg_file} | grep SET\(VERSION_MAJOR | sed -e "s%[A-Z_() ]%%g"`
42 ver_min=`cat ${root_dir}/${cfg_file} | grep SET\(VERSION_MINOR | sed -e "s%[A-Z_() ]%%g"`
43 ver_maintenance=`cat ${root_dir}/${cfg_file} | grep SET\(VERSION_MAINTENANCE | sed -e "s%[A-Z_() ]%%g"`
44 ver="${ver_maj}.${ver_min}.${ver_maintenance}"
46 ver=`grep -e "^AC_INIT" ${root_dir}/${cfg_file} | sed -e "s%.*\[\([[:digit:].]*\)\].*%\1%g"`
49 if [ "${ver}" = "${SALOME_VERSION}" ]; then
57 #this function takes several parameters
58 #first parameter contains descriptor of output file
59 #next parameters is command for execution
60 #in case of bad result of execution ask user about furher steps
61 #(user can cancel installation procedure)
67 if [ -n "${INSTALL_WORK}" ] ; then errfile=${INSTALL_WORK}/errlog; fi
69 if [ "${out}" != "1" ] ; then cmd="${cmd} >> ${out}" ; fi
71 if [ "${out}" != "1" ] ; then
72 $* >> ${out} 2>${errfile}
76 if [ "$?" -ne "0" ] ; then
77 if [ ${out} != "1" ] ; then
80 cat ${errfile} >> ${out}
82 # VSR : 10/11/05: disable answer mode ==>
84 #echo -e "NOT DONE !!! => $*"
85 #echo -n "Would you like to continue to install this product: (Y,N) [Y] : "
87 #rep=`echo ${rep} | tr "[A-Z]" "[a-z]"`
88 #if test -z ${rep} || [ ${rep} = "y" ] ; then
91 # VSR : 10/11/05: disable answer mode <==
97 #invoke check_job function
98 #all output will be put into terminal
108 rm -rf "$1" > /dev/null
112 #create environment for sh and csh
115 install_root=$1; shift
118 for i in ${SHRC} ${CSHRC} ; do
119 if [ -e ${install_work}/${i} ]; then
120 rm ${install_work}/${i}
122 touch ${install_work}/${i}
125 if [ $# -eq 4 ] ; then
127 product_env=${install_work}/env_${product_name}.sh
128 (test -e ${product_env} && rm ${product_env} )
130 ### !!! writing salome.sh file !!! -> define INST_ROOT
131 cat >> ${install_work}/${SHRC} <<EOF
132 #${DELIM} Setting products installation directory ${DELIM}
133 export INST_ROOT=${install_root}
135 #${DELIM} Environment switch: 0 for SALOME building, 1 for SALOME launching ${DELIM}
136 export ENV_FOR_LAUNCH=1
138 #${DELIM} Setting numeric locale ${DELIM}
142 ### !!! The next is for RedHat 9 only !!!
143 if [ -f /etc/redhat-release ] ; then
144 grep -e "Red Hat Linux release 9" /etc/redhat-release > /dev/null
145 if [ $? -eq 0 ] ; then
146 cat >> ${install_work}/${SHRC} <<EOF
147 #${DELIM} Force RH9 to use old implementation of threads ${DELIM}
148 export LD_ASSUME_KERNEL=2.4.18
153 ### !!! writing salome.csh file !!! -> set inital variables
154 pre_vars="PATH LD_LIBRARY_PATH LD_RUN_PATH PYTHONPATH TCLLIBPATH"
155 for i in ${pre_vars} ; do
156 cat >> ${install_work}/${CSHRC} <<EOF
157 #${DELIM} setting initial ${i} ${DELIM}
158 if (! (\$?${i}) ) then
165 ### !!! writing salome.(c)sh files !!! -> dump products environment files, changing 'export' by 'setenv(a|p)' where necessary
166 ### Note, that for performance reasons temporary environment files used during installation procedure itself
167 ### are created without using setenv(a|p) aliases.
169 # 0. add /usr/lib or /usr/lib64 dir to the LD_LIBRARY_PATH
170 #if test `uname -m` = "x86_64" ; then
171 #echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> ${install_work}/${SHRC} 2>/dev/null
172 #echo '' >> ${install_work}/${SHRC} 2>/dev/null
174 #echo 'export LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH}' >> ${install_work}/${SHRC} 2>/dev/null
175 #echo '' >> ${install_work}/${SHRC} 2>/dev/null
178 # 1. first dump all environment files into the ${SHRC} file
179 product_sequence="$2"
180 install_products="$3"
181 for i in ${product_sequence} ; do
182 env_file=${install_work}/env_${i}.sh
183 _env_file=${install_work}/_env_${i}.sh
184 if [ -e ${_env_file} ] ; then
185 cat ${_env_file} >> ${install_work}/${SHRC} 2>/dev/null
186 elif [ -e ${env_file} ] ; then
187 echo ${install_products} | grep -q "\b${i}\b"
188 if [ $? -eq 1 ] ; then
189 cat ${env_file} | sed 's/^/## /' >> ${install_work}/${SHRC} 2>/dev/null
191 cat ${env_file} >> ${install_work}/${SHRC} 2>/dev/null
196 # 2. writing global functions to _salome.sh file
197 cat >> ${install_work}/_${SHRC} <<EOF
198 ##########################################################################
199 # Functions exporta and exportp are used to append/prepend correspondingly
200 # one directory or a set of directories separated by semicolon symbol (':')
201 # to the environment variables like PATH, LD_LIBRARY_PATH, PYTHONPATH,
203 # The main purpose is to replace default setenv command behavior:
204 # exporta, exportp also remove duplicated entries, shortening in that way
205 # the environment variables.
206 # If some directory being added is already included into the variable
207 # nothing is done for it.
208 # Note, that these functions work some slower that setenv command itself.
211 # appends/prepends set of directories (second parameter)
212 # to the another set of directories (first parameter) and
213 # removes duplicated entries;
214 # the third parameter defines the mode: 0 - append, 1 - prepend
216 out_var=\`echo \$1 \$2 | awk -v dir=\$3 '{ \\
217 na = split(\$2,a,":"); \\
221 if(\$1 != "<empty>") { \\
222 nb = split(\$1,b,":"); \\
223 for(i=1;i<=nb;i++) { \\
224 if(!(b[i] in ccc) ) { \\
232 for(i=1;i<=na;i++) { \\
233 if(!(a[i] in ccc)) { \\
240 for(i=1;i<k2;i++) { \\
243 for(i=1;i<k1;i++) { \\
248 for(i=1;i<k1;i++) { \\
251 for(i=1;i<k2;i++) { \\
255 }' | sed -e 's/\(.*\):/\1/g'\`
259 # appends directory or set of directories, separated by ':' (second parameter)
260 # to the variable (first parameter)
263 if [ -z "\${xenv}" ]; then xenv="<empty>"; fi
264 out_var=\`cleandup \${xenv} \$2 0\`
265 export \$1=\${out_var}
268 # prepends directory or set of directories, separated by ':' (second parameter)
269 # to the variable (first parameter)
272 if [ -z "\${xenv}" ]; then xenv="<empty>"; fi
273 out_var=\`cleandup \${xenv} \$2 1\`
274 export \$1=\${out_var}
276 ###########################################################################
280 # 3. writing global functions to _salome.csh file
281 cat >> ${install_work}/_${CSHRC} <<EOF
283 ###########################################################################
284 # Aliases setenva and setenvp are used to append/prepend correspondingly
285 # one directory or a set of directories separated by semicolon symbol (':')
286 # to the environment variables like PATH, LD_LIBRARY_PATH, PYTHONPATH,
288 # The main purpose is to replace default setenv command behavior:
289 # setenva, setenvp also remove duplicated entries, shortening in that way
290 # the environment variables.
291 # If some directory being added is already included into the variable
292 # nothing is done for it.
293 # Note, that these aliases work some slower that setenv command itself.
296 # appends/prepends set of directories (second parameter)
297 # to the another set of directories (first parameter) and
298 # removes duplicated entries;
299 # the third parameter defines the mode: 0 - append, 1 - prepend
300 alias cleandup "echo \!:1 \!:2 | awk -v dir=\!:3 \\\\
301 '"'{ na = split(\$2,a,":"); \\\\
305 if(\$1 != "<empty>") { \\\\
306 nb = split(\$1,b,":"); \\\\
307 for(i=1;i<=nb;i++) { \\\\
308 if(!(b[i] in ccc) ) { \\\\
316 for(i=1;i<=na;i++) { \\\\
317 if(!(a[i] in ccc)) { \\\\
324 for(i=1;i<k2;i++) { \\\\
327 for(i=1;i<k1;i++) { \\\\
332 for(i=1;i<k1;i++) { \\\\
335 for(i=1;i<k2;i++) { \\\\
339 }'"' | sed -e 's/\(.*\):/\1/g'"
341 # appends directory or set of directories, separated by ':' (second parameter)
342 # to the variable (first parameter)
343 alias setenva 'set a=\!:1 ; set b=\!:2 ; \\
344 set c=\`printenv \${a}\` ; \\
345 set b=\`cleandup \${c} \${b} 0\` ; \\
346 setenv \${a} \${b} ; \\
350 # prepends directory or set of directories, separated by ':' (second parameter)
351 # to the variable (first parameter)
352 alias setenvp 'set a=\!:1 ; set b=\!:2 ; \\
353 set c=\`printenv \${a}\` ; \\
354 set b=\`cleandup \${c} \${b} 1\` ; \\
355 setenv \${a} \${b} ; \\
357 ###########################################################################
360 cat ${install_work}/${CSHRC} >> ${install_work}/_${CSHRC}
362 # 4. put the contents of salome.sh to _salome.sh replacing export by export(a|p) aliases where necessary
363 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
364 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
365 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
366 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
368 cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/_${SHRC}
370 # 5. Create a salome.csh file from salome.sh by replacing export by setenv, etc.
371 sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${install_work}/${SHRC} > ${INSTALL_WORK}/_tmp1 2>/dev/null
372 cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/${CSHRC}
374 # 6. Create a _salome.csh file from _salome.sh by replacing export by setenv, exporta by setenva, etc.
375 sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
376 sed -e 's%exporta \([[:alnum:]_[:blank:]]*\)%setenva \1%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
377 sed -e 's%exportp \([[:alnum:]_[:blank:]]*\)%setenvp \1%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
378 sed -e 's%if \[ -n "\${PYTHONPATH}" \] ; then%if ( ${?PYTHONPATH} ) then%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
379 sed -e 's%if \[ -n "\${ENV_FOR_LAUNCH}" \] ; then%if ( ${?ENV_FOR_LAUNCH} ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
380 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
381 sed -e 's%^\([[:blank:]]*\)fi\([[:blank:]]*\)$%\1endif\2%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
382 sed -e 's%var.sh%var.csh%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
383 sed -e 's%if \[ -e "\${LICENSE_FILE}" \] ; then%if ( -e ${LICENSE_FILE} ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
385 cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/_${CSHRC} 2>/dev/null
387 rm -f ${INSTALL_WORK}/_tmp1 ${INSTALL_WORK}/_tmp2
389 if [ $# -eq 5 ] ; then
391 if [ -e ${product_dir} ] ; then
392 test -e ${product_dir}/${SHRC} && mv ${product_dir}/${SHRC} ${product_dir}/${SHRC}_`date +%F_%T`
393 cp ${install_work}/_${SHRC} ${product_dir}/${SHRC}
394 test -e ${product_dir}/${CSHRC} && mv ${product_dir}/${CSHRC} ${product_dir}/${CSHRC}_`date +%F_%T`
395 cp ${install_work}/_${CSHRC} ${product_dir}/${CSHRC}
398 sed -e 's%setenv ENV_FOR_LAUNCH 1%setenv ENV_FOR_LAUNCH 0%' ${install_work}/_${CSHRC} > ${install_root}/env_build.csh
399 sed -e 's%export ENV_FOR_LAUNCH=1%export ENV_FOR_LAUNCH=0%' ${install_work}/_${SHRC} > ${install_root}/env_build.sh
401 cp -f ${install_work}/_${CSHRC} ${install_root}/env_products.csh
402 cp -f ${install_work}/_${SHRC} ${install_root}/env_products.sh
404 rm -f ${install_work}/_${SHRC} ${install_work}/_${CSHRC}
405 ### !!! copying build.csh and build.sh scripts
406 if [ -e ./build.csh ] && [ ! -e ${install_root}/build.csh ]; then
407 cp -f ./build.csh ${install_root}
409 if [ -e ./build.sh ] && [ ! -e ${install_root}/build.sh ]; then
410 cp -f ./build.sh ${install_root}
412 ### !!! copying release notes
413 for p in `ls ../` ; do
414 export pdf=`echo ${p} | sed s/[.]/" "/g | awk '{print $2}'`
415 if [ "${pdf}" = "pdf" ]; then
417 if [ ! -e ${install_root}/${RN} ]; then
418 cp -f ../${RN} ${install_root}
425 #try use already existing product
428 product_dir=$1; install_root=$2; install_work=$3;
429 product_sequence="$4"; installed_products="$5"; product_type=$6
430 env_file=${product_dir}/env_${product_type}.sh
431 if [ -f ${env_file} ] ; then
432 cp -f ${env_file} ${install_work}/_env_${product_type}.sh
433 make_env ${install_root} ${install_work} "${product_sequence}" "${installed_products}"
434 source ${install_work}/${SHRC}
436 if [ $? -eq 0 ] ; then
440 echo ${product_type} | grep -q '_src$'
441 if [ $? -eq 1 ] ; then
449 #check existance of lib passed as first parameter
450 #return 0 if lib exists
451 #if you pass second parameter search will be done in it
452 #otherwise search will be done in ${LD_LIBRARY_PATH}
453 #you should use : as dilimeter if you are going to pass second parameter
458 whereIs=${LD_LIBRARY_PATH}
460 for d in `echo ${whereIs} | sed -e"s%:% %g"` ; do
461 ret=`find ${d} -name $1 2>/dev/null`
462 if [ -n "${ret}" ] ; then
463 #echo "The $1 exists on yours system in a ${d} folder"
473 for i in `echo ${path} | sed -e"s%:% %g"` ; do
474 ret=`find ${i} -name ${file} -maxdepth 1 2>/dev/null`
475 if [ -n "${ret}" ] ; then
476 ret=`echo ${ret} | sed -e"s%/\${file}$%%g"`
485 arg1=$1; val1=$2; arg2=$3; val2=$4
486 tmp="^${val1}$|^${val1}:|:${val1}$|:${val1}:"
487 #echo ${val2} | grep -E "${tmp}" >/dev/null 2>&1
488 #if [ $? -eq 0 ] ; then
493 exclude_list="usr lib bin sbin etc"
494 for i in ${exclude_list} ; do
495 tmp="^/${i}/|^/${i}\$"
496 echo ${val1} | grep -E "${tmp}" >/dev/null 2>&1
497 if [ "$?" = "0" ] ; then to_tail=0; break; fi
499 if [ ${to_tail} -eq 0 ] ; then
508 maj_ver=`echo $1 | awk -F. '{if(NF>0) print $1; else print 0}'`
509 min_ver=`echo $1 | awk -F. '{if(NF>1) print $2; else print 0}'`
510 rel_ver=`echo $1 | awk -F. '{if(NF>2) print $3; else print 0}'`
511 let ver=${maj_ver}*10000+${min_ver}*100+${rel_ver}
514 for i in `echo ${PATH}:/usr/bin:/usr/local/bin | sed -e"s%:% %g"` ; do
515 ret=`find ${i} -name gcc -maxdepth 1 2>/dev/null`
516 if [ -n "${ret}" ] ; then
517 maj_ver=`${ret} -dumpversion | awk -F. '{if(NF>0) print $1; else print 0}'`
518 min_ver=`${ret} -dumpversion | awk -F. '{if(NF>1) print $2; else print 0}'`
519 rel_ver=`${ret} -dumpversion | awk -F. '{if(NF>2) print $3; else print 0}'`
520 let ver1=${maj_ver}*10000+${min_ver}*100+${rel_ver}
521 if [ ${ver1} -eq ${ver} ] ; then
522 ret=`echo ${ret} | sed -e"s%/gcc$%%g"`
526 if [ ${ver1} -gt ${ver} ] && [ ${ver1} -gt ${newerver} ] ; then
528 newer=`echo ${ret} | sed -e"s%/gcc$%%g"`
532 if [ -n "${newer}" ] ; then
540 if test -z "${TCLHOME}"; then
543 tclcfg=`find ${TCLHOME}/lib -name "tclConfig.sh" 2> /dev/null`
546 for f in ${tclcfg} ; do
547 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;}'`
548 if [ ${maxver} -lt ${ver} ]; then
553 if test -n "${file}"; then
554 echo `dirname ${file}`
563 if test -z "${TCLHOME}"; then
566 tclcfg=`find ${TCLHOME}/lib -name "tkConfig.sh" 2> /dev/null`
569 for f in ${tclcfg} ; do
570 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;}'`
571 if [ ${maxver} -lt ${ver} ]; then
576 if test -n "${file}"; then
577 echo `dirname ${file}`
586 if test -f /usr/X11R6/include/DPS/dpsconfig.h ; then
590 if test -f /usr/include/DPS/dpsconfig.h ; then
599 for d in /usr/X11R6/include /usr/include ; do
600 if [ -d ${d}/GL ] && [ -f ${d}/GL/gl.h ] ; then
612 local libdirs="/usr/X11R6/lib64 /usr/lib64 /usr/lib/`uname -m`-linux-gnu /usr/X11R6/lib /usr/lib"
614 # search libGL.so* file and correct libGL.la in the same directory
615 for d in ${libdirs} ; do
616 if [ "`ls ${d}/libGL.so* 2>/dev/null`" ] && [ -f ${d}/libGL.la ]; then
617 libdir=`grep "libdir=" ${d}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%" -e "s%/*$%%g"`
618 if [ "${libdir}" = "${d}" ] ; then
624 # search libGL.la file and check if this file is correct
625 for d in ${libdirs} ; do
626 if [ -f ${d}/libGL.la ] ; then
627 libdir=`grep "libdir=" ${d}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"`
628 if [ "`ls ${libdir}/libGL.so* 2>/dev/null`" ] ; then
634 # then search libGL.so* file
635 for d in ${libdirs} ; do
636 if [ "`ls ${d}/libGL.so* 2>/dev/null`" ] ; then
646 local libdirs="/usr/X11R6/lib64 /usr/lib64 /usr/lib/`uname -m`-linux-gnu /usr/X11R6/lib /usr/lib"
648 for d in ${libdirs} ; do
649 if [ -f ${d}/libGL.so ] ; then
659 local gllibdir="`where_gl_libs`"
660 if [ "${gllibdir}" != "" ] ; then
661 #VSR: 02/04/2013 - next block is commented as it seems to be wrong :( libGL.la should not be ever mentioned
662 # if [ -f ${gllibdir}/libGL.la ] ; then
663 # libdir=`grep "libdir=" ${gllibdir}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"`
664 # if [ "`ls ${libdir}/libGL.so* 2>/dev/null`" ] ; then
665 # str_to_replace="${gllibdir}/libGL.la"
668 if [ "${str_to_replace}" = "" ] ; then
669 str_to_replace="-L${gllibdir} -lGL"
672 la_files=`find . -name "*.la"`
673 for la_file in ${la_files} XXX ; do
674 if [ "${la_file}" = "XXX" ] ; then continue; fi
675 grep -e "libGL.la" ${la_file} >& /dev/null || grep -e "-lGL\b" ${la_file} >& /dev/null && \
676 sed -e "s%-lGL\b%%g" \
677 -e "s%[^[:space:]']*libGL.la[[:space:]]%%g" \
678 -e "s%^dependency_libs='\(.*\)%dependency_libs='${str_to_replace} \1%" \
679 ${la_file} > ${la_file}.new && \
680 mv -f ${la_file}.new ${la_file}
689 if [ -z "${ldir}" ] || [ ! -d "${ldir}" ]; then return 1; fi
693 SALOME_MODULES="`env | awk -F_ '/[a-zA-Z0-9]*_ROOT_DIR/ { print $1 }'`"
697 la_files=`find . -name "*.la"`
700 netgendir=${NETGEN_ROOT_DIR}
702 freetypedir=${FREETYPE_ROOT_DIR}
704 ftgldir=${FTGL_ROOT_DIR}
706 gl2psdir=${GL2PS_ROOT_DIR}
708 freeimagedir=${FREEIMAGE_ROOT_DIR}
710 tbbbasedir=${TBB_ROOT_DIR}
711 TBBKERNEL='cc4.1.0_libc2.4_kernel2.6.16.21'
712 if test `uname -m` = "x86_64" ; then
713 export TBBMODE="intel64/${TBBKERNEL}"
715 export TBBMODE="ia32/${TBBKERNEL}"
717 tbbdir=${tbbbasedir}/lib/${TBBMODE}
719 cgnslibdir=${CGNS_ROOT_DIR}
721 casdir=${CAS_ROOT_DIR}/lib
722 if [ ! -d ${casdir} ] ; then casdir=${CAS_ROOT_DIR}/Linux/lib ; fi
723 if [ ! -d ${casdir} ] ; then casdir=${CAS_ROOT_DIR}/lin/lib ; fi
725 omnidir=${OMNIORB_ROOT_DIR}/lib
728 if [ `uname -m` = "x86_64" ] && [ -d ${vtkpath}/lib64 ] ; then
730 elif [ -d ${vtkpath}/lib ] ; then
735 vtkldir=${vtkpath}/lib${LIB_PREFIX}
736 vtkdir=${vtkldir}/vtk-5.0
738 hdfdir=${HDF5_ROOT_DIR}/lib
740 meddir=${MEDFILE_ROOT_DIR}/lib
742 qwtdir=`find_in_path libqwt.so ${LD_LIBRARY_PATH}`
744 where_python=`which python` # e.g. /usr/bin/python
745 if [ -n "${where_python}" ] ; then
746 where_python=`dirname ${where_python}` # --> /usr/bin
747 where_python=`dirname ${where_python}` # --> /usr
748 python_version=`python -c "import sys; print sys.version[:3]"`
749 pythondir=${where_python}/lib/python${python_version}
752 sipdir=`find_in_path sip.so ${LD_LIBRARY_PATH}`
754 pyqtdir=`find_in_path Qt.so ${LD_LIBRARY_PATH}`
756 tcldir=${TCLHOME}/lib
758 boostdir=${BOOST_ROOT_DIR}/lib
760 blsurfdir=${BLSURFHOME}/lib
762 libxmldir=${LIBXML2_ROOT_DIR}/lib
764 metisdir=${METIS_ROOT_DIR}
766 scotchbindir=${SCOTCH_ROOT_DIR}/bin
767 scotchlibdir=${SCOTCH_ROOT_DIR}/lib
769 if test `uname -m` = "x86_64" ; then
770 libGLpath=/usr/lib64/libGL.la
772 libGLpath=/usr/lib/libGL.la
775 graphvizdir=${GRAPHVIZ_ROOT_DIR}/lib
777 qscintilladir=${QSCINTILLA_ROOT_DIR}/lib
779 expatdir=${EXPAT_ROOT_DIR}/lib
781 paraviewdir=${PARAVIEW_ROOT_DIR}/lib
783 qtdir=${QT4_ROOT_DIR}/lib
784 # distene meshgems dir
785 if test `uname -m` = "x86_64" ; then
786 mgemsdir=${MESHGEMS_ROOT_DIR}/lib/Linux_64
788 mgemsdir=${MESHGEMS_ROOT_DIR}/lib/Linux
791 for l in X ${la_files}; do
793 if [ "${l}" != "X" ] ; then
798 # . process salome modules dependencies
799 for mod in ${SALOME_MODULES} ; do
800 moddir=${mod}_ROOT_DIR
802 if [ -n "${moddir}" ] ; then
803 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[1]\?/lib% \1${moddir}/lib%g" \
804 -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}WOGUI[1]\?/lib% \1${moddir}/lib%g" \
805 -e "s%^libdir='[^[:space:]]*${mod}[1]\?/\(lib.*\)'%libdir='${moddir}/\1'%g" \
806 -e "s%^libdir='[^[:space:]]*${mod}WOGUI[1]\?/\(lib.*\)'%libdir='${moddir}/\1'%g" ${l} > ${l}"_"
811 # . process netgen dependencies
812 if [ -n "${netgendir}" ] && [ -d "${netgendir}" ] ; then
813 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*netgen-[0-9.]\+/lib% \1${netgendir}/lib%g" ${l}
816 # . process freetype dependencies
817 if [ -n "${freetypedir}" ] && [ -d "${freetypedir}" ] ; then
818 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*freetype-[0-9.]\+/lib% \1${freetypedir}/lib%g" ${l}
821 # . process ftgl dependencies
822 if [ -n "${ftgldir}" ] && [ -d "${ftgldir}" ] ; then
823 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*ftgl-[0-9.]\+/lib% \1${ftgldir}/lib%g" ${l}
826 # . process gl2ps dependencies
827 if [ -n "${gl2psdir}" ] && [ -d "${gl2psdir}" ] ; then
828 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*gl2ps-[0-9.]\+/lib% \1${gl2psdir}/lib%g" ${l}
831 # . process freeimage dependencies
832 if [ -n "${freeimagedir}" ] && [ -d "${freeimagedir}" ] ; then
833 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*freeimage-[0-9.]\+/lib% \1${freeimagedir}/lib%g" ${l}
836 # . process tbb dependencies
837 if [ -n "${tbbdir}" ] && [ -d "${tbbdir}" ] ; then
838 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*tbb[^[:space:]]*/lib[^[:space:]]*% \1${tbbdir}%g" ${l}
841 # . process cgns dependencies
842 if [ -n "${cgnslibdir}" ] && [ -d "${cgnslibdir}" ] ; then
843 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*cgnslib-[0-9.]\+/lib% \1${cgnslibdir}/lib%g" ${l}
846 # . process CAS.CADE dependencies
847 if [ -n "${CAS_ROOT_DIR}" ] && [ -d "${casdir}" ] ; then
848 sed -e "s%-L[^[:space:]]*OCCT[^[:space:]]*/install/lib%-L${casdir}%g" \
849 -e "s%[^[:space:]]*OCCT[^[:space:]]*/install/lib/%${casdir}/%g" \
850 -e "s%[[:space:]]-L[^[:space:]]*\(OCCT\|CAS\)[^[:space:]]*/lib\?% -L${CAS_ROOT_DIR}/lib%g" \
851 -e "s%[[:space:]][^[:space:]]*\(OCCT\|CAS\)[^[:space:]]*/lib/lib\?% ${CAS_ROOT_DIR}/lib/lib%g" ${l} > ${l}"_"
855 # . process omniORB dependencies
856 if [ -n "${OMNIORB_ROOT_DIR}" ] && [ -d "${omnidir}" ] ; then
857 sed -i "s%-L[^[:space:]]*omni[^[:space:]]*%-L${omnidir}%g;s%-R[^[:space:]]*omni[^[:space:]]*%-R${omnidir}%g" ${l}
860 # . process VTK dependencies
861 if [ -n "${VTK_DIR}" ] && [ -d "${vtkdir}" ] && [ -d "${vtkldir}" ] ; then
862 sed -i "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)/vtk\-5\.0%-L${vtkdir}%g;s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)%-L${vtkldir}%g" ${l}
865 # . process HDF dependencies
866 if [ -n "${HDF5_ROOT_DIR}" ] && [ -d "${hdfdir}" ] ; then
867 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*hdf[^[:space:]/]*/lib% \1${hdfdir}%g" ${l}
870 # . process MED dependencies
871 if [ -n "${MEDFILE_ROOT_DIR}" ] && [ -d "${meddir}" ] ; then
872 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*med[^[:space:]/]*/lib% \1${meddir}%g" ${l}
875 # . process qwt dependencies
876 if [ -n "${qwtdir}" ] && [ -d "${qwtdir}" ] ; then
877 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*qwt[^[:space:]/]*/lib% \1${qwtdir}%g" ${l}
880 # . process qt dependencies
881 if [ -n "${QT4_ROOT_DIR}" ] && [ -d "${qtdir}" ] ; then
882 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*qt[^[:space:]/]*/lib% \1${qtdir}%g" ${l}
885 # . process python dependencies
886 if [ -n "${pythondir}" ] && [ -d "${pythondir}" ] ; then
887 sed -i "s%-L[^[:space:]]*python[0-9]\.[0-9]\([^[:space:]]*\)%-L${pythondir}\1%g" ${l}
890 # . process sip dependencies
891 if [ -n "${sipdir}" ] && [ -d "${sipdir}" ] ; then
892 sed -i "s%-L[^[:space:]]*sip[^[:space:]]*%-L${sipdir}%g" ${l}
895 # . process PyQt dependencies
896 if [ -n "${pyqtdir}" ] && [ -d "${pyqtdir}" ] ; then
897 sed -i "s%-L[^[:space:]]*PyQt[^[:space:]]*%-L${pyqtdir}%g" ${l}
900 # . process tcl/tk dependencies
901 if [ -n "${tcldir}" ] && [ -d "${tcldir}" ] ; then
902 sed -i "s%-L[^[:space:]]*tcltk[^[:space:]]*/lib%-L${tcldir}%g" ${l}
905 # . process boost dependencies
906 if [ -n "${boostdir}" ] && [ -d "${boostdir}" ] ; then
907 sed -i "s%-L[^[:space:]]*boost[^[:space:]]*/lib%-L${boostdir}%g" ${l}
910 # . process blsurf dependencies
911 if [ -n "${blsurfdir}" ] && [ -d "${blsurfdir}" ] ; then
912 sed -i "s%-L[^[:space:]]*BLSurf[^[:space:]]*/lib%-L${blsurfdir}%g" ${l}
915 # . process libxml dependencies
916 if [ -n "${libxmldir}" ] && [ -d "${libxmldir}" ] ; then
917 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*libxml2-[0-9]\.[0-9]\.[0-9]/lib% \1${libxmldir}%g;s%[[:space:]]\(-L\)\?[^[:space:]]*libxml2/lib% \1${libxmldir}%g" ${l}
920 # . process metis dependencies
921 if [ -n "${metisdir}" ] && [ -d "${metisdir}" ] ; then
922 sed -i "s%-L[^[:space:]]*metis[^[:space:]]*%-L${metisdir}%g" ${l}
925 # . process scotch dependencies
926 if [ -n "${scotchbindir}" ] && [ -d "${scotchbindir}" ] ; then
927 sed -i "s%-L[^[:space:]]*scotch[^[:space:]]*/bin%-L${scotchbindir}%g" ${l}
929 if [ -n "${scotchlibdir}" ] && [ -d "${scotchlibdir}" ] ; then
930 sed -i "s%-L[^[:space:]]*scotch[^[:space:]]*/lib%-L${scotchlibdir}%g" ${l}
933 # . process libGL.la dependencies
934 sed -i "s%${libGLpath}%""%g" ${l}
936 # . process graphviz dependencies
937 if [ -n "${graphvizdir}" ] && [ -d "${graphvizdir}" ] ; then
938 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*graphviz-[0-9]\.[0-9]\+\.[0-9]/lib% \1${graphvizdir}%g;s%[[:space:]]\(-L\)\?[^[:space:]]*graphviz/lib% \1${graphvizdir}%g" ${l}
941 # . process QScintilla dependencies
942 if [ -n "${qscintilladir}" ] && [ -d "${qscintilladir}" ] ; then
943 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*QScintilla-[0-9]\.[0-9]\(\.[0-9]\)\?/lib% \1${qscintilladir}%g" ${l}
946 # . process expat-2.0.1 dependencies
947 if [ -n "${expatdir}" ] && [ -d "${expatdir}" ] ; then
948 sed -i "s%-L[^[:space:]]*expat[^[:space:]]*/lib%-L${expatdir}%g;s%[^[:space:]]*expat[^[:space:]]*/lib/libexpat.la%-lexpat%g" ${l}
951 # . process ParaView dependencies
952 if [ -n "${paraviewdir}" ] && [ -d "${paraviewdir}" ] ; then
953 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*ParaView-[0-9]\.[0-9]\+\.[0-9]/lib% \1${paraviewdir}%g" ${l}
956 # . process DISTENE MeshGems dependencies
957 if [ -n "${mgemsdir}" ] && [ -d "${mgemsdir}" ] ; then
958 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*MeshGems-[0-9.]\+/Products/lib/Linux\(_64\)\?% \1${mgemsdir}%g" ${l}
970 if [ "${nf}" = "" ] || [ ! -e ${nf} ] ; then
973 if [ "${PYTHON_ROOT_DIR}" != "" ] ; then
974 sed -i "s%\([^/]*\)[^; ]*/Python-[0-9.]\+%\1${PYTHON_ROOT_DIR}%g" $1
976 if [ "${SWIG_ROOT_DIR}" != "" ] ; then
977 sed -i "s%\([^/]*\)[^; ]*/swig-[0-9.]\+%\1${SWIG_ROOT_DIR}%g" $1
979 if [ "${OMNIORB_ROOT_DIR}" != "" ] ; then
980 sed -i "s%\([^/]*\)[^; ]*/omniORB-[0-9.]\+%\1${OMNIORB_ROOT_DIR}%g" $1
982 if [ "${HDF5_ROOT_DIR}" != "" ] ; then
983 sed -i "s%\([^/]*\)[^; ]*/hdf5-[0-9.]\+%\1${HDF5_ROOT_DIR}%g" $1
985 if [ "${BOOST_ROOT_DIR}" != "" ] ; then
986 sed -i "s%\([^/]*\)[^; ]*/boost-[0-9.]\+%\1${BOOST_ROOT_DIR}%g" $1
988 if [ "${MEDFILE_ROOT_DIR}" != "" ] ; then
989 sed -i "s%\([^/]*\)[^; ]*/med-[0-9.]\+%\1${MEDFILE_ROOT_DIR}%g" $1
991 if [ "${QT4_ROOT_DIR}" != "" ] ; then
992 sed -i "s%\([^/]*\)[^; ]*/qt-[0-9.]\+%\1${QT4_ROOT_DIR}%g" $1
994 if [ "${QWT_ROOT_DIR}" != "" ] ; then
995 sed -i "s%\([^/]*\)[^; ]*/qwt-[0-9.]\+%\1${QWT_ROOT_DIR}%g" $1
997 if [ "${SIP_ROOT_DIR}" != "" ] ; then
998 sed -i "s%\([^/]*\)[^; ]*/sip-[0-9.]\+%\1${SIP_ROOT_DIR}%g" $1
1000 if [ "${PYQT4_ROOT_DIR}" != "" ] ; then
1001 sed -i "s%\([^/]*\)[^; ]*/PyQt-[0-9.]\+%\1${PYQT4_ROOT_DIR}%g" $1
1003 if [ "${QSCINTILLA_ROOT_DIR}" != "" ] ; then
1004 sed -i "s%\([^/]*\)[^; ]*/QScintilla-[0-9.]\+%\1${QSCINTILLA_ROOT_DIR}%g" $1
1006 if [ "${PARAVIEW_ROOT_DIR}" != "" ] ; then
1007 sed -i "s%\([^/]*\)[^; ]*/ParaView-[0-9.]\+%\1${PARAVIEW_ROOT_DIR}%g" $1
1009 if [ "${LIBXML2_ROOT_DIR}" != "" ] ; then
1010 sed -i "s%\([^/]*\)[^; ]*/libxml2-[0-9.]\+%\1${LIBXML2_ROOT_DIR}%g" $1
1012 if [ "${EXPAT_ROOT_DIR}" != "" ] ; then
1013 sed -i "s%\([^/]*\)[^; ]*/expat-[0-9.]\+%\1${EXPAT_ROOT_DIR}%g" $1
1015 if [ "${FREETYPE_ROOT_DIR}" != "" ] ; then
1016 sed -i "s%\([^/]*\)[^; ]*/freetype-[0-9.]\+%\1${FREETYPE_ROOT_DIR}%g" $1
1018 if [ "${FREEIMAGE_ROOT_DIR}" != "" ] ; then
1019 sed -i "s%\([^/]*\)[^; ]*/freeimage-[0-9.]\+%\1${FREEIMAGE_ROOT_DIR}%g" $1
1021 if [ "${GL2PS_ROOT_DIR}" != "" ] ; then
1022 sed -i "s%\([^/]*\)[^; ]*/gl2ps-[0-9.]\+%\1${GL2PS_ROOT_DIR}%g" $1
1024 if [ "${TBB_ROOT_DIR}" != "" ] ; then
1025 sed -i "s%\([^/]*\)[^; ]*/tbb[^/; \"]\+%\1${TBB_ROOT_DIR}%g" $1
1027 if [ "${CAS_ROOT_DIR}" != "" ] ; then
1028 sed -i "s%\([^/]*\)[^; ]*/OCCT[^/]*\(/[^ /;\"]*\)\?\(\"\|/inc\|/lib\)%\1${CAS_ROOT_DIR}\3%g" $1
1030 if [ "${NETGEN_ROOT_DIR}" != "" ] ; then
1031 sed -i "s%\([^/]*\)[^; ]*/netgen-[0-9.]\+%\1${NETGEN_ROOT_DIR}%g" $1
1033 if [ "${CGNS_ROOT_DIR}" != "" ] ; then
1034 sed -i "s%\([^/]*\)[^; ]*/cgnslib-[0-9.]\+%\1${CGNS_ROOT_DIR}%g" $1
1036 if [ "${NUMPY_ROOT_DIR}" != "" ] ; then
1037 sed -i "s%\([^/]*\)[^; ]*/numpy-[0-9.]\+%\1${NUMPY_ROOT_DIR}%g" $1
1039 if [ "${GRAPHVIZ_ROOT_DIR}" != "" ] ; then
1040 sed -i "s%\([^/]*\)[^; ]*/graphviz-[0-9.]\+%\1${GRAPHVIZ_ROOT_DIR}%g" $1
1042 if [ "${DOXYGEN_ROOT_DIR}" != "" ] ; then
1043 sed -i "s%\([^/]*\)[^; ]*/doxygen-[0-9.]\+%\1${DOXYGEN_ROOT_DIR}%g" $1
1045 if [ "${SPHINX_ROOT_DIR}" != "" ] ; then
1046 sed -i "s%\([^/]*\)[^; ]*/Sphinx-[0-9.]\+%\1${SPHINX_ROOT_DIR}%g" $1
1048 if [ "${WSO2_ROOT_DIR}" != "" ] ; then
1049 sed -i "s%\([^/]*\)[^; ]*/wso2-wsf-cpp-[0-9.]\+%\1${WSO2_ROOT_DIR}%g" $1
1051 if [ "${MESHGEMS_ROOT_DIR}" != "" ] ; then
1052 sed -i "s%\([^/]*\)[^; ]*/MeshGems-[0-9.]\+%\1${MESHGEMS_ROOT_DIR}%g" $1
1054 if [ "${METIS_ROOT_DIR}" != "" ] ; then
1055 sed -i "s%\([^/]*\)[^; ]*/metis-[0-9.]\+%\1${METIS_ROOT_DIR}%g" $1
1057 if [ "${SCOTCH_ROOT_DIR}" != "" ] ; then
1058 sed -i "s%\([^/]*\)[^; ]*/scotch-[0-9.]\+%\1${SCOTCH_ROOT_DIR}%g" $1
1060 local libglso=`where_libgl_so`
1063 for sm in LIBBATCH SIMANIO KERNEL GUI GEOM MED SMESH PARAVIS YACS HEXABLOCK HOMARD JOBMANAGER \
1064 NETGENPLUGIN BLSURFPLUGIN GHS3DPLUGIN GHS3DPRLPLUGIN HexoticPLUGIN HEXABLOCKPLUGIN \
1065 CALCULATOR PYCALCULATOR COMPONENT HELLO PYHELLO LIGHT PYLIGHT ATOMIC ATOMGEN ATOMSOLV RANDOMIZER SIERPINSKY ; do
1066 smvar=${sm}_ROOT_DIR
1067 if [ "${!smvar}" != "" ] ; then
1068 sed -i "s%\([; \"]\)/[^; \"]\+/${sm}\([; \"/]\)%\1${!smvar}\2%g" $1
1070 grep libGL.so $1 > /dev/null && sed -i "s%\([; \"]\)/[^; \"]\+/libGL.so[0-9.]*%\1${libglso}%g" $1