]> SALOME platform Git repositories - tools/install.git/blob - config_files/med-2.2.2.sh
Salome HOME
Update for version 3.0.0
[tools/install.git] / config_files / med-2.2.2.sh
1 #!/bin/sh
2
3 check_version()
4 {
5 if [ -z "$MED2HOME" ]; then
6    #echo "MED2HOME doesn't set"
7    return 1
8 fi
9 check_lib_version libmed.so.1.0.1 ${MED2HOME}/lib
10 if [ "$?" -eq "0" ]; then
11    #echo "The product ${PRODUCT} has been already installed on yours system"
12    return 0
13 fi
14 return 1
15 }
16
17 print_env()
18 {
19 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
20 #$DELIM ${PRODUCT_TYPE} $DELIM
21 export MED2HOME=\${INSTALL_ROOT}/med-2.2.2
22 export PATH=\${MED2HOME}/bin:\${PATH}
23 export LD_LIBRARY_PATH=\${MED2HOME}/lib:\${LD_LIBRARY_PATH}
24 ##
25 EOF
26 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
27 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
28 }
29
30 # looks for the native product and collects it's environment (used by make_env())
31 try_native(){
32 check_version
33 if [ $? -eq 0 ] ; then
34     tmp="\${MED2HOME}/bin ${MED2HOME}/bin \${PATH} ${PATH}";  
35     path=`sort_path ${tmp}`
36     tmp="\${MED2HOME}/lib ${MED2HOME}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
37     ld_library_path=`sort_path ${tmp}`
38     cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
39 #$DELIM ${PRODUCT_TYPE} $DELIM
40 export MED2HOME=${MED2HOME}
41 export PATH=${path}
42 export LD_LIBRARY_PATH=${ld_library_path}
43 ##
44 EOF
45     make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
46     return 0
47 fi
48 return 1;
49 }
50
51 try_preinstalled(){
52 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
53 return $?
54 }
55
56 install_source()
57 {
58 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
59 source ${INSTALL_WORK}/$SHRC
60
61 check_jb tar xfz ${SOURCE_DIR}/med_fichier2.2.2.src.tar.gz -C ${INSTALL_WORK}
62
63 cd ${PRODUCT_WORK}
64 makedir ${PRODUCT_DIR}
65
66 check_job ${PRODUCT_DIR}/CONFIGURE.LOG ./configure --prefix=${PRODUCT_DIR}
67
68 GCC=`which gcc`
69 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
70 used gcc=$GCC
71 EOF
72
73 check_job ${PRODUCT_DIR}/MAKE.LOG make
74 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
75
76 #du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
77 rm -fr ${PRODUCT_WORK}
78
79 ### modify libmed.la libmedC.la files to correct direct path to hdf5 library
80 cd ${PRODUCT_DIR}/lib
81 sed -e 's%\(.*\)\([[:space:]].*libhdf5.la\)\(.*\)%\1 -lhdf5\3%g' libmed.la > libmed.la.new
82 mv -f libmed.la.new libmed.la
83 sed -e 's%\(.*\)\([[:space:]].*libhdf5.la\)\(.*\)%\1 -lhdf5\3%g' libmedC.la > libmedC.la.new
84 mv -f libmedC.la.new libmedC.la
85 tmp=""
86 if [ -n ${HDF5HOME} ]; then
87     tmp="-L${HDF5HOME}/lib"
88 fi
89 sed -e "s%\(.*\)\([[:space:]].*-L.*/hdf5-1\.4\.4/lib[[:space:]]\)\(.*\)%\1 $tmp \3%g" libmed.la > libmed.la.new
90 mv -f libmed.la.new libmed.la
91 sed -e "s%\(.*\)\([[:space:]].*-L.*/hdf5-1\.4\.4/lib[[:space:]]\)\(.*\)%\1 $tmp \3%g" libmedC.la > libmedC.la.new
92 mv -f libmedC.la.new libmedC.la
93
94 chmod 755 libmed.la
95 chmod 755 libmedC.la
96
97 print_env
98 }
99
100 install_binary()
101 {
102 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
103 source ${INSTALL_WORK}/$SHRC
104
105 check_jb tar xfz ${SOURCE_DIR}/med-2.2.2.tar.gz -C ${INSTALL_ROOT}
106
107 ### modify libmed.la libmedC.la files to correct direct path to hdf5 library
108 ### also modify libmed.la and libmedC.la files to correct direct path to med libraries
109 ### no need to do this for sources installation because 'make install' does it!
110 cd ${PRODUCT_DIR}/lib
111 sed -e 's%\(.*\)\([[:space:]].*libhdf5.la\)\(.*\)%\1 -lhdf5\3%g' -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib'%g" libmed.la > libmed.la.new
112 mv -f libmed.la.new libmed.la
113 sed -e 's%\(.*\)\([[:space:]].*libhdf5.la\)\(.*\)%\1 -lhdf5\3%g' -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib'%g" libmedC.la > libmedC.la.new
114 mv -f libmedC.la.new libmedC.la
115 tmp=""
116 if [ -n ${HDF5HOME} ]; then
117     tmp="-L${HDF5HOME}/lib"
118 fi
119 sed -e "s%\(.*\)\([[:space:]].*-L.*/hdf5-1\.4\.4/lib[[:space:]]\)\(.*\)%\1 $tmp \3%g" libmed.la > libmed.la.new
120 mv -f libmed.la.new libmed.la
121 sed -e "s%\(.*\)\([[:space:]].*-L.*/hdf5-1\.4\.4/lib[[:space:]]\)\(.*\)%\1 $tmp \3%g" libmedC.la > libmedC.la.new
122 mv -f libmedC.la.new libmedC.la
123
124 chmod 755 libmed.la
125 chmod 755 libmedC.la
126
127 print_env
128 }
129
130 export PROCEDURE=$1;
131 export INSTALL_WORK=$2;
132 export SOURCE_DIR=$3;
133 export INSTALL_ROOT=$4;
134 export PRODUCT_SEQUENCE=$5;
135 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="med" ; fi
136 export PRODUCT="med-2.2.2"
137 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
138 export PRODUCT_WORK=${INSTALL_WORK}/med_fichier2.2.2.src
139 source ./common.sh
140 $PROCEDURE