From 56486fbd70cb5a216226861e73e81a43295894ef Mon Sep 17 00:00:00 2001
From: Boris Basic <boris.basic@edf.fr>
Date: Thu, 12 Oct 2023 17:08:01 +0200
Subject: [PATCH] Fix MED URL, update OpenBlas and MUMPS

---
 build-telemac.bat             | 12 ++++++------
 config/pysource.gnu.bat       |  2 +-
 config/pysource.gnu.debug.bat |  2 +-
 patches/mumps-5.2.1.patch     | 12 ++++++++++++
 4 files changed, 20 insertions(+), 8 deletions(-)
 create mode 100644 patches/mumps-5.2.1.patch

diff --git a/build-telemac.bat b/build-telemac.bat
index 52f05b6..8856d18 100644
--- a/build-telemac.bat
+++ b/build-telemac.bat
@@ -10,7 +10,7 @@ set hdf5=hdf5-1.10.9
 set med=med-4.1.1
 set metis=metis-5.1.0
 set msmpi=msmpi-10.1.2
-set openblas=openblas-0.3.21
+set openblas=openblas-0.3.24
 set scalapack=scalapack-2.1.0
 set mumps=mumps-5.2.1
 set aed2=libaed2-1.2.0
@@ -184,7 +184,7 @@ pushd %install_path%
 xcopy /e/y %~dp0config configs\ >nul
 call configs\pysource.gnu.bat
 
-rem Replace "#!/usr/bin/env python3" with  "#!/usr/bin/env python" so that the scripts
+rem Replace "#!/usr/bin/env python3" with "#!/usr/bin/env python" so that the scripts
 rem can be executed by the Python launcher using the active virtual environment
 rem This is done using "find" and "sed" from the GNU tools provided by Git for Windows
 for %%a in ("%git_path%\..\..") do set "path=%%~fa\usr\bin;%path%"
@@ -228,7 +228,7 @@ rem ***
 rem MED
 rem ***
 :build_med
-call :download %med% "https://files.salome-platform.org/Salome/other/med-4.1.1.tar.gz" || exit /b 1
+call :download %med% "https://files.salome-platform.org/Salome/medfile/med-4.1.1.tar.gz" || exit /b 1
 set cmake_config_options=-DHDF5_ROOT_DIR:PATH=%external_path%/%hdf5% -DMEDFILE_BUILD_TESTS:BOOL=OFF -DMEDFILE_INSTALL_DOC:BOOL=OFF
 if %compiler% == intel (
   rem MED libraries cannot be built as shared libraries with Visual Studio generator as they
@@ -290,8 +290,8 @@ rem ********
 rem OpenBLAS
 rem ********
 :build_openblas
-call :download %openblas% "https://github.com/xianyi/OpenBLAS/archive/refs/tags/v0.3.21.tar.gz" || exit /b 1
-set cmake_config_options=
+call :download %openblas% "https://github.com/xianyi/OpenBLAS/archive/refs/tags/v0.3.24.tar.gz" || exit /b 1
+set cmake_config_options=-DBUILD_TESTING=OFF
 call :cmake_build %openblas% || exit /b 1
 exit /b 0
 
@@ -309,7 +309,7 @@ rem *****
 rem MUMPS
 rem *****
 :build_mumps
-call :download %mumps% "https://github.com/scivision/mumps/archive/refs/tags/v5.4.1.11.zip" || exit /b 1
+call :download %mumps% "https://github.com/scivision/mumps/archive/refs/tags/v5.6.1.2.tar.gz" || exit /b 1
 set cmake_config_options=-DMUMPS_UPSTREAM_VERSION=5.2.1 -DBLAS_LIBRARY=%external_path%/%openblas%/lib/libopenblas.a -DLAPACK_LIBRARY=%external_path%/%openblas%/lib/libopenblas.a -DSCALAPACK_ROOT:PATH=%external_path%/%scalapack%
 if %compiler% == mingw (
   set cmake_config_options=%cmake_config_options% -DMPI_ROOT:PATH=%external_path%/%msmpi%
diff --git a/config/pysource.gnu.bat b/config/pysource.gnu.bat
index 537bb95..dfe46fa 100644
--- a/config/pysource.gnu.bat
+++ b/config/pysource.gnu.bat
@@ -42,7 +42,7 @@ rem MSPMPI
 set MPIHOME=%EXTERNAL%\msmpi-10.1.2
 set PATH=%MPIHOME%\bin;%PATH%
 rem OPENBLAS, SCALAPACK and MUMPS
-set OPENBLASHOME=%EXTERNAL%\openblas-0.3.21
+set OPENBLASHOME=%EXTERNAL%\openblas-0.3.24
 set SCALAPACKHOME=%EXTERNAL%\scalapack-2.1.0
 set MUMPSHOME=%EXTERNAL%\mumps-5.2.1
 rem AED
diff --git a/config/pysource.gnu.debug.bat b/config/pysource.gnu.debug.bat
index d6a3a5e..7c39617 100644
--- a/config/pysource.gnu.debug.bat
+++ b/config/pysource.gnu.debug.bat
@@ -42,7 +42,7 @@ rem MSPMPI
 set MPIHOME=%EXTERNAL%\msmpi-10.1.2
 set PATH=%MPIHOME%\bin;%PATH%
 rem OPENBLAS, SCALAPACK and MUMPS
-set OPENBLASHOME=%EXTERNAL%\openblas-0.3.21
+set OPENBLASHOME=%EXTERNAL%\openblas-0.3.24
 set SCALAPACKHOME=%EXTERNAL%\scalapack-2.1.0
 set MUMPSHOME=%EXTERNAL%\mumps-5.2.1
 rem AED
diff --git a/patches/mumps-5.2.1.patch b/patches/mumps-5.2.1.patch
new file mode 100644
index 0000000..03a8c55
--- /dev/null
+++ b/patches/mumps-5.2.1.patch
@@ -0,0 +1,12 @@
+diff -ur mumps-5.2.1/cmake/mumps_src.cmake mumps-5.2.1-patched/cmake/mumps_src.cmake
+--- mumps-5.2.1/cmake/mumps_src.cmake	2023-10-12 14:25:21.520763100 +0200
++++ mumps-5.2.1-patched/cmake/mumps_src.cmake	2023-09-08 19:42:43.000000000 +0200
+@@ -60,7 +60,7 @@
+ FetchContent_Declare(${PROJECT_NAME}
+ URL ${urls}
+ URL_HASH SHA256=${sha256}
+-TLS_VERIFY true
++TLS_VERIFY false
+ GIT_REMOTE_UPDATE_STRATEGY "CHECKOUT"
+ INACTIVITY_TIMEOUT 60
+ )
-- 
GitLab