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