]> SALOME platform Git repositories - tools/install.git/blob - config_files/sip-4.2.1.sh
Salome HOME
Update for Salome 3.2.6
[tools/install.git] / config_files / sip-4.2.1.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : sip-4.2.1.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 [ -n "${SIPDIR}" ]; then
18     ver=`${SIPDIR}/sip -V | awk '{print $1}'`
19     maj_ver=`echo $ver | awk -F. '{if(NF>0) print $1; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
20     min_ver=`echo $ver | awk -F. '{if(NF>1) print $2; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
21     rel_ver=`echo $ver | awk -F. '{if(NF>2) print $3; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
22     let ver=$maj_ver*10000+$min_ver*100+$rel_ver
23     if [ $ver -eq 40201 ] ; then
24         return 0
25     fi
26 fi
27 return 1
28 }
29
30 print_env()
31 {
32 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
33 #$DELIM ${PRODUCT_TYPE} $DELIM
34 export SIPDIR=\${INSTALL_ROOT}/${PRODUCT}
35 export PATH=\${SIPDIR}:\${PATH}
36 export PYTHONPATH=\${SIPDIR}:\${PYTHONPATH}
37 export LD_LIBRARY_PATH=\${SIPDIR}:\${LD_LIBRARY_PATH}
38 ##
39 EOF
40 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
41 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
42 }
43
44 # looks for the native product and collects it's environment (used by make_env())
45 # we need version 4.1 or newer
46 try_native(){
47 sipdir="`find_in_path sip ${PATH}:/usr/bin`"
48 if [ -n "${sipdir}" ] ; then
49     python_version="`python -c 'import sys; print sys.version[:3]'`"
50 if test `uname -m` = "x86_64" ; then
51     sippython="`find_in_path sip.so ${PYTHONPATH}:/usr/lib64/python${python_version}/site-packages`"
52 else
53     sippython="`find_in_path sip.so ${PYTHONPATH}:/usr/lib/python${python_version}/site-packages`"
54 fi
55     if [ -n "${sippython}" ]; then
56         ver=`${sipdir}/sip -V | awk '{print $1}'`
57         maj_ver=`echo $ver | awk -F. '{if(NF>0) print $1; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
58         min_ver=`echo $ver | awk -F. '{if(NF>1) print $2; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
59         rel_ver=`echo $ver | awk -F. '{if(NF>2) print $3; else print 0}' | sed -e 's/^\([0-9]*\).*$/\1/'`
60         let ver=$maj_ver*10000+$min_ver*100+$rel_ver
61         # minimal required version is 4.1
62         if [ $ver -ge 40100 ] ; then
63             tmp="${sipdir} ${sipdir} \${PATH} ${PATH}";
64             path=`sort_path ${tmp}`
65             tmp="${sippython} ${sippython} \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";
66             ld_library_path=`sort_path ${tmp}`
67             tmp="${sippython} ${sippython} \${PYTHONPATH} ${PYTHONPATH}";
68             pythonpath=`sort_path ${tmp}`
69             cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
70 #$DELIM ${PRODUCT_TYPE} $DELIM
71 export PATH=${path}
72 export PYTHONPATH=${pythonpath}
73 export LD_LIBRARY_PATH=${ld_library_path}
74 ##
75 EOF
76             make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
77             return 0
78         fi
79     fi
80 fi
81 return 1
82 }
83
84 try_preinstalled(){
85 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
86 return $?
87 }
88
89 install_source()
90 {
91 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
92 source ${INSTALL_WORK}/$SHRC
93
94 makedir ${PRODUCT_DIR}
95
96 check_jb tar xfz ${SOURCE_DIR}/sip-4.2.1.tar.gz -C ${INSTALL_WORK}
97
98 # apply patch for 64-bit platforms
99 if test `uname -m` = "x86_64" ; then
100     if [ -f patches/sip-4.2.1-lib64.patch ] ; then
101         cp patches/sip-4.2.1-lib64.patch ${PRODUCT_WORK}
102         ( cd ${PRODUCT_WORK} ; patch -p1 < sip-4.2.1-lib64.patch )
103     fi
104 fi
105
106 cd ${PRODUCT_WORK}
107
108 if test `uname -m` = "x86_64" ; then
109     SIP_CONFIGURE_OPTIONS="-b ${PRODUCT_DIR} -d ${PRODUCT_DIR} -e ${PRODUCT_DIR} -v ${PRODUCT_DIR} -l qt-mt -p linux-g++-64"
110 else
111     SIP_CONFIGURE_OPTIONS="-b ${PRODUCT_DIR} -d ${PRODUCT_DIR} -e ${PRODUCT_DIR} -v ${PRODUCT_DIR} -l qt-mt"
112 fi
113
114 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
115     python configure.py $SIP_CONFIGURE_OPTIONS
116 GCC=`which gcc`
117 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
118 used gcc=$GCC
119 EOF
120 check_job ${PRODUCT_DIR}/MAKE.LOG make
121 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
122
123 #du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
124 cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
125 print_env
126 }
127
128 install_binary()
129 {
130 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
131 source ${INSTALL_WORK}/$SHRC
132
133 check_jb tar xfz ${SOURCE_DIR}/sip-4.2.1.tar.gz -C ${INSTALL_ROOT}
134
135 # modify sipconfig.py file
136 if [ -n "${PYTHONHOME}" ] && [ -n "${QTDIR}" ] ; then
137     cd ${PRODUCT_DIR}
138     python_version=`python -V 2>&1 | awk '{print $2}' | awk -F. '{printf("0x%02d%02d%02d",$1,$2,$3)}'`
139     qt_version=`grep -e "^#define[[:space:]]\+QT_VERSION[[:space:]]\+" ${QTDIR}/include/qglobal.h | sed -e 's%^#define[[:space:]\+QT_VERSION[[:space:]]\+\(.*\)$%\1%g'`
140     sed -e "s%\('default_bin_dir':[[:space:]]*\).*%\1'${PYTHONHOME}/bin',%g" sipconfig.py > sipconfig.py.1
141     sed -e "s%\('default_mod_dir':[[:space:]]*\).*%\1'${PYTHONHOME}/lib/python${PYTHON_VERSION}/site-packages',%g" sipconfig.py.1 > sipconfig.py
142     sed -e "s%\('default_sip_dir':[[:space:]]*\).*%\1'${PRODUCT_DIR}',%g" sipconfig.py > sipconfig.py.1
143     sed -e "s%\('sip_bin':[[:space:]]*\).*%\1'${PRODUCT_DIR}/sip',%g"     sipconfig.py.1 > sipconfig.py
144     sed -e "s%\('sip_inc_dir':[[:space:]]*\).*%\1'${PRODUCT_DIR}',%g"     sipconfig.py > sipconfig.py.1
145     sed -e "s%\('sip_mod_dir':[[:space:]]*\).*%\1'${PRODUCT_DIR}',%g"     sipconfig.py.1 > sipconfig.py
146     sed -e "s%\('qt_dir':[[:space:]]*\).*%\1'${QTDIR}',%g"                sipconfig.py > sipconfig.py.1
147     sed -e "s%\('qt_version':[[:space:]]*\).*%\1${qt_version},%g"         sipconfig.py.1 > sipconfig.py
148     sed -e "s%\('qt_inc_dir':[[:space:]]*\).*%\1'${QTDIR}/include',%g"    sipconfig.py > sipconfig.py.1
149     sed -e "s%\('qt_lib_dir':[[:space:]]*\).*%\1'${QTDIR}/lib',%g"        sipconfig.py.1 > sipconfig.py
150     sed -e "s%\('INCDIR_QT':[[:space:]]*\).*%\1'${QTDIR}/include',%g"     sipconfig.py > sipconfig.py.1
151     sed -e "s%\('LIBDIR_QT':[[:space:]]*\).*%\1'${QTDIR}/lib',%g"         sipconfig.py.1 > sipconfig.py
152     sed -e "s%\('MOC':[[:space:]]*\).*%\1'${QTDIR}/bin/moc',%g"           sipconfig.py > sipconfig.py.1
153     sed -e "s%\('py_inc_dir':[[:space:]]*\).*%\1'${PYTHONHOME}/include/python${PYTHON_VERSION}',%g"    sipconfig.py.1 > sipconfig.py
154     sed -e "s%\('py_lib_dir':[[:space:]]*\).*%\1'${PYTHONHOME}/lib/python${PYTHON_VERSION}/config',%g" sipconfig.py > sipconfig.py.1
155     sed -e "s%\('py_version':[[:space:]]*\).*%\1${python_version},%g"     sipconfig.py.1 > sipconfig.py
156     rm sipconfig.py.1
157 fi
158
159 print_env
160 }
161
162 export PROCEDURE=$1;
163 export INSTALL_WORK=$2;
164 export SOURCE_DIR=$3;
165 export INSTALL_ROOT=$4;
166 export PRODUCT_SEQUENCE=$5;
167 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="sip" ; fi
168 export PRODUCT="sip-4.2.1"
169 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
170 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
171 source ./common.sh
172 $PROCEDURE