commit:     f73f853373a42bd8b02c51c79651a847d0c34058
Author:     Bernd Waibel <waebbl-gentoo <AT> posteo <DOT> net>
AuthorDate: Mon Oct 31 14:35:10 2022 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Tue Nov 15 12:01:33 2022 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=f73f8533

sci-mathematics/netgen: add 6.2.2204

- OpenMP doesn't seem to be used, remove USE flag
- dev-tcltk/tix doesn't seem to be used, remove dependency
- dev-tcltk/togl is build internal and doesn't use a system togl installation
- Stub generation from pybind11 doesn't currently work in a sandbox, see
  https://github.com/NGSolve/netgen/issues/126
- only depend on sci-libs/metis for USE=mpi

Signed-off-by: Bernd Waibel <waebbl-gentoo <AT> posteo.net>
Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>

 ...tgen-6.2.2204-find-Tk-include-directories.patch |  21 ++++
 ...etgen-6.2.2204-find-libjpeg-turbo-library.patch |  34 +++++
 .../netgen-6.2.2204-link-against-ffmpeg.patch      |  20 +++
 .../netgen-6.2.2204-use-external-pybind11.patch    |  30 +++++
 sci-mathematics/netgen/netgen-6.2.2204.ebuild      | 137 +++++++++++++++++++++
 5 files changed, 242 insertions(+)

diff --git 
a/sci-mathematics/netgen/files/netgen-6.2.2204-find-Tk-include-directories.patch
 
b/sci-mathematics/netgen/files/netgen-6.2.2204-find-Tk-include-directories.patch
new file mode 100644
index 000000000..cf7b9d31e
--- /dev/null
+++ 
b/sci-mathematics/netgen/files/netgen-6.2.2204-find-Tk-include-directories.patch
@@ -0,0 +1,21 @@
+From 53c45343f5a26841be10d930467e215da4a779f2 Mon Sep 17 00:00:00 2001
+From: Bernd Waibel <[email protected]>
+Date: Sun, 30 Oct 2022 15:17:55 +0100
+Subject: [PATCH] find Tk include directories
+
+Signed-off-by: Bernd Waibel <[email protected]>
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -270,6 +270,9 @@ if (USE_GUI)
+     endif(APPLE)
+     find_package(OpenGL REQUIRED)
+ 
++    include_directories(${TK_INCLUDE_PATH}/generic)
++    include_directories(${TK_INCLUDE_PATH}/unix)
++
+     target_compile_definitions(netgen_gui INTERFACE -DTCL -DOPENGL 
-DUSE_TOGL_2 -DUSE_TCL_STUBS -DUSE_TK_STUBS)
+     target_include_directories(netgen_gui INTERFACE ${TCL_INCLUDE_PATH} 
${TK_INCLUDE_PATH})
+     target_link_libraries(netgen_gui INTERFACE ${TCL_STUB_LIBRARY} 
${TK_STUB_LIBRARY})
+-- 
+2.38.1
+

diff --git 
a/sci-mathematics/netgen/files/netgen-6.2.2204-find-libjpeg-turbo-library.patch 
b/sci-mathematics/netgen/files/netgen-6.2.2204-find-libjpeg-turbo-library.patch
new file mode 100644
index 000000000..c45f5a4e4
--- /dev/null
+++ 
b/sci-mathematics/netgen/files/netgen-6.2.2204-find-libjpeg-turbo-library.patch
@@ -0,0 +1,34 @@
+From 39160b692fd051f2638f1a6e1df38eb616b6d6cb Mon Sep 17 00:00:00 2001
+From: Bernd Waibel <[email protected]>
+Date: Sun, 30 Oct 2022 16:09:43 +0100
+Subject: [PATCH] find libjpeg-turbo library
+
+Signed-off-by: Bernd Waibel <[email protected]>
+--- a/libsrc/visualization/CMakeLists.txt
++++ b/libsrc/visualization/CMakeLists.txt
+@@ -7,7 +7,7 @@ target_sources(nggui PRIVATE
+     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} )
+ 
+ install(FILES
+   meshdoc.hpp mvdraw.hpp visual_api.hpp
+--- a/nglib/CMakeLists.txt
++++ b/nglib/CMakeLists.txt
+@@ -7,6 +7,11 @@ endif(USE_OCC)
+ 
+ target_link_libraries(nglib PUBLIC ngcore)
+ 
++if(TARGET JPEG::JPEG)
++    get_target_property(JPEG_LIBRARIES JPEG::JPEG IMPORTED_LOCATION_RELEASE)
++else()
++    set(JPEG_LIBRARIES ${JPEG_LIBRARY_RELEASE})
++endif()
+ target_link_libraries( nglib PRIVATE ${MPI_CXX_LIBRARIES} 
${CMAKE_THREAD_LIBS_INIT} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} 
${OCC_LIBRARIES} netgen_cgns )
+ 
+ install(TARGETS nglib netgen_cgns ${NG_INSTALL_DIR})
+-- 
+2.38.1
+

