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 ####################################################################################
17 if [ -z "$CASROOT" ]; then
20 check_lib_version ${CASROOT}/inc/Standard_Version.hxx
21 if [ "$?" -ne "0" ] ; then
24 ver_major=`grep "#define OCC_VERSION_MAJOR" ${CASROOT}/inc/Standard_Version.hxx | awk '{print $3}'`
25 ver_minor=`grep "#define OCC_VERSION_MINOR" ${CASROOT}/inc/Standard_Version.hxx | awk '{print $3}'`
26 ver_maint=`grep "#define OCC_VERSION_MAINTENANCE" ${CASROOT}/inc/Standard_Version.hxx | awk '{print $3}'`
27 ver="$ver_major.$ver_minor.$ver_maint"
28 if [ "$ver" == "6.2" ] ; then
36 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
37 #$DELIM ${PRODUCT_TYPE} $DELIM
38 export CASROOT=\${INSTALL_ROOT}/${PRODUCT}
39 export PATH=\${CASROOT}/bin:\${PATH}
40 export LD_LIBRARY_PATH=\${CASROOT}/lib:\${CASROOT}/lin/lib:\${LD_LIBRARY_PATH}
41 # Variable for Foundation Classes :
42 export CSF_UnitsLexicon=\${CASROOT}/src/UnitsAPI/Lexi_Expr.dat
43 export CSF_UnitsDefinition=\${CASROOT}/src/UnitsAPI/Units.dat
44 # Variable for DataExchange :
45 export CSF_SHMessage=\${CASROOT}/src/SHMessage
46 export CSF_XSMessage=\${CASROOT}/src/XSMessage
48 export CSF_MDTVFontDirectory=\${CASROOT}/src/FontMFT
49 export CSF_MDTVTexturesDirectory=\${CASROOT}/src/Textures
50 # Activation of OCCT Kernel multithreading :
51 export MMGT_REENTRANT=1
54 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
55 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
60 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
61 #$DELIM ${PRODUCT_TYPE}_src $DELIM
65 (test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
66 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
71 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
72 try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
78 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
79 source ${INSTALL_WORK}/$SHRC
82 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
84 # to generate environment scripts
88 install_source_and_build()
94 makedir ${PRODUCT_DIR}
98 echo " +++++++++++ configure"
99 if test `uname -m` = "x86_64" ; then
100 flags="$flags --with-xmu-include=/usr/X11R6/include/X11"
101 flags="$flags --with-xmu-library=/usr/X11R6/lib64"
103 flags="$flags --with-xmu-include=/usr/X11R6/include/X11"
104 flags="$flags --with-xmu-library=/usr/X11R6/lib"
106 flags="$flags LDFLAGS=-lpthread"
107 glincdir="`where_gl_includes`"
108 if [ $? -eq 0 ] ; then flags="$flags --with-gl-include=$glincdir"; fi
109 gllibdir="`where_gl_libs`"
110 if [ $? -eq 0 ] ; then flags="$flags --with-gl-library=$gllibdir"; fi
112 if [ $? -eq 0 ] ; then flags="$flags --with-tcl=$tcldir"; fi
114 if [ $? -eq 0 ] ; then flags="$flags --with-tk=$tkdir"; fi
116 if [ $? -eq 0 ] ; then flags="$flags --with-dps-include=$dpsdir/include --with-dps-library=$dpsdir/lib"; fi
117 flags="$flags --disable-jcas --disable-debug --enable-production"
119 export CASROOT=${PRODUCT_DIR}_SRC
121 if test `uname -m` = "x86_64" ; then
122 echo "`pwd` -> ./configure --prefix=${PRODUCT_DIR} $flags CFLAGS="-m64 -D_OCC64" CXXFLAGS="-m64 -D_OCC64" >> ${PRODUCT_DIR}/CONFIGURE.LOG"
123 ./configure --prefix=${PRODUCT_DIR} $flags CFLAGS="-m64 -D_OCC64" CXXFLAGS="-m64 -D_OCC64" >> ${PRODUCT_DIR}/CONFIGURE.LOG 2> ${INSTALL_WORK}/errlog
125 echo "`pwd` -> ./configure --prefix=${PRODUCT_DIR} $flags >> ${PRODUCT_DIR}/CONFIGURE.LOG"
126 ./configure --prefix=${PRODUCT_DIR} $flags >> ${PRODUCT_DIR}/CONFIGURE.LOG 2> ${INSTALL_WORK}/errlog
130 echo " +++++++++++ make"
132 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
135 check_job ${PRODUCT_DIR}/MAKE.LOG make -j4 install-strip
138 echo " +++++++++++ copy includes"
139 cp -fr inc ${PRODUCT_DIR}
140 cp -f config.h ${PRODUCT_DIR}
141 (cd ${PRODUCT_DIR}/inc; ln -fs ../config.h config.h)
143 echo " +++++++++++ copy resources"
144 makedir ${PRODUCT_DIR}/src
145 for d in UnitsAPI SHMessage FontMFT Textures XSMessage DrawResources ; do
146 cp -rp src/${d} ${PRODUCT_DIR}/src
148 (cd ${PRODUCT_DIR}; mkdir -p Linux; cd Linux; ln -fs ../lib lib; ln -fs ../bin bin)
149 (cd ${PRODUCT_DIR}; mkdir -p lin; cd lin; ln -fs ../lib lib; ln -fs ../bin bin)
151 # fix libGL dependencies
152 echo " +++++++++++ fix libGL dependencies"
153 cd ${PRODUCT_DIR}/lib
154 gllibdir="`where_gl_libs`"
155 if [ "$gllibdir" != "" ] ; then
156 if [ -f ${gllibdir}/libGL.la ] ; then
157 libdir=`grep "libdir=" ${gllibdir}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"`
158 if [ "`ls $libdir/libGL.so* 2>/dev/null`" ] ; then
159 str_to_replace="${gllibdir}/libGL.la"
162 if [ "$str_to_replace" == "" ] ; then
163 str_to_replace="-L${gllibdir} -lGL"
166 -e "s%[^[:space:]]*libGL.la[[:space:]]%%g" \
167 -e "s%^dependency_libs='\(.*\)%dependency_libs='${str_to_replace} \1%" \
168 libTKOpenGl.la > libTKOpenGl.la.new
169 mv -f libTKOpenGl.la.new libTKOpenGl.la
172 #du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
175 # remove sources and temporary files after building
176 if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
177 test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
180 # to generate environment scripts
186 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
187 source ${INSTALL_WORK}/$SHRC
189 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
192 ldir=${PRODUCT_DIR}/lib
193 if [ ! -d $ldir ]; then ldir=${PRODUCT_DIR}/Linux/lib; fi
194 if [ ! -d $ldir ]; then ldir=${PRODUCT_DIR}/lin/lib; fi
196 # 1. set libdir correctly, correct dependencies, set tcldir correctly
197 tcldir=`printenv TCLHOME`
198 for l in X `find . -name "*.la"`; do
199 if [ "$l" != "X" ] ; then
201 libdir=`grep -e "libdir=.*" $l | sed -e "s/libdir=[\'|\"]\(.*\)[\'|\"]/\1/g"`
202 sed -e "s%${libdir}%${ldir}%g" $l > _$l
204 if [ -n "${tcldir}" ] && [ -d "${tcldir}" ] ; then
205 sed -e "s%-L[^[:space:]]*tcltk[^[:space:]]*/lib%-L${tcldir}/lib%g" $l > _$l
212 # 2. fix libGL dependencies
214 gllibdir="`where_gl_libs`"
215 if [ "$gllibdir" != "" ] ; then
216 if [ -f ${gllibdir}/libGL.la ] ; then
217 libdir=`grep "libdir=" ${gllibdir}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"`
218 if [ "`ls $libdir/libGL.so* 2>/dev/null`" ] ; then
219 str_to_replace="${gllibdir}/libGL.la"
222 if [ "$str_to_replace" == "" ] ; then
223 str_to_replace="-L${gllibdir} -lGL"
226 -e "s%[^[:space:]]*libGL.la[[:space:]]%%g" \
227 -e "s%^dependency_libs='\(.*\)%dependency_libs='${str_to_replace} \1%" \
228 libTKOpenGl.la > libTKOpenGl.la.new
229 mv -f libTKOpenGl.la.new libTKOpenGl.la
232 # to generate environment script for sources
237 export INSTALL_WORK=$2;
238 export SOURCE_DIR=$3;
239 export INSTALL_ROOT=$4;
240 export PRODUCT_SEQUENCE=$5;
241 export PRODUCT_TYPE=$6;
242 export INSTALL_PRODUCTS=$7;
245 export PRODUCT="CAS-6.2sp1"
246 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
247 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}