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}
99 echo " +++++++++++ configure"
103 if [ -e /etc/issue ] ; then
104 grep -e "Mandriva Linux release 2007.0" /etc/issue > /dev/null
105 if [ $? == 0 ] ; then is_mandriva2007=1 ; fi
108 if [ $is_mandriva2007 == 1 ] ; then
109 where_xmu_include=/usr/include/X11
111 where_xmu_include=/usr/X11R6/include/X11
114 if test `uname -m` = "x86_64" ; then
115 flags="$flags --with-xmu-include=$where_xmu_include"
116 flags="$flags --with-xmu-library=/usr/X11R6/lib64"
118 flags="$flags --with-xmu-include=$where_xmu_include"
119 flags="$flags --with-xmu-library=/usr/X11R6/lib"
122 flags="$flags LDFLAGS=-lpthread"
123 glincdir="`where_gl_includes`"
124 if [ $? -eq 0 ] ; then flags="$flags --with-gl-include=$glincdir"; fi
125 gllibdir="`where_gl_libs`"
126 if [ $? -eq 0 ] ; then flags="$flags --with-gl-library=$gllibdir"; fi
128 if [ $? -eq 0 ] ; then flags="$flags --with-tcl=$tcldir"; fi
130 if [ $? -eq 0 ] ; then flags="$flags --with-tk=$tkdir"; fi
132 if [ $? -eq 0 ] ; then flags="$flags --with-dps-include=$dpsdir/include --with-dps-library=$dpsdir/lib"; fi
133 flags="$flags --disable-jcas --disable-debug --enable-production"
135 export CASROOT=${PRODUCT_DIR}_SRC
137 if test `uname -m` = "x86_64" ; then
138 echo "`pwd` -> ./configure --prefix=${PRODUCT_DIR} $flags CFLAGS="-m64 -D_OCC64" CXXFLAGS="-m64 -D_OCC64" >> ${PRODUCT_DIR}/CONFIGURE.LOG"
139 ./configure --prefix=${PRODUCT_DIR} $flags CFLAGS="-m64 -D_OCC64" CXXFLAGS="-m64 -D_OCC64" >> ${PRODUCT_DIR}/CONFIGURE.LOG 2> ${INSTALL_WORK}/errlog
141 echo "`pwd` -> ./configure --prefix=${PRODUCT_DIR} $flags >> ${PRODUCT_DIR}/CONFIGURE.LOG"
142 ./configure --prefix=${PRODUCT_DIR} $flags >> ${PRODUCT_DIR}/CONFIGURE.LOG 2> ${INSTALL_WORK}/errlog
146 echo " +++++++++++ make"
148 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
151 check_job ${PRODUCT_DIR}/MAKE.LOG make -j4 install-strip
154 echo " +++++++++++ copy includes"
155 cp -fr inc ${PRODUCT_DIR}
156 cp -f config.h ${PRODUCT_DIR}
157 (cd ${PRODUCT_DIR}/inc; ln -fs ../config.h config.h)
159 echo " +++++++++++ copy resources"
160 makedir ${PRODUCT_DIR}/src
161 for d in UnitsAPI SHMessage FontMFT Textures XSMessage DrawResources ; do
162 cp -rp src/${d} ${PRODUCT_DIR}/src
164 (cd ${PRODUCT_DIR}; mkdir -p Linux; cd Linux; ln -fs ../lib lib; ln -fs ../bin bin)
165 (cd ${PRODUCT_DIR}; mkdir -p lin; cd lin; ln -fs ../lib lib; ln -fs ../bin bin)
167 # fix libGL dependencies
168 echo " +++++++++++ fix libGL dependencies"
169 cd ${PRODUCT_DIR}/lib
170 gllibdir="`where_gl_libs`"
171 if [ "$gllibdir" != "" ] ; then
172 if [ -f ${gllibdir}/libGL.la ] ; then
173 libdir=`grep "libdir=" ${gllibdir}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"`
174 if [ "`ls $libdir/libGL.so* 2>/dev/null`" ] ; then
175 str_to_replace="${gllibdir}/libGL.la"
178 if [ "$str_to_replace" == "" ] ; then
179 str_to_replace="-L${gllibdir} -lGL"
182 -e "s%[^[:space:]]*libGL.la[[:space:]]%%g" \
183 -e "s%^dependency_libs='\(.*\)%dependency_libs='${str_to_replace} \1%" \
184 libTKOpenGl.la > libTKOpenGl.la.new
185 mv -f libTKOpenGl.la.new libTKOpenGl.la
188 #du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
191 # remove sources and temporary files after building
192 if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
193 test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
196 # to generate environment scripts
202 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
203 source ${INSTALL_WORK}/$SHRC
205 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
208 ldir=${PRODUCT_DIR}/lib
209 if [ ! -d $ldir ]; then ldir=${PRODUCT_DIR}/Linux/lib; fi
210 if [ ! -d $ldir ]; then ldir=${PRODUCT_DIR}/lin/lib; fi
212 # 1. set libdir correctly, correct dependencies, set tcldir correctly
213 tcldir=`printenv TCLHOME`
214 for l in X `find . -name "*.la"`; do
215 if [ "$l" != "X" ] ; then
217 libdir=`grep -e "libdir=.*" $l | sed -e "s/libdir=[\'|\"]\(.*\)[\'|\"]/\1/g"`
218 sed -e "s%${libdir}%${ldir}%g" $l > _$l
220 if [ -n "${tcldir}" ] && [ -d "${tcldir}" ] ; then
221 sed -e "s%-L[^[:space:]]*tcltk[^[:space:]]*/lib%-L${tcldir}/lib%g" $l > _$l
228 # 2. fix libGL dependencies
230 gllibdir="`where_gl_libs`"
231 if [ "$gllibdir" != "" ] ; then
232 if [ -f ${gllibdir}/libGL.la ] ; then
233 libdir=`grep "libdir=" ${gllibdir}/libGL.la | sed -e "s%libdir='\(.*\)'%\1%"`
234 if [ "`ls $libdir/libGL.so* 2>/dev/null`" ] ; then
235 str_to_replace="${gllibdir}/libGL.la"
238 if [ "$str_to_replace" == "" ] ; then
239 str_to_replace="-L${gllibdir} -lGL"
242 -e "s%[^[:space:]]*libGL.la[[:space:]]%%g" \
243 -e "s%^dependency_libs='\(.*\)%dependency_libs='${str_to_replace} \1%" \
244 libTKOpenGl.la > libTKOpenGl.la.new
245 mv -f libTKOpenGl.la.new libTKOpenGl.la
248 # to generate environment script for sources
253 export INSTALL_WORK=$2;
254 export SOURCE_DIR=$3;
255 export INSTALL_ROOT=$4;
256 export PRODUCT_SEQUENCE=$5;
257 export PRODUCT_TYPE=$6;
258 export INSTALL_PRODUCTS=$7;
261 export PRODUCT="CAS-6.2sp3"
262 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
263 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}