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-2013 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.3.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
139 ### !!! The next is for RedHat 9 only !!!
140 if [ -f /etc/redhat-release ] ; then
141 grep -e "Red Hat Linux release 9" /etc/redhat-release > /dev/null
142 if [ $? -eq 0 ] ; then
143 cat >> ${install_work}/${SHRC} <<EOF
144 #${DELIM} Force RH9 to use old implementation of threads ${DELIM}
145 export LD_ASSUME_KERNEL=2.4.18
150 ### !!! writing salome.csh file !!! -> set inital variables
151 pre_vars="PATH LD_LIBRARY_PATH LD_RUN_PATH PYTHONPATH TCLLIBPATH"
152 for i in ${pre_vars} ; do
153 cat >> ${install_work}/${CSHRC} <<EOF
154 #${DELIM} setting initial ${i} ${DELIM}
155 if (! (\$?${i}) ) then
162 ### !!! writing salome.(c)sh files !!! -> dump products environment files, changing 'export' by 'setenv(a|p)' where necessary
163 ### Note, that for performance reasons temporary environment files used during installation procedure itself
164 ### are created without using setenv(a|p) aliases.
166 # 0. add /usr/lib or /usr/lib64 dir to the LD_LIBRARY_PATH
167 #if test `uname -m` = "x86_64" ; then
168 #echo 'export LD_LIBRARY_PATH=/usr/lib64:${LD_LIBRARY_PATH}' >> ${install_work}/${SHRC} 2>/dev/null
169 #echo '' >> ${install_work}/${SHRC} 2>/dev/null
171 #echo 'export LD_LIBRARY_PATH=/usr/lib:${LD_LIBRARY_PATH}' >> ${install_work}/${SHRC} 2>/dev/null
172 #echo '' >> ${install_work}/${SHRC} 2>/dev/null
177 # Source of license environment file
179 echo '#------ License activation ------' >> ${install_work}/${SHRC} 2>/dev/null
180 echo 'export LICENSE_FILE=/product/distene/dlim8.var.sh' >> ${install_work}/${SHRC} 2>/dev/null
181 echo '' >> ${install_work}/${SHRC} 2>/dev/null
182 echo 'if [ -e "${LICENSE_FILE}" ] ; then' >> ${install_work}/${SHRC} 2>/dev/null
183 echo 'export SIMULOGD_LICENSE_FILE=29029@soleil' >> ${install_work}/${SHRC} 2>/dev/null
184 echo 'source ${LICENSE_FILE}' >> ${install_work}/${SHRC} 2>/dev/null
185 echo 'fi' >> ${install_work}/${SHRC} 2>/dev/null
186 echo '' >> ${install_work}/${SHRC} 2>/dev/null
188 # 1. first dump all environment files into the ${SHRC} file
189 product_sequence="$2"
190 install_products="$3"
191 for i in ${product_sequence} ; do
192 env_file=${install_work}/env_${i}.sh
193 _env_file=${install_work}/_env_${i}.sh
194 if [ -e ${_env_file} ] ; then
195 cat ${_env_file} >> ${install_work}/${SHRC} 2>/dev/null
196 elif [ -e ${env_file} ] ; then
197 echo ${install_products} | grep -q "\b${i}\b"
198 if [ $? -eq 1 ] ; then
199 cat ${env_file} | sed 's/^/## /' >> ${install_work}/${SHRC} 2>/dev/null
201 cat ${env_file} >> ${install_work}/${SHRC} 2>/dev/null
206 # 2. writing global functions to _salome.sh file
207 cat >> ${install_work}/_${SHRC} <<EOF
208 ##########################################################################
209 # Functions exporta and exportp are used to append/prepend correspondingly
210 # one directory or a set of directories separated by semicolon symbol (':')
211 # to the environment variables like PATH, LD_LIBRARY_PATH, PYTHONPATH,
213 # The main purpose is to replace default setenv command behavior:
214 # exporta, exportp also remove duplicated entries, shortening in that way
215 # the environment variables.
216 # If some directory being added is already included into the variable
217 # nothing is done for it.
218 # Note, that these functions work some slower that setenv command itself.
221 # appends/prepends set of directories (second parameter)
222 # to the another set of directories (first parameter) and
223 # removes duplicated entries;
224 # the third parameter defines the mode: 0 - append, 1 - prepend
226 out_var=\`echo \$1 \$2 | awk -v dir=\$3 '{ \\
227 na = split(\$2,a,":"); \\
231 if(\$1 != "<empty>") { \\
232 nb = split(\$1,b,":"); \\
233 for(i=1;i<=nb;i++) { \\
234 if(!(b[i] in ccc) ) { \\
242 for(i=1;i<=na;i++) { \\
243 if(!(a[i] in ccc)) { \\
250 for(i=1;i<k2;i++) { \\
253 for(i=1;i<k1;i++) { \\
258 for(i=1;i<k1;i++) { \\
261 for(i=1;i<k2;i++) { \\
265 }' | sed -e 's/\(.*\):/\1/g'\`
269 # appends directory or set of directories, separated by ':' (second parameter)
270 # to the variable (first parameter)
273 if [ -z "\${xenv}" ]; then xenv="<empty>"; fi
274 out_var=\`cleandup \${xenv} \$2 0\`
275 export \$1=\${out_var}
278 # prepends directory or set of directories, separated by ':' (second parameter)
279 # to the variable (first parameter)
282 if [ -z "\${xenv}" ]; then xenv="<empty>"; fi
283 out_var=\`cleandup \${xenv} \$2 1\`
284 export \$1=\${out_var}
286 ###########################################################################
290 # 3. writing global functions to _salome.csh file
291 cat >> ${install_work}/_${CSHRC} <<EOF
293 ###########################################################################
294 # Aliases setenva and setenvp are used to append/prepend correspondingly
295 # one directory or a set of directories separated by semicolon symbol (':')
296 # to the environment variables like PATH, LD_LIBRARY_PATH, PYTHONPATH,
298 # The main purpose is to replace default setenv command behavior:
299 # setenva, setenvp also remove duplicated entries, shortening in that way
300 # the environment variables.
301 # If some directory being added is already included into the variable
302 # nothing is done for it.
303 # Note, that these aliases work some slower that setenv command itself.
306 # appends/prepends set of directories (second parameter)
307 # to the another set of directories (first parameter) and
308 # removes duplicated entries;
309 # the third parameter defines the mode: 0 - append, 1 - prepend
310 alias cleandup "echo \!:1 \!:2 | awk -v dir=\!:3 \\\\
311 '"'{ na = split(\$2,a,":"); \\\\
315 if(\$1 != "<empty>") { \\\\
316 nb = split(\$1,b,":"); \\\\
317 for(i=1;i<=nb;i++) { \\\\
318 if(!(b[i] in ccc) ) { \\\\
326 for(i=1;i<=na;i++) { \\\\
327 if(!(a[i] in ccc)) { \\\\
334 for(i=1;i<k2;i++) { \\\\
337 for(i=1;i<k1;i++) { \\\\
342 for(i=1;i<k1;i++) { \\\\
345 for(i=1;i<k2;i++) { \\\\
349 }'"' | sed -e 's/\(.*\):/\1/g'"
351 # appends directory or set of directories, separated by ':' (second parameter)
352 # to the variable (first parameter)
353 alias setenva 'set a=\!:1 ; set b=\!:2 ; \\
354 set c=\`printenv \${a}\` ; \\
355 set b=\`cleandup \${c} \${b} 0\` ; \\
356 setenv \${a} \${b} ; \\
360 # prepends directory or set of directories, separated by ':' (second parameter)
361 # to the variable (first parameter)
362 alias setenvp 'set a=\!:1 ; set b=\!:2 ; \\
363 set c=\`printenv \${a}\` ; \\
364 set b=\`cleandup \${c} \${b} 1\` ; \\
365 setenv \${a} \${b} ; \\
367 ###########################################################################
370 cat ${install_work}/${CSHRC} >> ${install_work}/_${CSHRC}
372 # 4. put the contents of salome.sh to _salome.sh replacing export by export(a|p) aliases where necessary
373 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
374 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
375 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
376 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
378 # Setting "/usr/X11R6/lib" path in LD_LIBRARY_PATH for the libGL.so.1 file
379 #if test `uname -m` = "x86_64" ; then
380 #echo '# Setting /usr/X11R6/lib64 path in LD_LIBRARY_PATH for the libGL.so.1 file' >> ${INSTALL_WORK}/_tmp2
381 #echo 'export LD_LIBRARY_PATH=/usr/X11R6/lib64:${LD_LIBRARY_PATH}' >> ${INSTALL_WORK}/_tmp2
383 #echo '# Setting /usr/X11R6/lib path in LD_LIBRARY_PATH for the libGL.so.1 file' >> ${INSTALL_WORK}/_tmp2
384 #echo 'export LD_LIBRARY_PATH=/usr/X11R6/lib:${LD_LIBRARY_PATH}' >> ${INSTALL_WORK}/_tmp2
387 cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/_${SHRC}
389 # 5. Create a salome.csh file from salome.sh by replacing export by setenv, etc.
390 sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${install_work}/${SHRC} > ${INSTALL_WORK}/_tmp1 2>/dev/null
391 cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/${CSHRC}
393 # 6. Create a _salome.csh file from _salome.sh by replacing export by setenv, exporta by setenva, etc.
394 sed -e 's%export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
395 sed -e 's%exporta \([[:alnum:]_[:blank:]]*\)%setenva \1%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
396 sed -e 's%exportp \([[:alnum:]_[:blank:]]*\)%setenvp \1%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
397 sed -e 's%if \[ -n "\${PYTHONPATH}" \] ; then%if ( ${?PYTHONPATH} ) then%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
398 sed -e 's%if \[ -n "\${ENV_FOR_LAUNCH}" \] ; then%if ( ${?ENV_FOR_LAUNCH} ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
399 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
400 sed -e 's%^\([[:blank:]]*\)fi\([[:blank:]]*\)$%\1endif\2%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
401 sed -e 's%var.sh%var.csh%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null
402 sed -e 's%if \[ -e "\${LICENSE_FILE}" \] ; then%if ( -e ${LICENSE_FILE} ) then%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null
404 cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/_${CSHRC} 2>/dev/null
406 rm -f ${INSTALL_WORK}/_tmp1 ${INSTALL_WORK}/_tmp2
408 if [ $# -eq 5 ] ; then
410 if [ -e ${product_dir} ] ; then
411 test -e ${product_dir}/${SHRC} && mv ${product_dir}/${SHRC} ${product_dir}/${SHRC}_`date +%F_%T`
412 cp ${install_work}/_${SHRC} ${product_dir}/${SHRC}
413 test -e ${product_dir}/${CSHRC} && mv ${product_dir}/${CSHRC} ${product_dir}/${CSHRC}_`date +%F_%T`
414 cp ${install_work}/_${CSHRC} ${product_dir}/${CSHRC}
417 sed -e 's%setenv ENV_FOR_LAUNCH 1%setenv ENV_FOR_LAUNCH 0%' ${install_work}/_${CSHRC} > ${install_root}/env_build.csh
418 sed -e 's%export ENV_FOR_LAUNCH=1%export ENV_FOR_LAUNCH=0%' ${install_work}/_${SHRC} > ${install_root}/env_build.sh
420 cp -f ${install_work}/_${CSHRC} ${install_root}/env_products.csh
421 cp -f ${install_work}/_${SHRC} ${install_root}/env_products.sh
423 rm -f ${install_work}/_${SHRC} ${install_work}/_${CSHRC}
424 ### !!! copying build.csh and build.sh scripts
425 if [ -e ./build.csh ] && [ ! -e ${install_root}/build.csh ]; then
426 cp -f ./build.csh ${install_root}
428 if [ -e ./build.sh ] && [ ! -e ${install_root}/build.sh ]; then
429 cp -f ./build.sh ${install_root}
431 ### !!! copying release notes
432 for p in `ls ../` ; do
433 export pdf=`echo ${p} | sed s/[.]/" "/g | awk '{print $2}'`
434 if [ "${pdf}" = "pdf" ]; then
436 if [ ! -e ${install_root}/${RN} ]; then
437 cp -f ../${RN} ${install_root}
444 #try use already existing product
447 product_dir=$1; install_root=$2; install_work=$3;
448 product_sequence="$4"; installed_products="$5"; product_type=$6
449 env_file=${product_dir}/env_${product_type}.sh
450 if [ -f ${env_file} ] ; then
451 cp -f ${env_file} ${install_work}/_env_${product_type}.sh
452 make_env ${install_root} ${install_work} "${product_sequence}" "${installed_products}"
453 source ${install_work}/${SHRC}
455 if [ $? -eq 0 ] ; then
459 echo ${product_type} | grep -q '_src$'
460 if [ $? -eq 1 ] ; then
468 #check existance of lib passed as first parameter
469 #return 0 if lib exists
470 #if you pass second parameter search will be done in it
471 #otherwise search will be done in ${LD_LIBRARY_PATH}
472 #you should use : as dilimeter if you are going to pass second parameter
477 whereIs=${LD_LIBRARY_PATH}
479 for d in `echo ${whereIs} | sed -e"s%:% %g"` ; do
480 ret=`find ${d} -name $1 2>/dev/null`
481 if [ -n "${ret}" ] ; then
482 #echo "The $1 exists on yours system in a ${d} folder"
492 for i in `echo ${path} | sed -e"s%:% %g"` ; do
493 ret=`find ${i} -name ${file} -maxdepth 1 2>/dev/null`
494 if [ -n "${ret}" ] ; then
495 ret=`echo ${ret} | sed -e"s%/\${file}$%%g"`
504 arg1=$1; val1=$2; arg2=$3; val2=$4
505 tmp="^${val1}$|^${val1}:|:${val1}$|:${val1}:"
506 #echo ${val2} | grep -E "${tmp}" >/dev/null 2>&1
507 #if [ $? -eq 0 ] ; then
512 exclude_list="usr lib bin sbin etc"
513 for i in ${exclude_list} ; do
514 tmp="^/${i}/|^/${i}\$"
515 echo ${val1} | grep -E "${tmp}" >/dev/null 2>&1
516 if [ "$?" = "0" ] ; then to_tail=0; break; fi
518 if [ ${to_tail} -eq 0 ] ; then
527 maj_ver=`echo $1 | awk -F. '{if(NF>0) print $1; else print 0}'`
528 min_ver=`echo $1 | awk -F. '{if(NF>1) print $2; else print 0}'`
529 rel_ver=`echo $1 | awk -F. '{if(NF>2) print $3; else print 0}'`
530 let ver=${maj_ver}*10000+${min_ver}*100+${rel_ver}
533 for i in `echo ${PATH}:/usr/bin:/usr/local/bin | sed -e"s%:% %g"` ; do
534 ret=`find ${i} -name gcc -maxdepth 1 2>/dev/null`
535 if [ -n "${ret}" ] ; then
536 maj_ver=`${ret} -dumpversion | awk -F. '{if(NF>0) print $1; else print 0}'`
537 min_ver=`${ret} -dumpversion | awk -F. '{if(NF>1) print $2; else print 0}'`
538 rel_ver=`${ret} -dumpversion | awk -F. '{if(NF>2) print $3; else print 0}'`
539 let ver1=${maj_ver}*10000+${min_ver}*100+${rel_ver}
540 if [ ${ver1} -eq ${ver} ] ; then
541 ret=`echo ${ret} | sed -e"s%/gcc$%%g"`
545 if [ ${ver1} -gt ${ver} ] && [ ${ver1} -gt ${newerver} ] ; then
547 newer=`echo ${ret} | sed -e"s%/gcc$%%g"`
551 if [ -n "${newer}" ] ; then
559 if test -z "${TCLHOME}"; then
562 tclcfg=`find ${TCLHOME}/lib -name "tclConfig.sh" 2> /dev/null`
565 for f in ${tclcfg} ; do
566 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;}'`
567 if [ ${maxver} -lt ${ver} ]; then
572 if test -n "${file}"; then
573 echo `dirname ${file}`
582 if test -z "${TCLHOME}"; then
585 tclcfg=`find ${TCLHOME}/lib -name "tkConfig.sh" 2> /dev/null`
588 for f in ${tclcfg} ; do
589 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;}'`
590 if [ ${maxver} -lt ${ver} ]; then
595 if test -n "${file}"; then
596 echo `dirname ${file}`
605 if test -f /usr/X11R6/include/DPS/dpsconfig.h ; then
609 if test -f /usr/include/DPS/dpsconfig.h ; then
618 for d in /usr/X11R6/include /usr/include ; do
619 if [ -d ${d}/GL ] && [ -f ${d}/GL/gl.h ] ; then
631 # search libGL.so* file and correct libGL.la in the same directory
632 for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
633 if [ "`ls ${d}/libGL.so* 2>/dev/null`" ] && [ -f ${d}/libGL.la ]; then
634 libdir=`grep "libdir=" ${d}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%" -e "s%/*$%%g"`
635 if [ "${libdir}" = "${d}" ] ; then
641 # search libGL.la file and check if this file is correct
642 for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
643 if [ -f ${d}/libGL.la ] ; then
644 libdir=`grep "libdir=" ${d}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"`
645 if [ "`ls ${libdir}/libGL.so* 2>/dev/null`" ] ; then
651 # then search libGL.so* file
652 for d in /usr/X11R6/lib64 /usr/lib64 /usr/X11R6/lib /usr/lib ; do
653 if [ "`ls ${d}/libGL.so* 2>/dev/null`" ] ; then
663 local gllibdir="`where_gl_libs`"
664 if [ "${gllibdir}" != "" ] ; then
665 #VSR: 02/04/2013 - next block is commented as it seems to be wrong :( libGL.la should not be ever mentioned
666 # if [ -f ${gllibdir}/libGL.la ] ; then
667 # libdir=`grep "libdir=" ${gllibdir}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"`
668 # if [ "`ls ${libdir}/libGL.so* 2>/dev/null`" ] ; then
669 # str_to_replace="${gllibdir}/libGL.la"
672 if [ "${str_to_replace}" = "" ] ; then
673 str_to_replace="-L${gllibdir} -lGL"
676 la_files=`find . -name "*.la"`
677 for la_file in ${la_files} XXX ; do
678 if [ "${la_file}" = "XXX" ] ; then continue; fi
679 grep -e "libGL.la" ${la_file} >& /dev/null || grep -e "-lGL\b" ${la_file} >& /dev/null && \
680 sed -e "s%-lGL\b%%g" \
681 -e "s%[^[:space:]']*libGL.la[[:space:]]%%g" \
682 -e "s%^dependency_libs='\(.*\)%dependency_libs='${str_to_replace} \1%" \
683 ${la_file} > ${la_file}.new && \
684 mv -f ${la_file}.new ${la_file}
691 if [ -z "${ldir}" ] || [ ! -d "${ldir}" ]; then return 1; fi
695 SALOME_MODULES="`env | awk -F_ '/[a-zA-Z0-9]*_ROOT_DIR/ { print $1 }'`"
699 la_files=`find . -name "*.la"`
702 netgendir=${NETGEN_ROOT_DIR}
704 freetypedir=${FREETYPE_ROOT_DIR}
706 ftgldir=${FTGL_ROOT_DIR}
708 gl2psdir=${GL2PS_ROOT_DIR}
710 freeimagedir=${FREEIMAGE_ROOT_DIR}
712 tbbbasedir=${TBB_ROOT_DIR}
713 TBBKERNEL='cc4.1.0_libc2.4_kernel2.6.16.21'
714 if test `uname -m` = "x86_64" ; then
715 export TBBMODE="intel64/${TBBKERNEL}"
717 export TBBMODE="ia32/${TBBKERNEL}"
719 tbbdir=${tbbbasedir}/lib/${TBBMODE}
721 cgnslibdir=${CGNS_ROOT_DIR}
723 casdir=${CAS_ROOT_DIR}/lib
724 if [ ! -d ${casdir} ] ; then casdir=${CAS_ROOT_DIR}/Linux/lib ; fi
725 if [ ! -d ${casdir} ] ; then casdir=${CAS_ROOT_DIR}/lin/lib ; fi
727 omnidir=${OMNIORB_ROOT_DIR}/lib
730 if [ `uname -m` = "x86_64" ] && [ -d ${vtkpath}/lib64 ] ; then
732 elif [ -d ${vtkpath}/lib ] ; then
737 vtkldir=${vtkpath}/lib${LIB_PREFIX}
738 vtkdir=${vtkldir}/vtk-5.0
740 hdfdir=${HDF5_ROOT_DIR}/lib
742 meddir=${MEDFILE_ROOT_DIR}/lib
744 qwtdir=`find_in_path libqwt.so ${LD_LIBRARY_PATH}`
746 where_python=`which python` # e.g. /usr/bin/python
747 if [ -n "${where_python}" ] ; then
748 where_python=`dirname ${where_python}` # --> /usr/bin
749 where_python=`dirname ${where_python}` # --> /usr
750 python_version=`python -c "import sys; print sys.version[:3]"`
751 pythondir=${where_python}/lib/python${python_version}
754 sipdir=`find_in_path sip.so ${LD_LIBRARY_PATH}`
756 pyqtdir=`find_in_path Qt.so ${LD_LIBRARY_PATH}`
758 tcldir=${TCLHOME}/lib
760 boostdir=${BOOST_ROOT_DIR}/lib
762 blsurfdir=${BLSURFHOME}/lib
764 libxmldir=${LIBXML2_ROOT_DIR}/lib
766 metisdir=${METIS_ROOT_DIR}
768 scotchbindir=${SCOTCH_ROOT_DIR}/bin
769 scotchlibdir=${SCOTCH_ROOT_DIR}/lib
771 if test `uname -m` = "x86_64" ; then
772 libGLpath=/usr/lib64/libGL.la
774 libGLpath=/usr/lib/libGL.la
777 graphvizdir=${GRAPHVIZ_ROOT_DIR}/lib
779 qscintilladir=${QSCINTILLA_ROOT_DIR}/lib
781 expatdir=${EXPAT_ROOT_DIR}/lib
783 paraviewdir=${PARAVIEW_ROOT_DIR}/lib
785 qtdir=${QT4_ROOT_DIR}/lib
786 # distene meshgems dir
787 if test `uname -m` = "x86_64" ; then
788 mgemsdir=${MESHGEMS_ROOT_DIR}/lib/Linux_64
790 mgemsdir=${MESHGEMS_ROOT_DIR}/lib/Linux
793 for l in X ${la_files}; do
795 if [ "${l}" != "X" ] ; then
800 # . process salome modules dependencies
801 for mod in ${SALOME_MODULES} ; do
802 moddir=${mod}_ROOT_DIR
804 if [ -n "${moddir}" ] ; then
805 sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}[1]\?/lib% \1${moddir}/lib%g" \
806 -e "s%[[:space:]]\(-L\)\?[^[:space:]]*${mod}WOGUI[1]\?/lib% \1${moddir}/lib%g" \
807 -e "s%^libdir='[^[:space:]]*${mod}[1]\?/\(lib.*\)'%libdir='${moddir}/\1'%g" \
808 -e "s%^libdir='[^[:space:]]*${mod}WOGUI[1]\?/\(lib.*\)'%libdir='${moddir}/\1'%g" ${l} > ${l}"_"
813 # . process netgen dependencies
814 if [ -n "${netgendir}" ] && [ -d "${netgendir}" ] ; then
815 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*netgen-[0-9.]\+/lib% \1${netgendir}/lib%g" ${l}
818 # . process freetype dependencies
819 if [ -n "${freetypedir}" ] && [ -d "${freetypedir}" ] ; then
820 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*freetype-[0-9.]\+/lib% \1${freetypedir}/lib%g" ${l}
823 # . process ftgl dependencies
824 if [ -n "${ftgldir}" ] && [ -d "${ftgldir}" ] ; then
825 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*ftgl-[0-9.]\+/lib% \1${ftgldir}/lib%g" ${l}
828 # . process gl2ps dependencies
829 if [ -n "${gl2psdir}" ] && [ -d "${gl2psdir}" ] ; then
830 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*gl2ps-[0-9.]\+/lib% \1${gl2psdir}/lib%g" ${l}
833 # . process freeimage dependencies
834 if [ -n "${freeimagedir}" ] && [ -d "${freeimagedir}" ] ; then
835 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*freeimage-[0-9.]\+/lib% \1${freeimagedir}/lib%g" ${l}
838 # . process tbb dependencies
839 if [ -n "${tbbdir}" ] && [ -d "${tbbdir}" ] ; then
840 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*tbb[^[:space:]]*/lib[^[:space:]]*% \1${tbbdir}%g" ${l}
843 # . process cgns dependencies
844 if [ -n "${cgnslibdir}" ] && [ -d "${cgnslibdir}" ] ; then
845 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*cgnslib-[0-9.]\+/lib% \1${cgnslibdir}/lib%g" ${l}
848 # . process CAS.CADE dependencies
849 if [ -n "${CAS_ROOT_DIR}" ] && [ -d "${casdir}" ] ; then
850 sed -e "s%-L[^[:space:]]*OCCT[^[:space:]]*/install/lib%-L${casdir}%g" \
851 -e "s%[^[:space:]]*OCCT[^[:space:]]*/install/lib/%${casdir}/%g" \
852 -e "s%[[:space:]]-L[^[:space:]]*\(OCCT\|CAS\)[^[:space:]]*/lib\?% -L${CAS_ROOT_DIR}/lib%g" \
853 -e "s%[[:space:]][^[:space:]]*\(OCCT\|CAS\)[^[:space:]]*/lib/lib\?% ${CAS_ROOT_DIR}/lib/lib%g" ${l} > ${l}"_"
857 # . process omniORB dependencies
858 if [ -n "${OMNIORB_ROOT_DIR}" ] && [ -d "${omnidir}" ] ; then
859 sed -i "s%-L[^[:space:]]*omni[^[:space:]]*%-L${omnidir}%g;s%-R[^[:space:]]*omni[^[:space:]]*%-R${omnidir}%g" ${l}
862 # . process VTK dependencies
863 if [ -n "${VTK_DIR}" ] && [ -d "${vtkdir}" ] && [ -d "${vtkldir}" ] ; then
864 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}
867 # . process HDF dependencies
868 if [ -n "${HDF5_ROOT_DIR}" ] && [ -d "${hdfdir}" ] ; then
869 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*hdf[^[:space:]/]*/lib% \1${hdfdir}%g" ${l}
872 # . process MED dependencies
873 if [ -n "${MEDFILE_ROOT_DIR}" ] && [ -d "${meddir}" ] ; then
874 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*med[^[:space:]/]*/lib% \1${meddir}%g" ${l}
877 # . process qwt dependencies
878 if [ -n "${qwtdir}" ] && [ -d "${qwtdir}" ] ; then
879 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*qwt[^[:space:]/]*/lib% \1${qwtdir}%g" ${l}
882 # . process qt dependencies
883 if [ -n "${QT4_ROOT_DIR}" ] && [ -d "${qtdir}" ] ; then
884 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*qt[^[:space:]/]*/lib% \1${qtdir}%g" ${l}
887 # . process python dependencies
888 if [ -n "${pythondir}" ] && [ -d "${pythondir}" ] ; then
889 sed -i "s%-L[^[:space:]]*python[0-9]\.[0-9]\([^[:space:]]*\)%-L${pythondir}\1%g" ${l}
892 # . process sip dependencies
893 if [ -n "${sipdir}" ] && [ -d "${sipdir}" ] ; then
894 sed -i "s%-L[^[:space:]]*sip[^[:space:]]*%-L${sipdir}%g" ${l}
897 # . process PyQt dependencies
898 if [ -n "${pyqtdir}" ] && [ -d "${pyqtdir}" ] ; then
899 sed -i "s%-L[^[:space:]]*PyQt[^[:space:]]*%-L${pyqtdir}%g" ${l}
902 # . process tcl/tk dependencies
903 if [ -n "${tcldir}" ] && [ -d "${tcldir}" ] ; then
904 sed -i "s%-L[^[:space:]]*tcltk[^[:space:]]*/lib%-L${tcldir}%g" ${l}
907 # . process boost dependencies
908 if [ -n "${boostdir}" ] && [ -d "${boostdir}" ] ; then
909 sed -i "s%-L[^[:space:]]*boost[^[:space:]]*/lib%-L${boostdir}%g" ${l}
912 # . process blsurf dependencies
913 if [ -n "${blsurfdir}" ] && [ -d "${blsurfdir}" ] ; then
914 sed -i "s%-L[^[:space:]]*BLSurf[^[:space:]]*/lib%-L${blsurfdir}%g" ${l}
917 # . process libxml dependencies
918 if [ -n "${libxmldir}" ] && [ -d "${libxmldir}" ] ; then
919 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}
922 # . process metis dependencies
923 if [ -n "${metisdir}" ] && [ -d "${metisdir}" ] ; then
924 sed -i "s%-L[^[:space:]]*metis[^[:space:]]*%-L${metisdir}%g" ${l}
927 # . process scotch dependencies
928 if [ -n "${scotchbindir}" ] && [ -d "${scotchbindir}" ] ; then
929 sed -i "s%-L[^[:space:]]*scotch[^[:space:]]*/bin%-L${scotchbindir}%g" ${l}
931 if [ -n "${scotchlibdir}" ] && [ -d "${scotchlibdir}" ] ; then
932 sed -i "s%-L[^[:space:]]*scotch[^[:space:]]*/lib%-L${scotchlibdir}%g" ${l}
935 # . process libGL.la dependencies
936 sed -i "s%${libGLpath}%""%g" ${l}
938 # . process graphviz dependencies
939 if [ -n "${graphvizdir}" ] && [ -d "${graphvizdir}" ] ; then
940 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}
943 # . process QScintilla dependencies
944 if [ -n "${qscintilladir}" ] && [ -d "${qscintilladir}" ] ; then
945 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*QScintilla-[0-9]\.[0-9]\(\.[0-9]\)\?/lib% \1${qscintilladir}%g" ${l}
948 # . process expat-2.0.1 dependencies
949 if [ -n "${expatdir}" ] && [ -d "${expatdir}" ] ; then
950 sed -i "s%-L[^[:space:]]*expat[^[:space:]]*/lib%-L${expatdir}%g;s%[^[:space:]]*expat[^[:space:]]*/lib/libexpat.la%-lexpat%g" ${l}
953 # . process ParaView dependencies
954 if [ -n "${paraviewdir}" ] && [ -d "${paraviewdir}" ] ; then
955 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*ParaView-[0-9]\.[0-9]\+\.[0-9]/lib% \1${paraviewdir}%g" ${l}
958 # . process DISTENE MeshGems dependencies
959 if [ -n "${mgemsdir}" ] && [ -d "${mgemsdir}" ] ; then
960 sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*MeshGems-[0-9.]\+/Products/lib/Linux\(_64\)\?% \1${mgemsdir}%g" ${l}