]> SALOME platform Git repositories - tools/install.git/blob - config_files/hdf5-1.6.4.sh
Salome HOME
Add path to common libs into 'LD_LIBRARY_PATH'
[tools/install.git] / config_files / hdf5-1.6.4.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : hdf5-1.6.4.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.4" ]; then 
28         return 0
29     fi
30 fi
31 return 1
32 }
33
34 print_env_bin()
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}" "${INSTALL_PRODUCTS}"
45 }
46
47 print_env_src()
48 {
49 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
50 #$DELIM ${PRODUCT_TYPE}_src $DELIM
51 # nothing to do
52 ##
53 EOF
54 (test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
55 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
56 }
57
58 try_preinstalled(){
59 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
60 try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
61 return $?
62 }
63
64 install_source()
65 {
66 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
67 source ${INSTALL_WORK}/$SHRC
68
69 # unpack
70 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
71
72 # to generate environment scripts
73 try_preinstalled
74 }
75
76 install_source_and_build()
77 {
78 # install sources
79 install_source
80
81 # build sources
82 if test `uname -m` = "x86_64" ; then
83 HDF_CONFIGURE_OPTIONS="-disable-debug --enable-production --enable-threadsafe --enable-hdf5v1_2 --enable-stream-vfd --disable-hsizet --with-pthread=/usr/include,/usr/lib CFLAGS=-m64 CXXFLAGS=-m64"
84 else
85 HDF_CONFIGURE_OPTIONS="-disable-debug --enable-production --enable-threadsafe --enable-hdf5v1_2 --enable-stream-vfd --disable-hsizet --with-pthread=/usr/include,/usr/lib"
86 fi
87
88 cd ${PRODUCT_DIR}_SRC
89 makedir ${PRODUCT_DIR}
90 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
91     ./configure --prefix=${PRODUCT_DIR} $HDF_CONFIGURE_OPTIONS
92 GCC=`which gcc`
93 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
94 used gcc=$GCC
95 EOF
96 check_job ${PRODUCT_DIR}/MAKE.LOG make 
97 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
98
99 #du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
100 cd ${PRODUCT_DIR};
101
102 # remove sources and temporary files after building
103 if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
104     test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
105 fi
106
107 # to generate environment scripts
108 try_preinstalled
109 }
110
111 install_binary()
112 {
113 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
114 source ${INSTALL_WORK}/$SHRC
115
116 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
117
118 ### modify libhdf5.la file to correct direct path to hdf5 library
119 ### no need to do this for sources installation because 'make install' does it!
120 cd ${PRODUCT_DIR}/lib
121 sed -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib'%g" libhdf5.la > libhdf5.la.new
122 mv -f libhdf5.la.new libhdf5.la
123 if [ -e libhdf5_hl.la ] ; then
124     sed -e "s%^libdir='\(.*\)'%libdir='${PRODUCT_DIR}/lib'%g" libhdf5_hl.la > libhdf5_hl.la.new
125     mv -f libhdf5_hl.la.new libhdf5_hl.la
126 fi
127
128 # to generate environment script for sources
129 try_preinstalled
130 }
131
132 export PROCEDURE=$1;
133 export INSTALL_WORK=$2;
134 export SOURCE_DIR=$3;
135 export INSTALL_ROOT=$4;
136 export PRODUCT_SEQUENCE=$5;
137 export PRODUCT_TYPE=$6;
138 export INSTALL_PRODUCTS=$7;
139 shift
140 REMOVE_SRC_TMP=$8;
141 export PRODUCT="hdf5-1.6.4"
142 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
143 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
144 source ./common.sh
145 $PROCEDURE