3 ####################################################################################
4 # File : Python-2.4.4.sh
5 # Created : Thu Dec 18 12:01:00 2002
6 # Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
8 # Module : Installation Wizard
9 # Copyright : 2002-2007 CEA
11 # This script is the part of the SALOME installation procedure.
13 ####################################################################################
17 if [ -z "$PYTHONHOME" ]; then
20 isPython=`which python 2>/dev/null`
21 if [ -n "$isPython" ]; then
22 # version number is calculated as: <major>*10000+<minor>*100+<release>
23 # for Python 2.4.4 it is equal to 20404
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 20404 ] ; then
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}
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}"
51 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}_src.sh <<EOF
52 #$DELIM ${PRODUCT_TYPE}_src $DELIM
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}"
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
68 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
69 source ${INSTALL_WORK}/$SHRC
71 if test `uname -m` = "x86_64" ; then
72 export PYTHON_LIB_PREFIX="64"
75 PYTHON_CONFIGURE_OPTIONS="--with-threads --with-cxx=`which g++` --enable-shared CFLAGS=-m64 CXXFLAGS=-m64"
77 export PYTHON_ARCHIVE_PREFIX=""
78 PYTHON_CONFIGURE_OPTIONS="--with-threads --with-cxx=`which g++` --enable-shared"
81 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
83 # apply patch for 64-bit platforms
84 if test `uname -m` = "x86_64" ; then
85 if [ -f patches/python_patch_lib64.patch ] ; then
86 cp patches/python_patch_lib64.patch ${PRODUCT_DIR}_SRC
87 ( cd ${PRODUCT_DIR}_SRC ; \
88 patch -p1 < python_patch_lib64.patch ; \
90 aclocal >& /dev/null ; \
91 autoconf >& /dev/null ; \
92 aclocal >& /dev/null ; \
93 autoconf >& /dev/null )
97 # to generate environment scripts
101 install_source_and_build()
107 makedir ${PRODUCT_DIR}
108 cd ${PRODUCT_DIR}_SRC
110 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
111 ./configure --prefix=${PRODUCT_DIR} $PYTHON_CONFIGURE_OPTIONS
113 # vsr: force linking to libstdc++.so
114 sed -e 's%\(^LIBS=.*\)%\1 -lstdc++%g' Makefile > _Makefile
115 mv -f _Makefile Makefile
117 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
120 check_job ${PRODUCT_DIR}/MAKE.LOG make
121 check_job ${PRODUCT_DIR}/MAKINSTALL.LOG make install
122 (cd ${PRODUCT_DIR}/lib${PYTHON_LIB_PREFIX}/python2.4/config; ln -fs ../../libpython2.4.so.1.0 libpython2.4.so)
124 cd ${PRODUCT_DIR}/bin
125 for sc in idle pydoc smtpd.py ; do
127 sed -e "s%#\!.*python%#\!/usr/bin/env python%" "$sc" > _"$sc"
133 if test `uname -m` = "x86_64" ; then
134 ( cd ${PRODUCT_DIR}; ln -sf lib64 lib )
137 #du -sk ${PRODUCT_DIR}_SRC > ${PRODUCT_DIR}/size.log
140 # remove sources and temporary files after building
141 if [ ${REMOVE_SRC_TMP} == "TRUE" ] ; then
142 test -d ${PRODUCT_DIR}_SRC && rm -fr ${PRODUCT_DIR}_SRC
145 # to generate environment scripts
151 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}
152 source ${INSTALL_WORK}/$SHRC
154 check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INSTALL_ROOT}
156 (cd ${PRODUCT_DIR}/lib/python2.4/config; ln -fs ../../libpython2.4.so.1.0 libpython2.4.so)
158 cd ${PRODUCT_DIR}/bin
159 for sc in idle pydoc smtpd.py ; do
161 sed -e "s%#\!.*python%#\!/usr/bin/env python%" "$sc" > _"$sc"
167 # to generate environment scripts
172 export INSTALL_WORK=$2;
173 export SOURCE_DIR=$3;
174 export INSTALL_ROOT=$4;
175 export PRODUCT_SEQUENCE=$5;
176 export PRODUCT_TYPE=$6;
177 export INSTALL_PRODUCTS=$7;
180 export PRODUCT="Python-2.4.4"
181 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
182 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}