commit:     b58fa2c46450b4fc8c410a8307fc9099af7e8f27
Author:     Bernd Waibel <waebbl-gentoo <AT> posteo <DOT> net>
AuthorDate: Wed Feb 15 12:49:47 2023 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Thu Feb 23 11:33:19 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b58fa2c4

media-gfx/netgen: add 6.2.2301

- enable support for py3.11

Closes: https://bugs.gentoo.org/895128
Closes: https://bugs.gentoo.org/894586
Signed-off-by: Bernd Waibel <waebbl-gentoo <AT> posteo.net>
Closes: https://github.com/gentoo/gentoo/pull/29593
Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>

 media-gfx/netgen/Manifest                          |   2 +-
 .../netgen-6.2.2204-use-external-pybind11.patch    |  30 ----
 ...tgen-6.2.2301-find-libjpeg-turbo-library.patch} |  10 +-
 ...gen-6.2.2301-fix-nullptr-deref-in-archive.patch |  31 ++++
 media-gfx/netgen/netgen-6.2.2301.ebuild            | 157 +++++++++++++++++++++
 5 files changed, 194 insertions(+), 36 deletions(-)

diff --git a/media-gfx/netgen/Manifest b/media-gfx/netgen/Manifest
index 51e722f4d15a..ad756e9e2e50 100644
--- a/media-gfx/netgen/Manifest
+++ b/media-gfx/netgen/Manifest
@@ -1 +1 @@
-DIST netgen-6.2.2204.tar.gz 3394806 BLAKE2B 
2b99854cab0890662f1ab7ffee6fb444b60a28ba0bfe9970a89c80c0e4c930c40b8034f9c600ddd61c9b60f542d1cae758a8c220a1ba76949bf9f97fb2fe9020
 SHA512 
964c40753613c111b0372b0e403b19734cc0c559d1e7e45bbe6b452f4daba10c6bde8abaa5c9541c92b4bccff02d32ea6ba8e8e06ba64f11fec1733f2e374cbf
+DIST netgen-6.2.2301.tar.gz 3394480 BLAKE2B 
358b0cf7ff4d372a9ede8ab9b7df24435a75bcad880cc83607443707ae096f2bafa35d8cd581533917d1aae85a18ac0ca902876a1c68f11664a0a3ef1ae00593
 SHA512 
7aebbc5cc3e3227b455ac9c5538e1f0110d5621e6ca7315f6811733bd93e88ccca467296b7915894a45202ed375b45d9387a1d113a720d4199eff782afb43070

