From b2575b4214a5833eb9a242ceb41993adc9fa0f0f Mon Sep 17 00:00:00 2001 From: Nabil Ghodbane Date: Wed, 15 Feb 2023 16:06:16 +0100 Subject: [PATCH] spns #33796: build for Ubuntu 22.04 --- applications/MEDCOUPLING-9.8.0.pyconf | 7 ++- products/Python.pyconf | 6 ++ products/compil_scripts/Python-3.8.sh | 81 +++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100755 products/compil_scripts/Python-3.8.sh diff --git a/applications/MEDCOUPLING-9.8.0.pyconf b/applications/MEDCOUPLING-9.8.0.pyconf index 6774d9c..d43201c 100644 --- a/applications/MEDCOUPLING-9.8.0.pyconf +++ b/applications/MEDCOUPLING-9.8.0.pyconf @@ -92,4 +92,9 @@ __overwrite__ : __condition__: "VARS.dist in ['FD34']" 'PRODUCTS.Python.version_3_6_5.patches' : ["python_3.6.5-allocation.patch"] # https://github.com/pyenv/pyenv/issues/1889 } -] \ No newline at end of file + { + __condition__ : "VARS.dist in ['UB22.04']" + 'APPLICATION.products.Python': '3.8.10' + 'APPLICATION.products.hdf5' : 'native' + } +] diff --git a/products/Python.pyconf b/products/Python.pyconf index ca4be1b..1503454 100755 --- a/products/Python.pyconf +++ b/products/Python.pyconf @@ -124,6 +124,12 @@ version_3_7_14_win : build_depend : ['perl'] } +version_3_8_10_UB22_04: +{ + compil_script : "Python-3.8.sh" + patches: [] +} + version_3_9_14 : { compil_script : "Python-3.9.sh" diff --git a/products/compil_scripts/Python-3.8.sh b/products/compil_scripts/Python-3.8.sh new file mode 100755 index 0000000..e76fd74 --- /dev/null +++ b/products/compil_scripts/Python-3.8.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +echo "##########################################################################" +echo "Python" $VERSION +echo "##########################################################################" + +if [ ${#VERSION} -lt 5 ] +then + echo "ERROR : VERSION argument of Python compilation script has not the expected x.y.z format" + exit 1 +fi +PYTHON_VERSION="${VERSION:0:3}" + +# --enable-shared : enable building shared python library +# --with-threads : enable thread support +# --without-pymalloc: disable specialized mallocs +# --with-ensurepip : installation using bundled pip +# --enable-optimizations: recommandé et utilisé par Nijni -> mais trop long! +CONFIGURE_ARGUMENTS="--enable-shared --with-threads --with-ensurepip=install --with-ssl --enable-loadable-sqlite-extensions --with-pymalloc" + +echo +echo "*** configure --prefix=$PRODUCT_INSTALL $CONFIGURE_ARGUMENTS" +$SOURCE_DIR/configure --prefix=$PRODUCT_INSTALL $CONFIGURE_ARGUMENTS +if [ $? -ne 0 ] +then + echo "ERROR on configure" + exit 1 +fi + +echo +echo "*** make" $MAKE_OPTIONS +make $MAKE_OPTIONS +if [ $? -ne 0 ] +then + echo "ERROR on make" + exit 2 +fi + +echo +echo "*** make install" +make install +if [ $? -ne 0 ] +then + echo "ERROR on make install" + exit 3 +fi + +cd ${PRODUCT_INSTALL}/lib/python${PYTHON_VERSION}/config-${PYTHON_VERSION}* + +if [ ! -e libpython${PYTHON_VERSION}.so ] +then + echo + echo "*** create missing link" + ln -sf ../../libpython${PYTHON_VERSION}.so . + if [ $? -ne 0 ] + then + echo "ERROR when creating missing link" + # no error here + fi +fi +cd ${PRODUCT_INSTALL}/bin +ln -s python3 python +ln -s pip3 pip +# +if [ "${SAT_ENABLE_PYTHON_PYMALLOC}" == "1" ]; then + cd ${PRODUCT_INSTALL}/include + if [ ! -d python3.8 ]; then + ln -s python3.8m python3.8 + fi +fi + +# fix the path... +L="2to3 2to3-3.8 easy_install-3.8 idle3 idle3.8 pip3 pip3.8 pydoc3 pydoc3.8 pyvenv pyvenv-3.8" +cd ${PRODUCT_INSTALL}/bin +for f in $L; do + awk '$0 = NR==1 ? replace : $0' replace="#!/usr/bin/env python3" $f > $f.t && mv $f.t $f && chmod 755 $f +done + +echo +echo "########## END" + -- 2.39.2