]> SALOME platform Git repositories - tools/install.git/blob - config_files/Python-2.3.5.sh
Salome HOME
1) getSize() just returns required size that read from XML now;
[tools/install.git] / config_files / Python-2.3.5.sh
1 #!/bin/bash -noprofile
2
3 ####################################################################################
4 #  File      : Python-2.3.5.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 "$PYTHONHOME"  ]; then
18    return 1
19 fi
20 isPython=`which python 2>/dev/null`
21 if [ -n "$isPython" ]; then
22   # version number is calculated as: <major>*10000+<minor>*100+<release>
23   # e.g. for Python 2.3.5 it is equal to 20305
24   ver=`python -V 2>&1`
25   ver=`echo $ver | awk '{print $2}' | awk -F. '{v1=0;v2=0;v3=0;if(NF>0)v1=$1;if(NF>1)v2=$2;if(NF>2)v3=$3;print v1*10000+v2*100+v3}'`
26   if [ $ver -eq 20305 ] ;  then 
27     return 0
28   fi
29 fi
30 return 1 
31 }
32
33 print_env_bin()
34 {
35 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF 
36 #$DELIM ${PRODUCT_TYPE} $DELIM
37 export PYTHONHOME=\${INSTALL_ROOT}/${PRODUCT}
38 export PATH=\${PYTHONHOME}/bin:\${PATH}
39 export LD_LIBRARY_PATH=\${PYTHONHOME}/lib:\${LD_LIBRARY_PATH}
40 export PYTHON_VERSION=\`python -c "import sys; print sys.version[:3]"\`
41 export PYTHON_INCLUDE=\${PYTHONHOME}/include/python\${PYTHON_VERSION}
42 export PYTHONPATH=\${PYTHONHOME}/lib/python\${PYTHON_VERSION}:\${PYTHONPATH}
43 ##
44 EOF
45 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
46 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
47 }
48
49 print_env_src()
50 {
51 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
52 #$DELIM ${PRODUCT_TYPE}_src $DELIM
53 # nothing to do
54 ##
55 EOF
56 (test -w ${PRODUCT_DIR}_SRC && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh ${PRODUCT_DIR}_SRC)
57 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}"
58 }
59
60 try_preinstalled(){
61 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
62 try_existing ${PRODUCT_DIR}_SRC ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
63 return $?
64 }
65
66 install_source()
67 {
68 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
69 source ${INSTALL_WORK}/$SHRC
70
71 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
72
73 # to generate environment scripts
74 try_preinstalled
75 }
76
77 install_source_and_build()
78 {
79 # install sources
80 install_source
81
82 # build sources
83 makedir ${PRODUCT_DIR}
84 cd ${PRODUCT_DIR}_SRC
85
86 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
87     ./configure --prefix=${PRODUCT_DIR} --with-threads --with-cxx=`which g++` --enable-shared
88 # vsr: force linking to libstdc++.so
89 sed -e 's%\(^LIBS=.*\)%\1 -lstdc++%g' Makefile > _Makefile
90 mv -f _Makefile Makefile
91 GCC=`which gcc`
92 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
93 used gcc=$GCC
94 EOF
95
96 check_job ${PRODUCT_DIR}/MAKE.LOG make 
97 check_job ${PRODUCT_DIR}/MAKINSTALL.LOG make install
98 (cd ${PRODUCT_DIR}/lib/python2.3/config; ln -fs ../../libpython2.3.so.1.0 libpython2.3.so)
99
100 cd ${PRODUCT_DIR}/bin
101 for sc in idle pydoc smtpd.py ; do
102     if [ -e $sc ] ; then
103         sed -e "s%#\!.*python%#\!/usr/bin/env python%" "$sc" > _"$sc"
104         mv -f _"$sc" "$sc"
105         chmod a+x "$sc"
106     fi
107 done
108
109 #du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
110 cd ${PRODUCT_DIR};
111
112 # remove sources and temporary files after building
113 if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
114     test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
115 fi
116
117 # to generate environment scripts
118 try_preinstalled
119 }
120
121 install_binary()
122 {
123 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
124 source ${INSTALL_WORK}/$SHRC
125
126 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
127
128 (cd ${PRODUCT_DIR}/lib/python2.3/config; ln -fs ../../libpython2.3.so.1.0 libpython2.3.so)
129
130 cd ${PRODUCT_DIR}/bin
131 for sc in idle pydoc smtpd.py ; do
132     if [ -e $sc ] ; then
133         sed -e "s%#\!.*python%#\!/usr/bin/env python%" "$sc" > _"$sc"
134         mv -f _"$sc" "$sc"
135         chmod a+x "$sc"
136     fi
137 done
138
139 # to generate environment script for sources
140 try_preinstalled
141 }
142
143 export PROCEDURE=$1;
144 export INSTALL_WORK=$2;
145 export SOURCE_DIR=$3;
146 export INSTALL_ROOT=$4;
147 export PRODUCT_SEQUENCE=$5;
148 export PRODUCT_TYPE=$6;
149 export INSTALL_PRODUCTS=$7;
150 shift
151 REMOVE_SRC_TMP=$8;
152 export PRODUCT="Python-2.3.5"
153 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
154 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
155 source ./common.sh
156 ${PROCEDURE}