]> SALOME platform Git repositories - tools/install.git/blob - config_files/med-2.2.3.sh
Salome HOME
1) getSize() just returns required size that read from XML now;
[tools/install.git] / config_files / med-2.2.3.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : med-2.2.3.sh
5 #  Created   : Thu Dec 18 12:01:00 2002
6 #  Author    : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
7 #  Project   : SALOME
8 #  Module    : Installation Wizard
9 #  Copyright : 2002-2007 CEA
10 #
11 #  This script is the part of the SALOME installation procedure.
12 #
13 ####################################################################################
14
15 check_version()
16 {
17 if [ -z "$MED2HOME" ]; then
18    #echo "MED2HOME doesn't set"
19    return 1
20 fi
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"
24    return 0
25 fi
26 return 1
27 }
28
29 print_env_bin()
30 {
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}
36 ##
37 EOF
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}"
40 }
41
42 print_env_src()
43 {
44 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
45 #$DELIM ${PRODUCT_TYPE}_src $DELIM
46 # nothing to do
47 ##
48 EOF
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}"
51 }
52
53 try_preinstalled(){
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
56 return $?
57 }
58
59 install_source()
60 {
61 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
62 source ${INSTALL_WORK}/$SHRC
63
64 # unpack
65 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
66
67 # to generate environment scripts
68 try_preinstalled
69 }
70
71 install_source_and_build()
72 {
73 # install sources
74 install_source
75
76 # build sources
77 cd ${PRODUCT_DIR}_SRC
78 makedir ${PRODUCT_DIR}
79
80 #vsr: provide additional flags for f95 (Mandriva 2006.0, Fedora Core 4)
81 is_mandriva=0
82 is_fedora=0
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
88 fi
89
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
94     else
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
97     fi
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
102       exit 1
103     fi
104 else
105     check_job ${PRODUCT_DIR}/CONFIGURE.LOG ./configure --prefix=${PRODUCT_DIR}
106 fi
107
108 GCC=`which gcc`
109 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
110 used gcc=$GCC
111 EOF
112
113 check_job ${PRODUCT_DIR}/MAKE.LOG make
114 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
115
116 #du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
117 cd ${PRODUCT_DIR};
118
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
125 tmp=""
126 if [ -n "${HDF5HOME}" ]; then
127     tmp="-L${HDF5HOME}/lib"
128 fi
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
133
134 chmod 755 libmed.la
135 chmod 755 libmedC.la
136
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
140 fi
141
142 # to generate environment scripts
143 try_preinstalled
144 }
145
146 install_binary()
147 {
148 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
149 source ${INSTALL_WORK}/$SHRC
150
151 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
152
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
161 tmp=""
162 if [ -n "${HDF5HOME}" ]; then
163     tmp="-L${HDF5HOME}/lib"
164 fi
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
169
170 chmod 755 libmed.la
171 chmod 755 libmedC.la
172
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
176 mv _xmdump xmdump
177 chmod a+x xmdump
178
179 # to generate environment script for sources
180 try_preinstalled
181 }
182
183 export PROCEDURE=$1;
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;
190 shift
191 REMOVE_SRC_TMP=$8;
192 export PRODUCT="med-2.2.3"
193 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
194 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
195 source ./common.sh
196 $PROCEDURE