diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 83eb89c59acc4d4e7020ff04dbf0ee2c113f787d..8652c97c834849e5cb2e6baee9a7c0d25b03783a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -189,8 +189,6 @@ python3.12-gdal-bindings: extends: .common-build image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:24.04 only: - changes: - - SuperBuild/CMake/External_gdal.cmake refs: - develop - /^release-[0-9]+\.[0-9]+$/ diff --git a/CMakeLists.txt b/CMakeLists.txt index c6c4538620210a187e70be3897ab806d20fdb881..a826e4e5a68b0f838e35263be552adbf95a20d51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -427,9 +427,11 @@ if(UNIX) DESTINATION . COMPONENT Core ) - install( PROGRAMS + configure_file(${OTB_SOURCE_DIR}/Packaging/Files/post_install.sh.in + ${CMAKE_BINARY_DIR}/post_install.sh @ONLY) + install( PROGRAMS ${OTB_SOURCE_DIR}/Packaging/Files/check_python_env.sh - ${OTB_SOURCE_DIR}/Packaging/Files/post_install.sh + ${CMAKE_BINARY_DIR}/post_install.sh ${OTB_SOURCE_DIR}/Packaging/Files/sanitize_rpath.sh DESTINATION ./tools COMPONENT Core diff --git a/Packaging/Files/post_install.sh b/Packaging/Files/post_install.sh.in similarity index 66% rename from Packaging/Files/post_install.sh rename to Packaging/Files/post_install.sh.in index 9957faad0207056b4dec10bbefa460c4a5c4a297..1313c06ff3741259bd9c6122c81cec807125f9de 100644 --- a/Packaging/Files/post_install.sh +++ b/Packaging/Files/post_install.sh.in @@ -18,20 +18,28 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# avoid magic number. Version filled by cmake +OTB_SHORT_VERSION=@OTB_VERSION_MAJOR@.@OTB_VERSION_MINOR@ + echo "***** First time launching OTB after installation, doing some post installation steps before use *****" # Apply necessary patches for a modular install because cmake generates these file at configure time, not at packaging time -sed -i "s/\/builds\/otb\/xdk/\${OTB_INSTALL_PREFIX}/g" "$OTB_INSTALL_DIR"/lib/cmake/OTB-9.0/*.cmake -sed -i "s/\/builds\/otb\/xdk/\${OTB_INSTALL_PREFIX}/g" "$OTB_INSTALL_DIR"/lib/cmake/OTB-9.0/Modules/*.cmake -sed -i "s/\/builds\/otb\/xdk/\${OTB_INSTALL_PREFIX}/g" "$OTB_INSTALL_DIR"/lib/cmake/ITK-4.13/*.cmake -sed -i "s/\/builds\/otb\/xdk/\${OTB_INSTALL_PREFIX}/g" "$OTB_INSTALL_DIR"/lib/cmake/ITK-4.13/Modules/*.cmake +CMAKE_DIRS="$OTB_INSTALL_DIR/lib/cmake" +sed -i "s/FATAL_ERROR/WARNING/g" "$CMAKE_DIRS/OTB-$OTB_SHORT_VERSION/OTBTargets.cmake" +sed -i "s/FATAL_ERROR/WARNING/g" "$CMAKE_DIRS/OTB-$OTB_SHORT_VERSION/OTBModuleAPI.cmake" +sed -i "s/\/builds\/otb\/xdk/\${OTB_INSTALL_PREFIX}/g" "$CMAKE_DIRS"/OTB-"$OTB_SHORT_VERSION"/*.cmake +sed -i "s/\/builds\/otb\/xdk/\${OTB_INSTALL_PREFIX}/g" "$CMAKE_DIRS"/OTB-"$OTB_SHORT_VERSION"/Modules/*.cmake +sed -i "s/\/builds\/otb\/xdk/\${OTB_INSTALL_PREFIX}/g" "$CMAKE_DIRS"/ITK-4.13/*.cmake +sed -i "s/\/builds\/otb\/xdk/\${OTB_INSTALL_PREFIX}/g" "$CMAKE_DIRS"/ITK-4.13/Modules/*.cmake sed -i "s/\/builds\/otb\/xdk/\$OTB_INSTALL_DIR/g" "$OTB_INSTALL_DIR"/bin/gdal-config sed -i "s/\/builds\/otb\/xdk/\$OTB_INSTALL_DIR/g" "$OTB_INSTALL_DIR"/bin/curl-config sh "$OTB_INSTALL_DIR"/tools/sanitize_rpath.sh -# Check python version, if python 3.12 (ubuntu 24.04) download and extract the gdal bindings for python 3.12 + +# Check python version, if python 3.10 (ubuntu 22 and debian 12) download and extract the gdal bindings for python 3.10 pyversion="$(python3 -V 2>&1 | sed 's/.* \([0-9]\).\([0-9]*\).*/\1\2/')" if [ "$pyversion" = "312" ]; then echo "*** Python 3.12 detected, downloading gdal bindings compiled for python 3.12 ***" - PACKAGE_OTB_VERSION=`ls $OTB_INSTALL_DIR/lib/libOTBCommon.so.*.*.* | egrep -o "[0-9]+\.[0-9]+\.[0-9]$"` + PACKAGE_OTB_VERSION="$OTB_SHORT_VERSION.@OTB_VERSION_PATCH@" curl https://www.orfeo-toolbox.org/packages/archives/OTB/OTB-$PACKAGE_OTB_VERSION-GDAL-bindings-py312.tar.gz -o "$OTB_INSTALL_DIR"/tools/gdal-py312.tar.gz tar -xf "$OTB_INSTALL_DIR"/tools/gdal-py312.tar.gz -C "$OTB_INSTALL_DIR"/lib/python3/dist-packages/osgeo/ rm "$OTB_INSTALL_DIR"/tools/gdal-py312.tar.gz