diff --git a/media-gfx/netgen/files/netgen-6.2.2204-use-external-pybind11.patch 
b/media-gfx/netgen/files/netgen-6.2.2204-use-external-pybind11.patch
deleted file mode 100644
index ef11c8b0821a..000000000000
--- a/media-gfx/netgen/files/netgen-6.2.2204-use-external-pybind11.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From c3c55fe646ad6934e429edd080aceae54260551c Mon Sep 17 00:00:00 2001
-From: Bernd Waibel <[email protected]>
-Date: Sun, 30 Oct 2022 14:50:48 +0100
-Subject: [PATCH] use external pybind11
-
-Signed-off-by: Bernd Waibel <[email protected]>
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -302,7 +302,7 @@ else()
- endif()
- 
- if (USE_PYTHON)
--    add_subdirectory(external_dependencies/pybind11)
-+    find_package(pybind11)
-     find_path(PYBIND_INCLUDE_DIR pybind11/pybind11.h HINTS 
${PYTHON_INCLUDE_DIR})
-     if( PYBIND_INCLUDE_DIR )
-         message(STATUS "Found Pybind11: ${PYBIND_INCLUDE_DIR}")
---- a/cmake/SuperBuild.cmake
-+++ b/cmake/SuperBuild.cmake
-@@ -154,7 +154,6 @@ endif()
- #######################################################################
- if (USE_PYTHON)
-   find_path(PYBIND_INCLUDE_DIR pybind11/pybind11.h PATHS 
${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/pybind11/include 
NO_DEFAULT_PATH)
--    set(NG_INSTALL_PYBIND ON)
-     if( NOT PYBIND_INCLUDE_DIR )
-       # if the pybind submodule is missing, try to initialize and update all 
submodules
-       execute_process(COMMAND git submodule update --init --recursive 
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
--- 
-2.38.1
-

diff --git 
a/media-gfx/netgen/files/netgen-6.2.2204-find-libjpeg-turbo-library.patch 
b/media-gfx/netgen/files/netgen-6.2.2301-find-libjpeg-turbo-library.patch
similarity index 86%
rename from 
media-gfx/netgen/files/netgen-6.2.2204-find-libjpeg-turbo-library.patch
rename to 
media-gfx/netgen/files/netgen-6.2.2301-find-libjpeg-turbo-library.patch
index c45f5a4e4bdb..3b01321f7ced 100644
--- a/media-gfx/netgen/files/netgen-6.2.2204-find-libjpeg-turbo-library.patch
+++ b/media-gfx/netgen/files/netgen-6.2.2301-find-libjpeg-turbo-library.patch
@@ -1,6 +1,6 @@
-From 39160b692fd051f2638f1a6e1df38eb616b6d6cb Mon Sep 17 00:00:00 2001
+From d8a654a61452c39e3e611493ad70b8c6e818130e Mon Sep 17 00:00:00 2001
 From: Bernd Waibel <[email protected]>
-Date: Sun, 30 Oct 2022 16:09:43 +0100
+Date: Wed, 15 Feb 2023 12:28:00 +0100
 Subject: [PATCH] find libjpeg-turbo library
 
 Signed-off-by: Bernd Waibel <[email protected]>
@@ -10,8 +10,8 @@ Signed-off-by: Bernd Waibel <[email protected]>
      vssolution.cpp
      visualpkg.cpp
  )
--target_link_libraries( nggui PUBLIC "$<BUILD_INTERFACE:netgen_python>" 
${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} )
-+target_link_libraries( nggui PUBLIC "$<BUILD_INTERFACE:netgen_python>" 
${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} ${JPEG_LIBRARIES} )
+-target_link_libraries( nggui PUBLIC "$<BUILD_INTERFACE:netgen_python>" 
${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} nglib)
++target_link_libraries( nggui PUBLIC "$<BUILD_INTERFACE:netgen_python>" 
${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} ${JPEG_LIBRARIES} nglib)
  
  install(FILES
    meshdoc.hpp mvdraw.hpp visual_api.hpp
@@ -30,5 +30,5 @@ Signed-off-by: Bernd Waibel <[email protected]>
  
  install(TARGETS nglib netgen_cgns ${NG_INSTALL_DIR})
 -- 
-2.38.1
+2.39.1
 

diff --git 
a/media-gfx/netgen/files/netgen-6.2.2301-fix-nullptr-deref-in-archive.patch 
b/media-gfx/netgen/files/netgen-6.2.2301-fix-nullptr-deref-in-archive.patch
new file mode 100644
index 000000000000..b05d71221ca5
--- /dev/null
+++ b/media-gfx/netgen/files/netgen-6.2.2301-fix-nullptr-deref-in-archive.patch
@@ -0,0 +1,31 @@
+https://github.com/NGSolve/netgen/pull/123/commits/5ee4e43393936ab4c00feb58c48bc3a10e6bcbdb
+
+From 76276c5a3b0e70b27d44f7ce0a3ea064b23909da Mon Sep 17 00:00:00 2001
+From: Christopher Montgomery <[email protected]>
+From: Bernd Waibel <[email protected]>
+Date: Sun, 19 Feb 2023 12:18:12 +0100
+Subject: [PATCH] fix nullptr deref in archive
+
+Hardened toolchains (eg, mainline Fedora) no longer tolerate null
+derefs that were silently trapped/ignored in earlier versions.  This
+eliminates a nullptr deref in archive.hpp that was failing several
+unit tests (and causing crashes) when trying to manipulate
+default-constructed archive objects.
+
+Adapted original patch according the comment in the PR.
+
+Signed-off-by: Bernd Waibel <[email protected]>
+--- a/libsrc/core/archive.hpp
++++ b/libsrc/core/archive.hpp
+@@ -225,7 +225,7 @@ namespace ngcore
+       (*this) & size;
+       if(Input())
+         v.resize(size);
+-      Do(&v[0], size);
++      Do(v.data(), size);
+       return (*this);
+     }
+  
+-- 
+2.39.2
+

diff --git a/media-gfx/netgen/netgen-6.2.2301.ebuild 
b/media-gfx/netgen/netgen-6.2.2301.ebuild
new file mode 100644
index 000000000000..bd9fbd4c967b
--- /dev/null
+++ b/media-gfx/netgen/netgen-6.2.2301.ebuild
@@ -0,0 +1,157 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10,11} )
+inherit cmake desktop python-single-r1 xdg
+
+DESCRIPTION="Automatic 3d tetrahedral mesh generator"
+HOMEPAGE="https://ngsolve.org/ https://github.com/NGSolve/netgen";
+SRC_URI="https://github.com/NGSolve/netgen/archive/refs/tags/v${PV}.tar.gz -> 
${P}.tar.gz"
+
+SLOT="0"
+LICENSE="LGPL-2.1"
+KEYWORDS="~amd64 ~x86"
+
+IUSE="ffmpeg gui jpeg logging mpi opencascade python test"
+RESTRICT="!test? ( test )"
+
+REQUIRED_USE="
+       ${PYTHON_REQUIRED_USE}
+       ffmpeg? ( gui )
+       jpeg? ( gui )
+       python? ( gui )
+"
+
+DEPEND="
+       sys-libs/zlib
+       ffmpeg? ( media-video/ffmpeg:= )
+       gui? (
+               dev-lang/tcl:0/8.6
+               dev-lang/tk:0/8.6
+               media-libs/glu
+               virtual/opengl
+               x11-libs/libX11
+               x11-libs/libXmu
+               x11-libs/libxcb:=
+       )
+       jpeg? ( media-libs/libjpeg-turbo:0= )
+       logging? ( dev-libs/spdlog:= )
+       mpi? (
+               sci-libs/metis
+               virtual/mpi
+       )
+       opencascade? ( sci-libs/opencascade:= )
+       python? (
+               ${PYTHON_DEPS}
+               $(python_gen_cond_dep '
+                       dev-python/pybind11[${PYTHON_USEDEP}]
+                       '
+               )
+               mpi? (
+                       $(python_gen_cond_dep 
'dev-python/mpi4py[${PYTHON_USEDEP}]' )
+               )
+       )
+"
+RDEPEND="${DEPEND}"
+BDEPEND="
+       sys-apps/lsb-release
+       virtual/pkgconfig
+       gui? ( virtual/imagemagick-tools[png] )
+       test? (
+               <dev-cpp/catch-3:0
+               python? ( $(python_gen_cond_dep 
'dev-python/pytest[${PYTHON_USEDEP}]') )
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-6.2.2204-find-Tk-include-directories.patch"
+       "${FILESDIR}/${PN}-6.2.2204-link-against-ffmpeg.patch"
+       "${FILESDIR}/${PN}-6.2.2204-use-system-spdlog.patch"
+       "${FILESDIR}/${PN}-6.2.2204-use-system-catch.patch"
+       "${FILESDIR}/${PN}-6.2.2204-disable-failing-tests.patch"
+       "${FILESDIR}/${PN}-6.2.2204-disable-python-tests.patch"
+       "${FILESDIR}/${PN}-6.2.2301-find-libjpeg-turbo-library.patch"
+       "${FILESDIR}/${PN}-6.2.2301-fix-nullptr-deref-in-archive.patch"
+)
+
+pkg_setup() {
+       use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+       # NOTE: need to manually check and update this string on version bumps!
+       # git describe --tags --match "v[0-9]*" --long --dirty
+       cat <<- EOF > "${S}/version.txt" || die
+               v${PV}-0-g26d12898
+       EOF
+       cmake_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               # currently not working in a sandbox, expects netgen to be 
installed
+               # see https://github.com/NGSolve/netgen/issues/132
+               -DBUILD_STUB_FILES=OFF
+               -DENABLE_UNIT_TESTS=$(usex test)
+               -DINSTALL_PROFILES=OFF
+               -DNG_INSTALL_DIR_CMAKE="$(get_libdir)/cmake/${PN}"
+               -DNG_INSTALL_DIR_INCLUDE="include/${PN}"
+               -DNG_INSTALL_DIR_LIB="$(get_libdir)"
+               -DUSE_CCACHE=OFF
+               # doesn't build with this version
+               -DUSE_CGNS=OFF
+               -DUSE_GUI=$(usex gui)
+               -DUSE_INTERNAL_TCL=OFF
+               -DUSE_JPEG=$(usex jpeg)
+               -DUSE_MPEG=$(usex ffmpeg)
+               # respect users -march= choice
+               -DUSE_NATIVE_ARCH=OFF
+               -DUSE_MPI=$(usex mpi)
+               -DUSE_OCC=$(usex opencascade)
+               -DUSE_PYTHON=$(usex python)
+               -DUSE_SPDLOG=$(usex logging)
+               -DUSE_SUPERBUILD=OFF
+       )
+       # no need to set this, if we only build the library
+       if use gui; then
+               mycmakeargs+=( 
-DTK_INCLUDE_PATH="/usr/$(get_libdir)/tk8.6/include" )
+       fi
+       if use python; then
+               mycmakeargs+=(
+                       -DPREFER_SYSTEM_PYBIND11=ON
+                       # needed, so the value gets passed to 
NetgenConfig.cmake instead of ${T}/pythonX.Y
+                       -DPYTHON_EXECUTABLE="${PYTHON}"
+               )
+       fi
+       if use mpi && use python; then
+               mycmakeargs+=( -DUSE_MPI4PY=ON )
+       else
+               mycmakeargs+=( -DUSE_MPI4PY=OFF )
+       fi
+       cmake_src_configure
+}
+
+src_install() {
+       cmake_src_install
+       use python && python_optimize
+
+       local NETGENDIR="/usr/share/${PN}"
+       echo -e "NETGENDIR=${NETGENDIR}" > ./99netgen || die
+       doenvd 99netgen
+
+       if use gui; then
+               mv "${ED}"/usr/bin/{*.tcl,*.ocf} "${ED}${NETGENDIR}" || die
+
+               convert -deconstruct "${S}/windows/${PN}.ico" netgen.png || die
+               newicon -s 32 "${S}"/${PN}-2.png ${PN}.png
+               newicon -s 16 "${S}"/${PN}-3.png ${PN}.png
+               make_desktop_entry ${PN} "Netgen" netgen Graphics
+       fi
+
+       mv "${ED}"/usr/share/${PN}/doc/ng4.pdf "${ED}"/usr/share/doc/${PF} || 
die
+       dosym -r /usr/share/doc/${PF}/ng4.pdf /usr/share/${PN}/doc/ng4.pdf
+
+       use python || rm -r "${ED}${NETGENDIR}"/py_tutorials || die
+}

Reply via email to