]> SALOME platform Git repositories - tools/install.git/blob - config_files/hdf5-1.6.3.sh
Salome HOME
Update for Salome 3.2.6
[tools/install.git] / config_files / hdf5-1.6.3.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : hdf5-1.6.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 "$HDF5HOME" ]; then
18     return 1 
19 fi
20 check_lib_version libhdf5.so.0.0.0 ${HDF5HOME}/lib
21 if [ "$?" -ne "0" ]; then
22     return 1
23 fi
24 check_lib_version libhdf5.settings ${HDF5HOME}/lib
25 if [ "$?" -eq "0" ]; then
26     ver=`grep "HDF5 Version:" ${HDF5HOME}/lib/libhdf5.settings | awk '{print $3}'` 
27     if [ "$ver" == "1.6.3" ]; then 
28         return 0
29     fi
30 fi
31 return 1
32 }
33
34 print_env()
35 {
36 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
37 #$DELIM ${PRODUCT_TYPE} $DELIM
38 export HDF5HOME=\${INSTALL_ROOT}/${PRODUCT}
39 export PATH=\${HDF5HOME}/bin:\$PATH
40 export LD_LIBRARY_PATH=\${HDF5HOME}/lib:\${LD_LIBRARY_PATH}
41 ##
42 EOF
43 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
44 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
45 }
46
47 # looks for the native product and collects it's environment (used by make_env())
48 try_native(){
49 hdfdir="`find_in_path libhdf5.so ${LD_LIBRARY_PATH}:/usr/lib`"
50 if [ -z "${hdfdir}" ] ; then return 1 ; fi
51 if [ -f ${hdfdir}/libhdf5.settings ]; then
52     ver=`grep "HDF5 Version:" ${hdfdir}/libhdf5.settings | awk '{print $3}'` 
53     if [ "$ver" == "1.6.3" ]; then 
54         hdfdir=`cd ${hdfdir}/..; pwd`
55         tmp="\${HDF5HOME}/bin ${hdfdir}/bin \${PATH} ${PATH}";  
56         path=`sort_path ${tmp}`
57         tmp="\${HDF5HOME}/lib ${hdfdir}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";  
58         ld_library_path=`sort_path ${tmp}`
59         cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
60 #$DELIM ${PRODUCT_TYPE} $DELIM
61 export HDF5HOME=${hdfdir}
62 export PATH=${path}
63 export LD_LIBRARY_PATH=${ld_library_path}
64 ##
65 EOF
66         make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
67         return 0
68     fi
69 fi
70 return 1;
71 }
72
73 try_preinstalled(){
74 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
75 return $?
76 }
77
78 install_source()
79 {
80 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
81 source ${INSTALL_WORK}/$SHRC
82
83 check_jb tar xfz ${SOURCE_DIR}/hdf5-1.6.3.tar.gz -C ${INSTALL_WORK}
84 cd ${PRODUCT_WORK}
85 makedir ${PRODUCT_DIR}
86 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
87     ./configure --prefix=${PRODUCT_DIR} -disable-debug --enable-production --enable-threadsafe --enable-hdf5v1_2 \
88         --enable-stream-vfd --disable-hsizet --with-pthread=/usr/include,/usr/lib 
89 GCC=`which gcc`
90 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
91 used gcc=$GCC
92 EOF
93 check_job ${PRODUCT_DIR}/MAKE.LOG make 
94 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
95
96 #du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
97 cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
98 print_env
99 }
100
101 install_binary()
102 {
103 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
104 source ${INSTALL_WORK}/$SHRC
105
106 check_jb tar xfz ${SOURCE_DIR}/hdf5-1.6.3.tar.gz -C ${INSTALL_ROOT}
107
108 ### modify libhdf5.la file to correct direct path to hdf5 library
109 ### no need to do this for sources installation because 'make install' does it!
110 cd ${PRODUCT_DIR}/lib
111 sed -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib'%g" libhdf5.la > libhdf5.la.new
112 mv -f libhdf5.la.new libhdf5.la
113
114 print_env
115 }
116
117 export PROCEDURE=$1;
118 export INSTALL_WORK=$2;
119 export SOURCE_DIR=$3;
120 export INSTALL_ROOT=$4;
121 export PRODUCT_SEQUENCE=$5;
122 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="hdf" ; fi
123 export PRODUCT="hdf5-1.6.3"
124 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
125 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
126 source ./common.sh
127 $PROCEDURE