5 if [ -z "$PYTHONHOME" ]; then
8 isPython=`which python 2>/dev/null`
9 if [ -n "$isPython" ]; then
10 # version number is calculated as: <major>*10000+<minor>*100+<release>
11 # e.g. for Python 2.3.4 it is equal to 20304
13 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}'`
14 if [ $ver -eq 20304 ] ; then
23 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
24 #$DELIM ${PRODUCT_TYPE} $DELIM
25 export PYTHONHOME=\${INSTALL_ROOT}/${PRODUCT}
26 export PATH=\${PYTHONHOME}/bin:\${PATH}
27 export LD_LIBRARY_PATH=\${PYTHONHOME}/lib:\${LD_LIBRARY_PATH}
28 export PYTHON_VERSION=\`python -c "import sys; print sys.version[:3]"\`
29 export PYTHON_INCLUDE=\${PYTHONHOME}/include/python\${PYTHON_VERSION}
30 export PYTHONPATH=\${PYTHONHOME}/lib/python\${PYTHON_VERSION}:\${PYTHONPATH}
33 (test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
34 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
37 # looks for the native product and collects it's environment (used by make_env())
39 pythonhome="`find_in_path python ${PATH}`"
40 if [ -z "${pythonhome}" ] ; then
41 pythonhome="`find_in_path python /usr/bin`"
43 if [ -n "${pythonhome}" ] ; then
44 pythonhome=`cd ${pythonhome}/..; pwd`
45 # get version number: <major>, <minor> and <release>
46 # <major> and <minor> numbers are checked strickly, but <release> number can be larger than required one
47 # version number is calculated as: <major>*10000+<minor>*100+<release>
48 # e.g. for Python 2.3.4 it is equal to 20304
50 maj_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>0) print $1; else print 0}'`
51 min_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>1) print $2; else print 0}'`
52 rel_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>2) print $3; else print 0}'`
53 let ver=$maj_ver*10000+$min_ver*100+$rel_ver
54 if [ $ver -ge 20304 ] ; then
55 tmp="\${PYTHONHOME}/bin ${pythonhome}/bin \${PATH} ${PATH}";
56 path=`sort_path ${tmp}`
57 tmp="\${PYTHONHOME}/lib/python\${PYTHON_VERSION} ${pythonhome}/lib/python${maj_ver}.${min_ver} \${PYTHONPATH} ${PYTHONPATH}";
58 pythonpath=`sort_path ${tmp}`
59 tmp="\${PYTHONHOME}/lib ${pythonhome}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}";
60 ld_library_path=`sort_path ${tmp}`
61 cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
62 #$DELIM ${PRODUCT_TYPE} $DELIM
63 export PYTHONHOME=${pythonhome}
65 export LD_LIBRARY_PATH=${ld_library_path}
66 export PYTHON_VERSION=\`python -c "import sys; print sys.version[:3]"\`
67 export PYTHON_INCLUDE=\${PYTHONHOME}/include/python\${PYTHON_VERSION}
68 export PYTHONPATH=${pythonpath}
71 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
72 ####### THIS COULD BE USED FOR STRICT COMPARISON ##############################
73 # if [ $maj_ver -eq 2 ] && [ $min_ver -eq 3 ] && [ $rel_ver -eq 4 ] ; then
74 ######################################################################################
75 if [ $maj_ver -eq 2 ] && [ $min_ver -eq 3 ] && [ $rel_ver -ge 4 ] ; then
86 try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
92 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
93 source ${INSTALL_WORK}/$SHRC
95 makedir ${PRODUCT_DIR}
97 check_jb tar xfz ${SOURCE_DIR}/Python-2.3.4.tar.gz -C ${INSTALL_WORK}
100 check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
101 ./configure --prefix=${PRODUCT_DIR} --with-threads --with-cxx=`which g++` --enable-shared
102 # vsr: force linking to libstdc++.so
103 sed -e 's%\(^LIBS=.*\)%\1 -lstdc++%g' Makefile > _Makefile
104 mv -f _Makefile Makefile
106 cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
110 check_job ${PRODUCT_DIR}/MAKE.LOG make
111 check_job ${PRODUCT_DIR}/MAKINSTALL.LOG make install
112 (cd ${PRODUCT_DIR}/lib/python2.3/config; ln -fs ../../libpython2.3.so.1.0 libpython2.3.so)
114 cd ${PRODUCT_DIR}/bin
115 for sc in idle pydoc smtpd.py ; do
117 sed -e "s%#\!.*python%#\!/usr/bin/env python%" "$sc" > _"$sc"
123 #du -sk ${PRODUCT_WORK} > ${PRODUCT_DIR}/size.log
124 cd ${PRODUCT_DIR}; rm -fr ${PRODUCT_WORK}
130 make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
131 source ${INSTALL_WORK}/$SHRC
133 check_jb tar xfz ${SOURCE_DIR}/Python-2.3.4.tar.gz -C ${INSTALL_ROOT}
135 (cd ${PRODUCT_DIR}/lib/python2.3/config; ln -fs ../../libpython2.3.so.1.0 libpython2.3.so)
137 cd ${PRODUCT_DIR}/bin
138 for sc in idle pydoc smtpd.py ; do
140 sed -e "s%#\!.*python%#\!/usr/bin/env python%" "$sc" > _"$sc"
150 export INSTALL_WORK=$2;
151 export SOURCE_DIR=$3;
152 export INSTALL_ROOT=$4;
153 export PRODUCT_SEQUENCE=$5;
154 if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="python" ; fi
155 export PRODUCT="Python-2.3.4"
156 export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
157 export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}