From f98af9d9ce2af65368e4f572c19d11c204455b1b Mon Sep 17 00:00:00 2001 From: Nabil Ghodbane Date: Tue, 11 Jan 2022 13:52:45 +0100 Subject: [PATCH] spns #26828: netcdf et gdal --- products/compil_scripts/gdal-2.4.0.sh | 46 +++++++++++++ products/compil_scripts/netcdf-4.6.2.sh | 89 +++++++++++++++++++++++++ products/env_scripts/gdal.py | 11 +++ products/env_scripts/netcdf.py | 11 +++ products/gdal.pyconf | 42 ++++++++++++ products/netcdf.pyconf | 42 ++++++++++++ 6 files changed, 241 insertions(+) create mode 100755 products/compil_scripts/gdal-2.4.0.sh create mode 100755 products/compil_scripts/netcdf-4.6.2.sh create mode 100644 products/env_scripts/gdal.py create mode 100644 products/env_scripts/netcdf.py create mode 100644 products/gdal.pyconf create mode 100644 products/netcdf.pyconf diff --git a/products/compil_scripts/gdal-2.4.0.sh b/products/compil_scripts/gdal-2.4.0.sh new file mode 100755 index 0000000..e95e566 --- /dev/null +++ b/products/compil_scripts/gdal-2.4.0.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +echo "##########################################################################" +echo "gdal" $VERSION +echo "##########################################################################" + +CONFIGURE_FLAGS= +CONFIGURE_FLAGS+=" --with-threads" +CONFIGURE_FLAGS+=" --with-python=${PYTHONBIN}" +CONFIGURE_FLAGS+=" --with-xml2=${LIBXML_ROOT_DIR}" +CONFIGURE_FLAGS+=" --with-hdf5=${HDF5_ROOT_DIR}" +CONFIGURE_FLAGS+=" --with-netcdf=${NETCDF_ROOT_DIR}" + +echo +echo "*** configure --prefix=$PRODUCT_INSTALL $CONFIGURE_FLAGS" + +rm -rf $BUILD_DIR +mkdir -p $BUILD_DIR +cd $SOURCE_DIR +$SOURCE_DIR/gdal/configure --prefix=$PRODUCT_INSTALL $CONFIGURE_FLAGS +if [ $? -ne 0 ] +then + echo "ERROR on configure" + exit 1 +fi +echo +echo "*** make" $MAKE_OPTIONS +make -F GNUMakefile $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 + +echo +echo "########## END" + diff --git a/products/compil_scripts/netcdf-4.6.2.sh b/products/compil_scripts/netcdf-4.6.2.sh new file mode 100755 index 0000000..4f54823 --- /dev/null +++ b/products/compil_scripts/netcdf-4.6.2.sh @@ -0,0 +1,89 @@ +#!/bin/bash + +echo "##########################################################################" +echo "netcdf" $VERSION +echo "##########################################################################" + +if [ -n "$MPI_ROOT_DIR" ] +then + echo "WARNING: setting CC and CXX environment variables and target MPI wrapper" + export CC=${MPI_ROOT_DIR}/bin/mpicc + export CXX=${MPI_ROOT_DIR}/bin/mpicxx +fi + +CMAKE_OPTIONS="" +CMAKE_OPTIONS+=" -DCMAKE_INSTALL_PREFIX:STRING=${PRODUCT_INSTALL}" +CMAKE_OPTIONS+=" -DENABLE_NETCDF_4=ON" +CMAKE_OPTIONS+=" -DENABLE_DAP=ON" +CMAKE_OPTIONS+=" -BUILD_UTILITIES=ON" +CMAKE_OPTIONS+=" -DBUILD_SHARED_LIBS=ON" +CMAKE_OPTIONS+=" -DENABLE_TESTS=ON" +CMAKE_OPTIONS+=" -DPYTHON_EXECUTABLE=${PYTHONBIN}" +CMAKE_OPTIONS+=" -DSWIG_EXECUTABLE=${SWIG_ROOT_DIR}/bin/swig" + +if [ -n "$TBB_ROOT_DIR" ] && [ "${TBB_ROOT_DIR}" != "/usr" ]; then + CMAKE_OPTIONS+=" -DTBB_ROOT_DIR=${TBB_ROOT_DIR}" +fi + +### libxml2 settings +if [ -n "$LIBXML2_ROOT_DIR" ] && [ "${LIBXML2_ROOT_DIR}" != "/usr" ]; then + CMAKE_OPTIONS+=" -DLIBXML2_INCLUDE_DIR:STRING=${LIBXML2_ROOT_DIR}/include/libxml2" + CMAKE_OPTIONS+=" -DLIBXML2_LIBRARIES:STRING=${LIBXML2_ROOT_DIR}/lib/libxml2.so" + CMAKE_OPTIONS+=" -DLIBXML2_XMLLINT_EXECUTABLE=${LIBXML2_ROOT_DIR}/bin/xmllint" +fi + +# HDF5 +if [ -n "$HDF5_ROOT_DIR" ] && [ "${HDF5_ROOT_DIR}" != "/usr" ]; then + CMAKE_OPTIONS+=" -DHDF5_DIR:PATH=${HDF5_ROOT_DIR}/share/cmake/hdf5" + CMAKE_OPTIONS+=" -DHDF5_USE_STATIC_LIBRARIES:BOOL=OFF" + CMAKE_OPTIONS+=" -DHDF5_ROOT:PATH=${HDF5_ROOT_DIR}" + CMAKE_OPTIONS+=" -DHDF5_hdf5_LIBRARY_RELEASE=${HDF5_ROOT_DIR}/lib" + CMAKE_OPTIONS+=" -DHDF5_hdf5_hl_LIBRARY_RELEASE=${HDF5_ROOT_DIR}/lib/libhdf5_hl.so" + CMAKE_OPTIONS+=" -DHDF5_HL_LIBRARY=${HDF5_ROOT_DIR}/lib/libhdf5_hl.so" + CMAKE_OPTIONS+=" -DHDF5_C_INCLUDE_DIR=${HDF5_ROOT_DIR}/include" +fi + +### libxml2 settings +if [ -n "$LIBXML2_ROOT_DIR" ] && [ "${LIBXML2_ROOT_DIR}" != "/usr" ]; then + CMAKE_OPTIONS+=" -DLIBXML2_INCLUDE_DIR:STRING=${LIBXML2_ROOT_DIR}/include/libxml2" + CMAKE_OPTIONS+=" -DLIBXML2_LIBRARIES:STRING=${LIBXML2_ROOT_DIR}/lib/libxml2.so" + CMAKE_OPTIONS+=" -DLIBXML2_XMLLINT_EXECUTABLE=${LIBXML2_ROOT_DIR}/bin/xmllint" +fi + +## nlopt +if [ -n "$NLOPT_ROOT_DIR" ] && [ "${NLOPT_ROOT_DIR}" != "/usr" ]; then + CMAKE_OPTIONS+=" -DNLOPT_INCLUDE_DIRS:STRING=${NLOPT_ROOT_DIR}/include" + CMAKE_OPTIONS+=" -DNLOPT_LIBRARIES:STRING=${NLOPT_ROOT_DIR}/lib" + CMAKE_OPTIONS+=" -DNLOPT_DIR:STRING=${NLOPT_ROOT_DIR}" +fi + +echo +echo "*** cmake" $CMAKE_OPTIONS +cd $BUILD_DIR +cmake $CMAKE_OPTIONS $SOURCE_DIR/ +if [ $? -ne 0 ] +then + echo "ERROR on cmake" + 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 + +echo +echo "########## END" diff --git a/products/env_scripts/gdal.py b/products/env_scripts/gdal.py new file mode 100644 index 0000000..10e1c13 --- /dev/null +++ b/products/env_scripts/gdal.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python +import os.path + +def set_env(env, prereq_dir, version): + env.set('GDAL_ROOT_DIR', prereq_dir) + env.set('GDAL_VERSION',version) + env.prepend('PATH', os.path.join(prereq_dir,'bin')) + env.prepend('LD_LIBRARY_PATH',os.path.join(prereq_dir, 'lib')) + +def set_nativ_env(env): + pass diff --git a/products/env_scripts/netcdf.py b/products/env_scripts/netcdf.py new file mode 100644 index 0000000..f201e2f --- /dev/null +++ b/products/env_scripts/netcdf.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python +import os.path + +def set_env(env, prereq_dir, version): + env.set('NETCFD_ROOT_DIR', prereq_dir) + env.set('NETCFD_VERSION',version) + env.prepend('PATH', os.path.join(prereq_dir,'bin')) + env.prepend('LD_LIBRARY_PATH',os.path.join(prereq_dir, 'lib')) + +def set_nativ_env(env): + pass diff --git a/products/gdal.pyconf b/products/gdal.pyconf new file mode 100644 index 0000000..5688bb4 --- /dev/null +++ b/products/gdal.pyconf @@ -0,0 +1,42 @@ +default : +{ + name : "gdal" + build_source : "script" + compil_script : $name + $VARS.scriptExtension + get_source : "archive" + archive_info : + { + archive_name : "gdal-" + $APPLICATION.products.gdal + ".tar.gz" + } + environ : + { + env_script : $name + ".py" + } + depend : ['Python', 'lapack', 'hdf5', 'tbb', 'nlopt', 'libxml2', 'eigen', 'netcdf'] + build_depend : ["cmake", "swig"] + opt_depend : ['openmpi'] + patches : [] + source_dir : $APPLICATION.workdir + $VARS.sep + 'SOURCES' + $VARS.sep + $name + build_dir : $APPLICATION.workdir + $VARS.sep + 'BUILD' + $VARS.sep + $name + install_dir : 'base' + properties : + { + single_install_dir : "no" + incremental : "yes" + } +} + +default_win : +{ + properties : + { + single_install_dir : "yes" + } + depend : ['Python', 'lapack', 'hdf5', 'tbb', 'nlopt', 'libxml2', 'eigen', 'pthreads'] + opt_depend : [] +} + +version_2_4_0: +{ + compil_script : 'gdal-2.4.0' + $VARS.scriptExtension +} diff --git a/products/netcdf.pyconf b/products/netcdf.pyconf new file mode 100644 index 0000000..202f145 --- /dev/null +++ b/products/netcdf.pyconf @@ -0,0 +1,42 @@ +default : +{ + name : "netcdf" + build_source : "script" + compil_script : $name + $VARS.scriptExtension + get_source : "archive" + archive_info : + { + archive_name : "netcdf-c-" + $APPLICATION.products.netcdf + ".tar.gz" + } + environ : + { + env_script : $name + ".py" + } + depend : ['Python', 'lapack', 'hdf5', 'tbb', 'nlopt', 'libxml2', 'eigen'] + build_depend : ["cmake", "swig"] + opt_depend : ['openmpi'] + patches : [] + source_dir : $APPLICATION.workdir + $VARS.sep + 'SOURCES' + $VARS.sep + $name + build_dir : $APPLICATION.workdir + $VARS.sep + 'BUILD' + $VARS.sep + $name + install_dir : 'base' + properties : + { + single_install_dir : "no" + incremental : "yes" + } +} + +default_win : +{ + properties : + { + single_install_dir : "yes" + } + depend : ['Python', 'lapack', 'hdf5', 'tbb', 'nlopt', 'libxml2', 'eigen', 'pthreads'] + opt_depend : [] +} + +version_4_6_2: +{ + compil_script : 'netcdf-4.6.2' + $VARS.scriptExtension +} -- 2.39.2