]> SALOME platform Git repositories - tools/install.git/blob - config_files/sip-4.2.1.sh
Salome HOME
1) remove required size calculations for each product: just read its from XML and...
[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_bin()
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}" "${INSTALL_PRODUCTS}"
42 }
43
44 print_env_src()
45 {
46 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
47 #$DELIM ${PRODUCT_TYPE}_src $DELIM
48 # nothing to do
49 ##
50 EOF
51 (test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
52 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
53 }
54
55 try_preinstalled(){
56 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
57 try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
58 return $?
59 }
60
61 install_source()
62 {
63 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
64 source ${INSTALL_WORK}/$SHRC
65
66 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
67
68 # apply patch for 64-bit platforms
69 if test `uname -m` = "x86_64" ; then
70     if [ -f patches/sip-4.2.1-lib64.patch ] ; then
71         cp patches/sip-4.2.1-lib64.patch ${PRODUCT_DIR}_SRC
72         ( cd ${PRODUCT_DIR}_SRC ; patch -p1 < sip-4.2.1-lib64.patch )
73     fi
74 fi
75
76 # to generate environment scripts
77 try_preinstalled
78 }
79
80 install_source_and_build()
81 {
82 # install sources
83 install_source
84
85 # build sources
86 makedir ${PRODUCT_DIR}
87 cd ${PRODUCT_DIR}_SRC
88
89 if test `uname -m` = "x86_64" ; then
90     SIP_CONFIGURE_OPTIONS="-b ${PRODUCT_DIR} -d ${PRODUCT_DIR} -e ${PRODUCT_DIR} -v ${PRODUCT_DIR} -l qt-mt -p linux-g++-64"
91 else
92     SIP_CONFIGURE_OPTIONS="-b ${PRODUCT_DIR} -d ${PRODUCT_DIR} -e ${PRODUCT_DIR} -v ${PRODUCT_DIR} -l qt-mt"
93 fi
94
95 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
96     python configure.py $SIP_CONFIGURE_OPTIONS
97 GCC=`which gcc`
98 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
99 used gcc=$GCC
100 EOF
101 check_job ${PRODUCT_DIR}/MAKE.LOG make
102 check_job ${PRODUCT_DIR}/INSTALL.LOG make install
103
104 #du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
105 cd ${PRODUCT_DIR};
106
107 # remove sources and temporary files after building
108 if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
109     test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
110 fi
111
112 # to generate environment scripts
113 try_preinstalled
114 }
115
116 install_binary()
117 {
118 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
119 source ${INSTALL_WORK}/$SHRC
120
121 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
122
123 # modify sipconfig.py file
124 if [ -n "${PYTHONHOME}" ] && [ -n "${QTDIR}" ] ; then
125     cd ${PRODUCT_DIR}
126     python_version=`python -V 2>&1 | awk '{print $2}' | awk -F. '{printf("0x%02d%02d%02d",$1,$2,$3)}'`
127     qt_version=`grep -e "^#define[[:space:]]\+QT_VERSION[[:space:]]\+" ${QTDIR}/include/qglobal.h | sed -e 's%^#define[[:space:]\+QT_VERSION[[:space:]]\+\(.*\)$%\1%g'`
128     sed -e "s%\('default_bin_dir':[[:space:]]*\).*%\1'${PYTHONHOME}/bin',%g" sipconfig.py > sipconfig.py.1
129     sed -e "s%\('default_mod_dir':[[:space:]]*\).*%\1'${PYTHONHOME}/lib/python${PYTHON_VERSION}/site-packages',%g" sipconfig.py.1 > sipconfig.py
130     sed -e "s%\('default_sip_dir':[[:space:]]*\).*%\1'${PRODUCT_DIR}',%g" sipconfig.py > sipconfig.py.1
131     sed -e "s%\('sip_bin':[[:space:]]*\).*%\1'${PRODUCT_DIR}/sip',%g"     sipconfig.py.1 > sipconfig.py
132     sed -e "s%\('sip_inc_dir':[[:space:]]*\).*%\1'${PRODUCT_DIR}',%g"     sipconfig.py > sipconfig.py.1
133     sed -e "s%\('sip_mod_dir':[[:space:]]*\).*%\1'${PRODUCT_DIR}',%g"     sipconfig.py.1 > sipconfig.py
134     sed -e "s%\('qt_dir':[[:space:]]*\).*%\1'${QTDIR}',%g"                sipconfig.py > sipconfig.py.1
135     sed -e "s%\('qt_version':[[:space:]]*\).*%\1${qt_version},%g"         sipconfig.py.1 > sipconfig.py
136     sed -e "s%\('qt_inc_dir':[[:space:]]*\).*%\1'${QTDIR}/include',%g"    sipconfig.py > sipconfig.py.1
137     sed -e "s%\('qt_lib_dir':[[:space:]]*\).*%\1'${QTDIR}/lib',%g"        sipconfig.py.1 > sipconfig.py
138     sed -e "s%\('INCDIR_QT':[[:space:]]*\).*%\1'${QTDIR}/include',%g"     sipconfig.py > sipconfig.py.1
139     sed -e "s%\('LIBDIR_QT':[[:space:]]*\).*%\1'${QTDIR}/lib',%g"         sipconfig.py.1 > sipconfig.py
140     sed -e "s%\('MOC':[[:space:]]*\).*%\1'${QTDIR}/bin/moc',%g"           sipconfig.py > sipconfig.py.1
141     sed -e "s%\('py_inc_dir':[[:space:]]*\).*%\1'${PYTHONHOME}/include/python${PYTHON_VERSION}',%g"    sipconfig.py.1 > sipconfig.py
142     sed -e "s%\('py_lib_dir':[[:space:]]*\).*%\1'${PYTHONHOME}/lib/python${PYTHON_VERSION}/config',%g" sipconfig.py > sipconfig.py.1
143     sed -e "s%\('py_version':[[:space:]]*\).*%\1${python_version},%g"     sipconfig.py.1 > sipconfig.py
144     rm sipconfig.py.1
145 fi
146
147 # to generate environment scripts
148 try_preinstalled
149 }
150
151 export PROCEDURE=$1;
152 export INSTALL_WORK=$2;
153 export SOURCE_DIR=$3;
154 export INSTALL_ROOT=$4;
155 export PRODUCT_SEQUENCE=$5;
156 export PRODUCT_TYPE=$6;
157 export INSTALL_PRODUCTS=$7;
158 shift
159 REMOVE_SRC_TMP=$8;
160 export PRODUCT="sip-4.2.1"
161 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
162 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
163 source ./common.sh
164 $PROCEDURE