diff --git 
a/sci-mathematics/netgen/files/netgen-6.2.2204-link-against-ffmpeg.patch 
b/sci-mathematics/netgen/files/netgen-6.2.2204-link-against-ffmpeg.patch
new file mode 100644
index 000000000..6f7a8bc3c
--- /dev/null
+++ b/sci-mathematics/netgen/files/netgen-6.2.2204-link-against-ffmpeg.patch
@@ -0,0 +1,20 @@
+From 69d9c2da29adc9b7a209e78aae950d9834683f58 Mon Sep 17 00:00:00 2001
+From: Bernd Waibel <[email protected]>
+Date: Mon, 31 Oct 2022 13:07:05 +0100
+Subject: [PATCH] link against ffmpeg
+
+Signed-off-by: Bernd Waibel <[email protected]>
+--- a/ng/CMakeLists.txt
++++ b/ng/CMakeLists.txt
+@@ -28,7 +28,7 @@ if(USE_GUI)
+     if(APPLE)
+         set_target_properties(netgen PROPERTIES OUTPUT_NAME netgen)
+     endif(APPLE)
+-    target_link_libraries( netgen ${PYTHON_LIBRARIES} ${TCL_LIBRARY} 
${TK_LIBRARY})
++    target_link_libraries( netgen ${PYTHON_LIBRARIES} ${TCL_LIBRARY} 
${TK_LIBRARY} ${FFMPEG_LIBRARIES})
+     endif(NOT BUILD_FOR_CONDA)
+ 
+     install(TARGETS nggui ${NG_INSTALL_DIR})
+-- 
+2.38.1
+

diff --git 
a/sci-mathematics/netgen/files/netgen-6.2.2204-use-external-pybind11.patch 
b/sci-mathematics/netgen/files/netgen-6.2.2204-use-external-pybind11.patch
new file mode 100644
index 000000000..ef11c8b08
--- /dev/null
+++ b/sci-mathematics/netgen/files/netgen-6.2.2204-use-external-pybind11.patch
@@ -0,0 +1,30 @@
+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/sci-mathematics/netgen/netgen-6.2.2204.ebuild 
b/sci-mathematics/netgen/netgen-6.2.2204.ebuild
new file mode 100644
index 000000000..06a2bf53f
--- /dev/null
+++ b/sci-mathematics/netgen/netgen-6.2.2204.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..10} )
+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 jpeg mpi opencascade python gui"
+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= )
+       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
+"
+
+PATCHES=(
+       "${FILESDIR}/${P}-use-external-pybind11.patch"
+       "${FILESDIR}/${P}-find-Tk-include-directories.patch"
+       "${FILESDIR}/${P}-find-libjpeg-turbo-library.patch"
+       "${FILESDIR}/${P}-link-against-ffmpeg.patch"
+)
+
+pkg_setup() {
+       use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+       # NOTE: need to manually check and update this string on version bumps!
+       cat <<- EOF > "${S}/version.txt" || die
+               v${PV}-0-gde0d706e
+       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
+               -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_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+=(
+                       
-DPYBIND_INCLUDE_DIR="/usr/lib/${EPYTHON}/site-packages/pybind11/include/"
+                       -DNG_INSTALL_PYBIND=OFF
+               )
+       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
+
+               doicon "${FILESDIR}"/${PN}.png
+               domenu "${FILESDIR}"/${PN}.desktop
+       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
+}

Reply via email to