#
####################################################################################
+PY_VERSION=2.6.2
+PY_XVERSION=`echo ${PY_VERSION} | 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}'`
+PY_LIBVERSION=`echo ${PY_VERSION} | awk -F. '{printf("%d.%d",$1,$2)}'`
+
check_version()
{
if [ -z "$PYTHONHOME" ]; then
isPython=`which python 2>/dev/null`
if [ -n "$isPython" ]; then
# version number is calculated as: <major>*10000+<minor>*100+<release>
- # for Python 2.6.2 it is equal to 20404
ver=`python -V 2>&1`
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}'`
- if [ $ver -eq 20404 ] ; then
+ if [ $ver -eq ${PY_XVERSION} ] ; then
return 0
fi
fi
make_env ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src
source ${INSTALL_WORK}/$SHRC
-if test `uname -m` = "x86_64" ; then
-# export PYTHON_LIB_PREFIX="64"
- export PYTHON_ARCHIVE_PREFIX=""
- export CFLAGS=-m64
- export CXXFLAGS=-m64
- PYTHON_CONFIGURE_OPTIONS="--with-threads --with-cxx=`which g++` --enable-shared CFLAGS=-m64 CXXFLAGS=-m64"
-else
- export PYTHON_ARCHIVE_PREFIX=""
- PYTHON_CONFIGURE_OPTIONS="--with-threads --with-cxx=`which g++` --enable-shared"
-fi
-
check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${INST_ROOT}
# apply patch for 64-bit platforms
test -z ${SINGLE_DIR} && makedir ${PRODUCT_DIR} || mkdir -p ${PRODUCT_DIR}
cd ${PRODUCT_SRC_DIR}
-check_job ${PRODUCT_DIR}/CONFIGURE.LOG \
- ./configure --prefix=${PRODUCT_DIR} $PYTHON_CONFIGURE_OPTIONS
+export PYTHON_ARCHIVE_PREFIX=""
+PYTHON_CONFIGURE_OPTIONS="--with-threads --with-cxx=`which g++` --enable-shared --without-test --with-libs=-lstdc++"
+### --with-pydebug ### (for debug)
+
+if test `uname -m` = "x86_64" ; then
+ PYTHON_CONFIGURE_OPTIONS="${PYTHON_CONFIGURE_OPTIONS} CFLAGS=-m64 CXXFLAGS=-m64"
+fi
+
+check_job ${PRODUCT_DIR}/CONFIGURE.LOG ./configure --prefix=${PRODUCT_DIR} $PYTHON_CONFIGURE_OPTIONS
-# vsr: force linking to libstdc++.so
-sed -e 's%\(^LIBS=.*\)%\1 -lstdc++%g' Makefile > _Makefile
-mv -f _Makefile Makefile
GCC=`which gcc`
cat >> ${PRODUCT_DIR}/MAKE.LOG <<EOF
used gcc=$GCC
EOF
check_job ${PRODUCT_DIR}/MAKE.LOG make
check_job ${PRODUCT_DIR}/MAKINSTALL.LOG make install
-(cd ${PRODUCT_DIR}/lib${PYTHON_LIB_PREFIX}/python2.6/config; ln -fs ../../libpython2.6.so.1.0 libpython2.6.so)
+(cd ${PRODUCT_DIR}/lib${PYTHON_LIB_PREFIX}/python${PY_LIBVERSION}/config; ln -fs ../../libpython${PY_LIBVERSION}.so.1.0 libpython${PY_LIBVERSION}.so)
cd ${PRODUCT_DIR}/bin
-for sc in idle pydoc smtpd.py ; do
+for sc in idle pydoc smtpd.py 2to3 python${PY_LIBVERSION}-config ; do
if [ -e $sc ] ; then
- sed -e "s%#\!.*python%#\!/usr/bin/env python%" "$sc" > _"$sc"
+ sed -e "s%^#\!.*python.*$%#\!/usr/bin/env python%" "$sc" > _"$sc"
mv -f _"$sc" "$sc"
chmod a+x "$sc"
fi
check_jb tar xfz ${SOURCE_DIR}/${PRODUCT}.tar.gz -C ${PRODUCT_DIR}
-(cd ${PRODUCT_DIR}/lib/python2.6/config; ln -fs ../../libpython2.6.so.1.0 libpython2.6.so)
+(cd ${PRODUCT_DIR}/lib/python${PY_LIBVERSION}/config; ln -fs ../../libpython${PY_LIBVERSION}.so.1.0 libpython${PY_LIBVERSION}.so)
cd ${PRODUCT_DIR}/bin
for sc in idle pydoc smtpd.py ; do
shift
REMOVE_SRC_TMP=$8;
test $# == 10 && shift && SINGLE_DIR=$9
-export PRODUCT="Python-2.6.2"
+export PRODUCT="Python-${PY_VERSION}"
export PRODUCT_DIR=${INST_ROOT}/${SINGLE_DIR:-${PRODUCT}}
export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
export PRODUCT_SRC_DIR=${INST_ROOT}/${PRODUCT}_SRC