diff options
author | Bernd Waibel <waebbl-gentoo@posteo.net> | 2023-01-28 11:13:58 +0100 |
---|---|---|
committer | Andrew Ammerlaan <andrewammerlaan@gentoo.org> | 2023-02-10 10:57:21 +0100 |
commit | 21fcf832e7b40659f66e721844561a970a2f73be (patch) | |
tree | 822ddb9a6fa426031f199d95a362a7cc3265be8e /media-gfx | |
parent | java-utils-2.eclass: ECLASS_VARIABLE JAVA_PKG_NO_CLEAN (diff) | |
download | gentoo-21fcf832e7b40659f66e721844561a970a2f73be.tar.gz gentoo-21fcf832e7b40659f66e721844561a970a2f73be.tar.bz2 gentoo-21fcf832e7b40659f66e721844561a970a2f73be.zip |
media-gfx/netgen: new package, add 6.2.2204
The media-gfx/freecad package has support for meshing using Netgen.
Talked about in https://github.com/gentoo/sci/pull/1180#issuecomment-1315854894
Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net>
Closes: https://github.com/gentoo/gentoo/pull/29315
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Diffstat (limited to 'media-gfx')
11 files changed, 396 insertions, 0 deletions
diff --git a/media-gfx/netgen/Manifest b/media-gfx/netgen/Manifest new file mode 100644 index 000000000000..51e722f4d15a --- /dev/null +++ b/media-gfx/netgen/Manifest @@ -0,0 +1 @@ +DIST netgen-6.2.2204.tar.gz 3394806 BLAKE2B 2b99854cab0890662f1ab7ffee6fb444b60a28ba0bfe9970a89c80c0e4c930c40b8034f9c600ddd61c9b60f542d1cae758a8c220a1ba76949bf9f97fb2fe9020 SHA512 964c40753613c111b0372b0e403b19734cc0c559d1e7e45bbe6b452f4daba10c6bde8abaa5c9541c92b4bccff02d32ea6ba8e8e06ba64f11fec1733f2e374cbf diff --git a/media-gfx/netgen/files/netgen-6.2.2204-disable-failing-tests.patch b/media-gfx/netgen/files/netgen-6.2.2204-disable-failing-tests.patch new file mode 100644 index 000000000000..a11df8e3d427 --- /dev/null +++ b/media-gfx/netgen/files/netgen-6.2.2204-disable-failing-tests.patch @@ -0,0 +1,19 @@ +From 21bfc56e76a448170dc4bb305c97b8f957b6e75d Mon Sep 17 00:00:00 2001 +From: Bernd Waibel <waebbl-gentoo@posteo.net> +Date: Wed, 14 Dec 2022 07:12:04 +0100 +Subject: [PATCH] disable failing tests + +Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net> +--- a/tests/catch/CMakeLists.txt ++++ b/tests/catch/CMakeLists.txt +@@ -34,7 +34,6 @@ add_unit_test(archive archive.cpp) + target_link_libraries(test_archive netgen_python) + add_unit_test(array array.cpp) + add_unit_test(ranges ranges.cpp) +-add_unit_test(symboltable symboltable.cpp) + add_unit_test(utils utils.cpp) + add_unit_test(version version.cpp) + +-- +2.38.1 + diff --git a/media-gfx/netgen/files/netgen-6.2.2204-disable-python-tests.patch b/media-gfx/netgen/files/netgen-6.2.2204-disable-python-tests.patch new file mode 100644 index 000000000000..7a6def41898b --- /dev/null +++ b/media-gfx/netgen/files/netgen-6.2.2204-disable-python-tests.patch @@ -0,0 +1,17 @@ +From 2c402f3b552ce18483119de1d3a91fd457c9c170 Mon Sep 17 00:00:00 2001 +From: Bernd Waibel <waebbl-gentoo@posteo.net> +Date: Wed, 14 Dec 2022 08:50:07 +0100 +Subject: [PATCH] disable python tests + +Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net> +--- a/tests/CMakeLists.txt ++++ b/tests/CMakeLists.txt +@@ -1,5 +1,4 @@ + add_subdirectory(catch) +-add_subdirectory(pytest) + + # this code goes here, because tests is the last add_subdirectory (otherwise it gets executed too early) + if(APPLE AND BUILD_FOR_CONDA) +-- +2.38.1 + diff --git a/media-gfx/netgen/files/netgen-6.2.2204-find-Tk-include-directories.patch b/media-gfx/netgen/files/netgen-6.2.2204-find-Tk-include-directories.patch new file mode 100644 index 000000000000..cf7b9d31ef07 --- /dev/null +++ b/media-gfx/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 <waebbl-gentoo@posteo.net> +Date: Sun, 30 Oct 2022 15:17:55 +0100 +Subject: [PATCH] find Tk include directories + +Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net> +--- 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/media-gfx/netgen/files/netgen-6.2.2204-find-libjpeg-turbo-library.patch b/media-gfx/netgen/files/netgen-6.2.2204-find-libjpeg-turbo-library.patch new file mode 100644 index 000000000000..c45f5a4e4bdb --- /dev/null +++ b/media-gfx/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 <waebbl-gentoo@posteo.net> +Date: Sun, 30 Oct 2022 16:09:43 +0100 +Subject: [PATCH] find libjpeg-turbo library + +Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net> +--- 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/media-gfx/netgen/files/netgen-6.2.2204-link-against-ffmpeg.patch b/media-gfx/netgen/files/netgen-6.2.2204-link-against-ffmpeg.patch new file mode 100644 index 000000000000..6f7a8bc3cd9a --- /dev/null +++ b/media-gfx/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 <waebbl-gentoo@posteo.net> +Date: Mon, 31 Oct 2022 13:07:05 +0100 +Subject: [PATCH] link against ffmpeg + +Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net> +--- 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/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 new file mode 100644 index 000000000000..ef11c8b0821a --- /dev/null +++ b/media-gfx/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 <waebbl-gentoo@posteo.net> +Date: Sun, 30 Oct 2022 14:50:48 +0100 +Subject: [PATCH] use external pybind11 + +Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net> +--- 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-use-system-catch.patch b/media-gfx/netgen/files/netgen-6.2.2204-use-system-catch.patch new file mode 100644 index 000000000000..1c08e49e7524 --- /dev/null +++ b/media-gfx/netgen/files/netgen-6.2.2204-use-system-catch.patch @@ -0,0 +1,40 @@ +From 6eaa13cc02ccd5f1bfa448fbcff3a1d9af8ba90a Mon Sep 17 00:00:00 2001 +From: Bernd Waibel <waebbl-gentoo@posteo.net> +Date: Wed, 14 Dec 2022 07:04:29 +0100 +Subject: [PATCH] use system catch + +Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net> +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -474,7 +474,7 @@ enable_testing() + include(CTest) + + if(ENABLE_UNIT_TESTS) +- include(${CMAKE_CURRENT_LIST_DIR}/cmake/external_projects/catch.cmake) ++ find_package(Catch2 REQUIRED) + endif(ENABLE_UNIT_TESTS) + + +--- a/tests/catch/CMakeLists.txt ++++ b/tests/catch/CMakeLists.txt +@@ -3,11 +3,15 @@ if(ENABLE_UNIT_TESTS) + add_custom_target(unit_tests) + + # Build catch_main test object +-include_directories(${CATCH_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../../libsrc/include ${SPDLOG_INCLUDE_DIR}) ++if(TARGET Catch2::Catch2) ++ get_target_property(CATCH_INCLUDE_DIR Catch2::Catch2 INTERFACE_INCLUDE_DIRECTORIES) ++ include_directories(${CATCH_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../../libsrc/include ${SPDLOG_INCLUDE_DIR}) ++else() ++ message(SEND_ERROR "Catch header files couldn't be found.") ++endif() + add_library(catch_main STATIC main.cpp) + set_target_properties(catch_main PROPERTIES CXX_STANDARD 17) + add_dependencies(unit_tests catch_main) +-add_dependencies(catch_main project_catch) + + # ensure the test targets are built before testing + add_test(NAME unit_tests_built COMMAND ${CMAKE_COMMAND} --build . --target unit_tests --config ${CMAKE_BUILD_TYPE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../.. ) +-- +2.38.1 + diff --git a/media-gfx/netgen/files/netgen-6.2.2204-use-system-spdlog.patch b/media-gfx/netgen/files/netgen-6.2.2204-use-system-spdlog.patch new file mode 100644 index 000000000000..cbd45ca07f3f --- /dev/null +++ b/media-gfx/netgen/files/netgen-6.2.2204-use-system-spdlog.patch @@ -0,0 +1,40 @@ +From e20e1e2e2109f1ce6580587f63ad000ac6bdd877 Mon Sep 17 00:00:00 2001 +From: Bernd Waibel <waebbl-gentoo@posteo.net> +Date: Tue, 13 Dec 2022 08:14:12 +0100 +Subject: [PATCH] use system spdlog + +Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net> +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -481,8 +481,13 @@ endif(ENABLE_UNIT_TESTS) + ####################################################################### + + if(USE_SPDLOG) +- include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/external_projects/spdlog.cmake) +- include_directories(${SPDLOG_INCLUDE_DIR}) ++ find_package(spdlog REQUIRED CONFIG) ++ if(TARGET spdlog::spdlog) ++ get_target_property(SPDLOG_INCLUDE_DIR spdlog::spdlog INTERFACE_INCLUDE_DIRECTORIES) ++ include_directories(${SPDLOG_INCLUDE_DIR}) ++ else() ++ message(SEND_ERROR "You enabled USE_SPDLOG, but the spdlog package could not be found.") ++ endif() + endif(USE_SPDLOG) + + if(ENABLE_CPP_CORE_GUIDELINES_CHECK) +--- a/libsrc/core/CMakeLists.txt ++++ b/libsrc/core/CMakeLists.txt +@@ -50,10 +50,6 @@ endif(TRACE_MEMORY) + + if(USE_SPDLOG) + include_directories(${SPDLOG_INCLUDE_DIR}) +- install(DIRECTORY ${SPDLOG_INCLUDE_DIR} +- DESTINATION ${NG_INSTALL_DIR_INCLUDE} +- ) +- add_dependencies(ngcore project_spdlog) + target_compile_definitions(ngcore PUBLIC NETGEN_USE_SPDLOG) + if(DEBUG_LOG) + target_compile_definitions(ngcore PUBLIC NETGEN_LOG_DEBUG) +-- +2.38.1 + diff --git a/media-gfx/netgen/metadata.xml b/media-gfx/netgen/metadata.xml new file mode 100644 index 000000000000..3c583c643516 --- /dev/null +++ b/media-gfx/netgen/metadata.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project" proxied="proxy"> + <email>sci-mathematics@gentoo.org</email> + <name>Gentoo Mathematics Project</name> + </maintainer> + <maintainer type="person" proxied="yes"> + <email>waebbl-gentoo@posteo.net</email> + <name>Bernd Waibel</name> + </maintainer> + <use> + <flag name="logging">Enable logging through <pkg>dev-libs/spdlog</pkg></flag> + <flag name="opencascade">Enable OpenCASCADE support</flag> + </use> + <upstream> + <remote-id type="github">NGSolve/netgen</remote-id> + </upstream> +</pkgmetadata> diff --git a/media-gfx/netgen/netgen-6.2.2204.ebuild b/media-gfx/netgen/netgen-6.2.2204.ebuild new file mode 100644 index 000000000000..f4a8413a9832 --- /dev/null +++ b/media-gfx/netgen/netgen-6.2.2204.ebuild @@ -0,0 +1,155 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_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 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-use-external-pybind11.patch" + "${FILESDIR}/${PN}-6.2.2204-find-Tk-include-directories.patch" + "${FILESDIR}/${PN}-6.2.2204-find-libjpeg-turbo-library.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" +) + +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 + -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+=( + -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 + + 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 +} |