commit:     00c85a7d9253e6d4c1b275a7174bc9936927c5b2
Author:     Alexander Puck Neuwirth <alexander <AT> neuwirth-informatik <DOT> 
de>
AuthorDate: Mon Jun 30 13:43:57 2025 +0000
Commit:     Alexander Puck Neuwirth <apn-pucky <AT> gentoo <DOT> org>
CommitDate: Mon Jul 21 15:31:36 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00c85a7d

sci-libs/med: add 5.0.0

Part-of: https://github.com/gentoo/gentoo/pull/42813
Signed-off-by: Alexander Puck Neuwirth <apn-pucky <AT> gentoo.org>

 sci-libs/med/Manifest                              |   1 +
 ...pecific-Adjust-install-path-for-build-dir.patch |  13 +++
 sci-libs/med/files/med-5.0.0-hdf5-1.14.patch       | 117 +++++++++++++++++++++
 sci-libs/med/med-5.0.0.ebuild                      | 100 ++++++++++++++++++
 4 files changed, 231 insertions(+)

diff --git a/sci-libs/med/Manifest b/sci-libs/med/Manifest
index fa39d9acb1a5..6920992c4cf5 100644
--- a/sci-libs/med/Manifest
+++ b/sci-libs/med/Manifest
@@ -1 +1,2 @@
 DIST med-4.1.1.tar.gz 50506725 BLAKE2B 
fb9bc3239c18c53fa42c5dd1101559746e8d38db2a3cb5fb47d1bf0cb578facc4ab95409af8524f5c20251848842cc1a331f6a816ce0754e9a6c95f507174ed1
 SHA512 
8917e7ecfe30e1259b0927c8e1c3d6efd86ed2386813f6d90217bd95589199478e587f0815031ab65cacf7901a30b77a6307414f9073caffe6e7f013e710d768
+DIST med-5.0.0.gh.tar.gz 47357864 BLAKE2B 
c09aef4a7b2f503eda8d06dcae33ba5a7483a1c4fde6d25d3c17595f30d037c9b704ee211d298898fa62874e597373891dac482d31b6ca04649c0973e608c7bd
 SHA512 
6ebb06bf403dbe32512a42179a42de3da6f264034fcc143fcb2b780c5d564527656d3ef28ebf25d7bde93a9d2a44df0d10a09d60e6f4720ba9d25719a4e30d37

diff --git 
a/sci-libs/med/files/med-5.0.0-0001-Gentoo-specific-Adjust-install-path-for-build-dir.patch
 
b/sci-libs/med/files/med-5.0.0-0001-Gentoo-specific-Adjust-install-path-for-build-dir.patch
new file mode 100644
index 000000000000..6e46dde1e48d
--- /dev/null
+++ 
b/sci-libs/med/files/med-5.0.0-0001-Gentoo-specific-Adjust-install-path-for-build-dir.patch
@@ -0,0 +1,13 @@
+diff --git a/tools/mdump/CMakeLists.txt b/tools/mdump/CMakeLists.txt
+--- a/tools/mdump/CMakeLists.txt
++++ b/tools/mdump/CMakeLists.txt
+@@ -48,6 +48,6 @@
+   INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy mdump4.exe 
mdump.exe WORKING_DIRECTORY ${DESTDIR}${CMAKE_INSTALL_PREFIX}/bin)")
+   INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy xmdump4 
xmdump WORKING_DIRECTORY ${DESTDIR}${CMAKE_INSTALL_PREFIX}/bin)")
+ ELSE(WIN32)
+-  INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink 
mdump4 mdump WORKING_DIRECTORY ${DESTDIR}${CMAKE_INSTALL_PREFIX}/bin)")
+-  INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink 
xmdump4 xmdump WORKING_DIRECTORY ${DESTDIR}${CMAKE_INSTALL_PREFIX}/bin)")
++  INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink 
mdump4 mdump WORKING_DIRECTORY \"\$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/bin\")")
++  INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink 
xmdump4 xmdump WORKING_DIRECTORY 
\"\$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/bin\")")
+ ENDIF(WIN32)
+

