]> SALOME platform Git repositories - tools/install.git/blob - config_files/SWIG-1.3.24.sh
Salome HOME
Remove HappyDoc dependencies
[tools/install.git] / config_files / SWIG-1.3.24.sh
1 #!/bin/sh
2
3 check_version(){
4 if [ -n "`which swig 2>/dev/null`" ]; then
5     ver=`swig -version 2>&1 | grep -i version | awk '{ print $3 }' | sed -e 's/^\([0-9.]*\)\(.*\)/\1/'`
6     if [ "$ver" == "1.3.24" ] ;  then 
7         return 0;
8     fi
9 fi
10 return 1;
11 }
12
13 print_env()
14 {
15 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
16 #$DELIM ${PRODUCT_TYPE} $DELIM 
17 export SWIG_ROOT=\${INSTALL_ROOT}/${PRODUCT}
18 export PATH=\${SWIG_ROOT}/bin:\${PATH}
19 ##
20 EOF
21 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
22 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
23 }
24
25 # looks for the native product and collects it's environment (used by make_env())
26 try_native(){
27 swig_root="`find_in_path swig ${PATH}`"
28 if [ -z "${swig_root}" ] ; then
29     swig_root="`find_in_path swig /usr/bin`"
30 fi
31 if [ -n "${swig_root}" ] ; then
32     swig_root=`cd ${swig_root}/..; pwd`
33     ver=`swig -version 2>&1 | grep -i version | awk '{ print $3 }' | sed -e 's/^\([0-9.]*\)\(.*\)/\1/'`
34     if [ "$ver" == "1.3.24" ] ;  then 
35         tmp="\${SWIG_ROOT}/bin ${swig_root}/bin \${PATH} ${PATH}";
36         path=`sort_path ${tmp}`
37         cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
38 #$DELIM ${PRODUCT_TYPE} $DELIM 
39 export SWIG_ROOT=${swig_root}
40 export PATH=${path}
41 #
42 EOF
43         make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
44         return 0;
45     fi
46 fi
47 return 1
48 }
49
50 try_preinstalled(){
51 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
52 return $?
53 }
54
55 install_source()
56 {
57 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
58 source ${INSTALL_WORK}/$SHRC
59
60 check_jb tar xfz ${SOURCE_DIR}/swig-1.3.24.tar.gz -C ${INSTALL_WORK}
61 cd ${PRODUCT_WORK}
62 makedir ${PRODUCT_DIR}
63 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
64   ./configure --prefix=${PRODUCT_DIR} 
65 GCC=`which gcc`
66 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
67 used gcc=$GCC
68 EOF
69 check_job ${PRODUCT_DIR}/MAKE.LOG make
70 check_job ${PRODUCT_DIR}/INSTALL.LOG make install 
71
72 #du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
73 cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
74 print_env
75 }
76
77 install_binary()
78 {
79 echo "It impossible to install SWIG 1.3.24 from binaries, try to install it from sources."
80 return 1
81 }
82
83 export PROCEDURE=$1;
84 export INSTALL_WORK=$2;
85 export SOURCE_DIR=$3;
86 export INSTALL_ROOT=$4;
87 export PRODUCT_SEQUENCE=$5;
88 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="swig" ; fi
89 export PRODUCT="SWIG-1.3.24"
90 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
91 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
92 source ./common.sh
93 $PROCEDURE