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 "$MED2HOME" ]; then
18 #echo "MED2HOME doesn't set"
21 check_lib_version libmed.so.1.0.2 ${MED2HOME}/lib
22 if [ "$?" -eq "0" ]; then
23 #echo "The product ${PRODUCT} has been already installed on yours system"
31 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
32 #$DELIM ${PRODUCT_TYPE} $DELIM
33 export MED2HOME=\${INSTALL_ROOT}/${PRODUCT}
34 export PATH=\${MED2HOME}/bin:\${PATH}
35 export LD_LIBRARY_PATH=\${MED2HOME}/lib:\${LD_LIBRARY_PATH}
38 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
39 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
44 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
45 #$DELIM ${PRODUCT_TYPE}_src $DELIM
49 (test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
50 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
54 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
55 try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
61 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
62 source ${INSTALL_WORK}/$SHRC
65 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
67 # to generate environment scripts
71 install_source_and_build()
78 makedir ${PRODUCT_DIR}
80 #vsr: provide additional flags for f95 (Mandriva 2006.0, Fedora Core 4)
83 if [ -e /etc/redhat-release ] ; then
84 grep -e "Mandriva Linux release 2006.0" /etc/redhat-release > /dev/null
85 if [ $? == 0 ] ; then is_mandriva=1 ; fi
86 grep -e "Fedora Core release 4" /etc/redhat-release > /dev/null
87 if [ $? == 0 ] ; then is_fedora=1 ; fi
90 if [ $is_mandriva == 1 ] || [ $is_fedora == 1 ] ; then
91 if test `uname -m` = "x86_64" ; then
92 echo "`pwd` -> ./configure --prefix=${PRODUCT_DIR} FFLAGS='-g -O2 -ffixed-line-length-none' CFLAGS=-m64 CXXFLAGS=-m64 >> ${PRODUCT_DIR}/CONFIGURE.LOG"
93 ./configure --prefix=${PRODUCT_DIR} FFLAGS="-g -O2 -ffixed-line-length-none" CFLAGS=-m64 CXXFLAGS=-m64 >> ${PRODUCT_DIR}/CONFIGURE.LOG 2> ${PRODUCT_DIR}_SRC/errlog
95 echo "`pwd` -> ./configure --prefix=${PRODUCT_DIR} FFLAGS='-g -O2 -ffixed-line-length-none' >> ${PRODUCT_DIR}/CONFIGURE.LOG"
96 ./configure --prefix=${PRODUCT_DIR} FFLAGS="-g -O2 -ffixed-line-length-none" >> ${PRODUCT_DIR}/CONFIGURE.LOG 2> ${PRODUCT_DIR}_SRC/errlog
98 if [ "$?" -ne "0" ] ; then
99 cat ${PRODUCT_DIR}/CONFIGURE.LOG
100 cat ${PRODUCT_DIR}_SRC/errlog >&2
101 cat ${PRODUCT_DIR}_SRC/errlog >> ${PRODUCT_DIR}/CONFIGURE.LOG
105 check_job ${PRODUCT_DIR}/CONFIGURE.LOG ./configure --prefix=${PRODUCT_DIR}
109 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
113 check_job ${PRODUCT_DIR}/MAKE.LOG make
114 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
116 #du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
119 ### modify libmed.la libmedC.la files to correct direct path to hdf5 library
120 cd ${PRODUCT_DIR}/lib
121 sed -e 's%\(.*\)\([[:space:]].*libhdf5.la\)\(.*\)%\1 -lhdf5\3%g' libmed.la > libmed.la.new
122 mv -f libmed.la.new libmed.la
123 sed -e 's%\(.*\)\([[:space:]].*libhdf5.la\)\(.*\)%\1 -lhdf5\3%g' libmedC.la > libmedC.la.new
124 mv -f libmedC.la.new libmedC.la
126 if [ -n "${HDF5HOME}" ]; then
127 tmp="-L${HDF5HOME}/lib"
129 sed -e "s%\(.*\)\([[:space:]].*-L.*/hdf5-[0-9]\.[0-9]\.[0-9]/lib[[:space:]]\)\(.*\)%\1 $tmp \3%g" libmed.la > libmed.la.new
130 mv -f libmed.la.new libmed.la
131 sed -e "s%\(.*\)\([[:space:]].*-L.*/hdf5-[0-9]\.[0-9]\.[0-9]/lib[[:space:]]\)\(.*\)%\1 $tmp \3%g" libmedC.la > libmedC.la.new
132 mv -f libmedC.la.new libmedC.la
137 # remove sources and temporary files after building
138 if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
139 test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
142 # to generate environment scripts
148 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
149 source ${INSTALL_WORK}/$SHRC
151 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
153 ### modify libmed.la libmedC.la files to correct direct path to hdf5 library
154 ### also modify libmed.la and libmedC.la files to correct direct path to med libraries
155 ### no need to do this for sources installation because 'make install' does it!
156 cd ${PRODUCT_DIR}/lib
157 sed -e 's%\(.*\)\([[:space:]].*libhdf5.la\)\(.*\)%\1 -lhdf5\3%g' -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib'%g" libmed.la > libmed.la.new
158 mv -f libmed.la.new libmed.la
159 sed -e 's%\(.*\)\([[:space:]].*libhdf5.la\)\(.*\)%\1 -lhdf5\3%g' -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib'%g" libmedC.la > libmedC.la.new
160 mv -f libmedC.la.new libmedC.la
162 if [ -n "${HDF5HOME}" ]; then
163 tmp="-L${HDF5HOME}/lib"
165 sed -e "s%\(.*\)\([[:space:]].*-L.*/hdf5-[0-9]\.[0-9]\.[0-9]/lib[[:space:]]\)\(.*\)%\1 $tmp \3%g" libmed.la > libmed.la.new
166 mv -f libmed.la.new libmed.la
167 sed -e "s%\(.*\)\([[:space:]].*-L.*/hdf5-[0-9]\.[0-9]\.[0-9]/lib[[:space:]]\)\(.*\)%\1 $tmp \3%g" libmedC.la > libmedC.la.new
168 mv -f libmedC.la.new libmedC.la
173 ### modify scripts to correct installation path
174 cd ${PRODUCT_DIR}/bin
175 sed -e "s%set cmd \".*/bin/mdump\"%set cmd \"${PRODUCT_DIR}/bin/mdump\"%g" xmdump > _xmdump
179 # to generate environment script for sources
184 export INSTALL_WORK=$2;
185 export SOURCE_DIR=$3;
186 export INSTALL_ROOT=$4;
187 export PRODUCT_SEQUENCE=$5;
188 export PRODUCT_TYPE=$6;
189 export INSTALL_PRODUCTS=$7;
192 export PRODUCT="med-2.2.3"
193 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
194 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}