diff --git a/sci-libs/med/files/med-5.0.0-hdf5-1.14.patch 
b/sci-libs/med/files/med-5.0.0-hdf5-1.14.patch
new file mode 100644
index 000000000000..29902063e3d4
--- /dev/null
+++ b/sci-libs/med/files/med-5.0.0-hdf5-1.14.patch
@@ -0,0 +1,117 @@
+diff -rupN --no-dereference med-5.0.0/config/cmake_files/medMacros.cmake 
med-5.0.0-new/config/cmake_files/medMacros.cmake
+--- med-5.0.0/config/cmake_files/medMacros.cmake       2025-01-24 
00:28:04.460898497 +0100
++++ med-5.0.0-new/config/cmake_files/medMacros.cmake   2025-01-24 
00:28:04.857640862 +0100
+@@ -447,7 +447,7 @@ MACRO(MED_FIND_HDF5)
+     ##
+     ## Requires 1.12.x version
+     ##
+-    IF (NOT HDF_VERSION_MAJOR_REF EQUAL 1 OR NOT HDF_VERSION_MINOR_REF EQUAL 
12 OR NOT HDF_VERSION_RELEASE_REF GREATER 0)
++    IF (HDF5_VERSION VERSION_LESS 1.12.1)
+         MESSAGE(FATAL_ERROR "HDF5 version is ${HDF_VERSION_REF}. Only 
versions >= 1.12.1 are supported.")
+     ENDIF()
+     ##
+diff -rupN --no-dereference med-5.0.0/src/ci/MEDfileCompatibility.c 
med-5.0.0-new/src/ci/MEDfileCompatibility.c
+--- med-5.0.0/src/ci/MEDfileCompatibility.c    2023-06-05 14:14:44.000000000 
+0200
++++ med-5.0.0-new/src/ci/MEDfileCompatibility.c        2025-01-24 
00:28:04.858068408 +0100
+@@ -116,7 +116,7 @@ MEDfileCompatibility(const char* const f
+ #if MED_NUM_MAJEUR != 5
+ #error "Don't forget to update the test version here when you change the 
major version of the library !"
+ #endif
+-#if H5_VERS_MINOR > 12
++#if H5_VERS_MINOR > 14
+ #error "Don't forget to check the compatibility version of the library, 
depending on the internal hdf model choice !"
+ #error "Cf. _MEDfileCreate ..."
+ #endif
+diff -rupN --no-dereference med-5.0.0/src/hdfi/_MEDfileCreate.c 
med-5.0.0-new/src/hdfi/_MEDfileCreate.c
+--- med-5.0.0/src/hdfi/_MEDfileCreate.c        2023-06-05 14:14:45.000000000 
+0200
++++ med-5.0.0-new/src/hdfi/_MEDfileCreate.c    2025-01-24 00:28:04.858334666 
+0100
+@@ -189,7 +189,7 @@ med_idt _MEDfileCreate(const char * cons
+    * Cette ligne est censée obliger HDF à ne pas utiliser un modèle interne 
différent de 1.10.z
+    * Un test autoconf permet de fixer un intervalle de version HDF à MED.
+    */
+-#if H5_VERS_MINOR > 12
++#if H5_VERS_MINOR > 14
+ #error "Don't forget to change the compatibility version of the library !"
+ #endif
+    
+diff -rupN --no-dereference med-5.0.0/src/hdfi/_MEDfileOpen.c 
med-5.0.0-new/src/hdfi/_MEDfileOpen.c
+--- med-5.0.0/src/hdfi/_MEDfileOpen.c  2023-06-05 14:14:45.000000000 +0200
++++ med-5.0.0-new/src/hdfi/_MEDfileOpen.c      2025-01-24 00:28:04.858574380 
+0100
+@@ -113,7 +113,7 @@ med_idt _MEDfileOpen(const char * const
+        has been set in the group creation property list (see 
H5Pset_link_creation_order).
+   */
+ 
+-#if H5_VERS_MINOR > 12
++#if H5_VERS_MINOR > 14
+ #error "Don't forget to change the compatibility version of the library !"
+ #endif
+ /* L'avantage de bloquer le modèle interne HDF5
+diff -rupN --no-dereference med-5.0.0/src/hdfi/_MEDfileOpenForImport.c 
med-5.0.0-new/src/hdfi/_MEDfileOpenForImport.c
+--- med-5.0.0/src/hdfi/_MEDfileOpenForImport.c 2023-06-05 14:14:45.000000000 
+0200
++++ med-5.0.0-new/src/hdfi/_MEDfileOpenForImport.c     2025-01-24 
00:28:04.858834390 +0100
+@@ -53,7 +53,7 @@ med_idt  _MEDfileOpenForImport(const cha
+   }
+ 
+ 
+-#if H5_VERS_MINOR > 12
++#if H5_VERS_MINOR > 14
+ #error "Don't forget to change the compatibility version of the library !"
+ #endif
+ /* L'avantage de bloquer le modèle interne HDF5
+diff -rupN --no-dereference med-5.0.0/src/hdfi/_MEDmemFileOpen.c 
med-5.0.0-new/src/hdfi/_MEDmemFileOpen.c
+--- med-5.0.0/src/hdfi/_MEDmemFileOpen.c       2023-06-05 14:14:45.000000000 
+0200
++++ med-5.0.0-new/src/hdfi/_MEDmemFileOpen.c   2025-01-24 00:28:04.859128966 
+0100
+@@ -439,7 +439,7 @@ med_idt _MEDmemFileOpen(const char * con
+     goto ERROR;
+   }
+ 
+-#if H5_VERS_MINOR > 12
++#if H5_VERS_MINOR > 14
+ #error "Don't forget to change the compatibility version of the library !"
+ #endif
+   if ( H5Pset_libver_bounds( _fapl, H5F_LIBVER_V112, H5F_LIBVER_V112 ) ) {
+@@ -506,7 +506,7 @@ med_idt _MEDmemFileOpen(const char * con
+       goto ERROR;
+       }
+       _fversionMM = 100*_fmajor+10*_fminor;
+-#if H5_VERS_MINOR > 12
++#if H5_VERS_MINOR > 14
+ #error "Don't forget to change the compatibility version of the library !"
+ #endif
+       if ( _fversionMM < 500 ) { /*100*MED_NUM_MAJEUR+10*MED_NUM_MINEUR*/
+diff -rupN --no-dereference med-5.0.0/src/hdfi/_MEDparFileCreate.c 
med-5.0.0-new/src/hdfi/_MEDparFileCreate.c
+--- med-5.0.0/src/hdfi/_MEDparFileCreate.c     2023-06-05 14:14:45.000000000 
+0200
++++ med-5.0.0-new/src/hdfi/_MEDparFileCreate.c 2025-01-24 00:28:04.859422685 
+0100
+@@ -64,7 +64,7 @@ med_idt _MEDparFileCreate(const char * c
+    * En HDF5-1.10.0p1 cela n'a aucun effet ! 
+    * Un test autoconf permet de fixer un intervalle de version HDF à MED.
+    */
+-#if H5_VERS_MINOR > 12
++#if H5_VERS_MINOR > 14
+ #error "Don't forget to change the compatibility version of the library !"
+ #endif
+    
+diff -rupN --no-dereference med-5.0.0/src/hdfi/_MEDparFileOpen.c 
med-5.0.0-new/src/hdfi/_MEDparFileOpen.c
+--- med-5.0.0/src/hdfi/_MEDparFileOpen.c       2023-06-05 14:14:45.000000000 
+0200
++++ med-5.0.0-new/src/hdfi/_MEDparFileOpen.c   2025-01-24 00:28:04.859632596 
+0100
+@@ -86,7 +86,7 @@ med_idt _MEDparFileOpen(const char * con
+   }
+   _fversionMM = 100*_fmajor+10*_fminor;
+ 
+-#if H5_VERS_MINOR > 12
++#if H5_VERS_MINOR > 14
+ #error "Don't forget to change the compatibility version of the library !"
+ #endif 
+   if ( _fversionMM < 500 ) { /*100*MED_NUM_MAJEUR+10*MED_NUM_MINEUR*/
+diff -rupN --no-dereference med-5.0.0/src/misc/MEDversionedApi3C.c 
med-5.0.0-new/src/misc/MEDversionedApi3C.c
+--- med-5.0.0/src/misc/MEDversionedApi3C.c     2023-06-05 14:14:45.000000000 
+0200
++++ med-5.0.0-new/src/misc/MEDversionedApi3C.c 2025-01-24 00:28:04.859890990 
+0100
+@@ -114,7 +114,7 @@ MedFuncType _MEDversionedApi3( const cha
+   /*      (_fversionMM <= (100*MED_NUM_MAJEUR+10*MED_NUM_MINEUR) ) */
+   /*      ) { */
+ 
+-#if H5_VERS_MINOR > 12
++#if H5_VERS_MINOR > 14
+ #error "Don't forget to change the compatibility version of the library !"
+ #endif
+   

diff --git a/sci-libs/med/med-5.0.0.ebuild b/sci-libs/med/med-5.0.0.ebuild
new file mode 100644
index 000000000000..a83933f4f7e9
--- /dev/null
+++ b/sci-libs/med/med-5.0.0.ebuild
@@ -0,0 +1,100 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+FORTRAN_NEEDED=fortran
+
+inherit cmake flag-o-matic fortran-2 optfeature
+
+DESCRIPTION="Library to store and exchange meshed data or computation results"
+HOMEPAGE="
+       https://www.salome-platform.org/?page_id=2768
+       
https://docs.salome-platform.org/latest/dev/MEDCoupling/developer/med-file.html
+"
+# The original url blocks curl 
https://files.salome-platform.org/Salome/medfile/${P}.tar.bz2
+# so we use the arch git mirror. It has the exact same files. The version 
5.0.0 also does
+# not exist as a tag in the linked github repo..., since med-files is a 
submodule of med.
+SRC_URI="https://github.com/chennes/med/archive/refs/tags/v${PV}.tar.gz -> 
${P}.gh.tar.gz"
+LICENSE="LGPL-3"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc fortran mpi test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       >=sci-libs/hdf5-1.12.1:=[fortran?,mpi(+)?]
+       mpi? ( virtual/mpi[fortran?] )
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+       
"${FILESDIR}/${PN}-5.0.0-0001-Gentoo-specific-Adjust-install-path-for-build-dir.patch"
+       
"${FILESDIR}/${PN}-4.1.0-0002-Re-add-option-for-building-Fortran-library.patch"
+       # https://src.fedoraproject.org/rpms/med/raw/rawhide/f/hdf5-1.14.patch
+       "${FILESDIR}/${PN}-5.0.0-hdf5-1.14.patch"
+)
+
+DOCS=( AUTHORS ChangeLog NEWS README README.CMAKE TODO )
+
+src_prepare() {
+       if use test; then
+               # test10 only works with med 4.1.1, so we let MED detect the 
version itself
+               # instead of hardcoding it to 5.0.0
+               sed -i -e 
's/MEDfileVersionOpen(filename,MODE_ACCES,MED_MAJOR_NUM,MED_MINOR_NUM,MED_RELEASE_NUM)/MEDfileOpen(filename,MODE_ACCES)/g'
 tests/c/test10*.c || die "could not patch test10"
+       fi
+       # gentoo package is called med, while the original is called 
med-fichier (med files)
+       sed -e 's/med-fichier/med/' -i CMakeLists.txt || die "fix paths failed"
+       sed -e 's|doc/med-${MED_STR_VERSION}|doc/'${PF}'/html|' \
+               -i CMakeLists.txt || die "fix doc path failed"
+
+       # bug #862900, already reported upstream. CHECK on updates!
+       filter-lto
+
+       cmake_src_prepare
+}
+
+src_configure() {
+       # bug #943874
+       append-cflags -std=gnu17
+
+       local mycmakeargs=(
+               # as indicated in the CMakeLists.txt, the shipped documentation 
is generated by a custom doxygen,
+               # so let's avoid rebuilding it because it will be different
+               -DMEDFILE_BUILD_DOC=OFF
+               -DMEDFILE_BUILD_FORTRAN=$(usex fortran)
+               -DMEDFILE_BUILD_PYTHON=OFF
+               -DMEDFILE_BUILD_SHARED_LIBS=ON
+               -DMEDFILE_BUILD_STATIC_LIBS=OFF
+               -DMEDFILE_BUILD_TESTS=$(usex test)
+               -DMEDFILE_INSTALL_DOC=$(usex doc)
+               -DMEDFILE_USE_MPI=$(usex mpi)
+               -DMEDFILE_USE_UNICODE=ON
+       )
+       cmake_src_configure
+}
+
+src_test() {
+       # override parallel mode only for tests
+       cmake_src_test -j1
+}
+
+src_install() {
+       cmake_src_install
+
+       # we don't need old 2.3.6 include files
+       rm -r "${ED}"/usr/include/2.3.6 || die "failed to delete obsolete 
include dir"
+
+       # Prevent test executables being installed
+       if use test; then
+               rm -r "${ED}"/usr/bin/testc || die "failed to delete C test 
executables"
+               if use fortran; then
+                       rm -r "${ED}"/usr/bin/testf || die "failed to delete 
fortran test executables"
+               fi
+       fi
+}
+
+pkg_postinst() {
+       optfeature "xmdump scripts support" dev-lang/tk
+}

Reply via email to