public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: media-gfx/netgen/files/, media-gfx/netgen/
Date: Sun, 05 Jan 2025 20:35:21 +0000 (UTC)	[thread overview]
Message-ID: <1736109205.ce8f479f9c17840d0a8be94b8c90ef4cdb3b2922.sam@gentoo> (raw)

commit:     ce8f479f9c17840d0a8be94b8c90ef4cdb3b2922
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Sat Jun  8 13:00:18 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan  5 20:33:25 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ce8f479f

media-gfx/netgen: add 6.2.2406

Closes: https://bugs.gentoo.org/911179
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-gfx/netgen/Manifest                          |   1 +
 .../netgen/files/netgen-6.2.2406-encoding_h.patch  | 121 ++++++++++++++
 ...etgen-6.2.2406-find-libjpeg-turbo-library.patch |  29 ++++
 .../netgen-6.2.2406-link-against-ffmpeg.patch      |  17 ++
 media-gfx/netgen/netgen-6.2.2406.ebuild            | 180 +++++++++++++++++++++
 5 files changed, 348 insertions(+)

diff --git a/media-gfx/netgen/Manifest b/media-gfx/netgen/Manifest
index f0b39cad7c0f..e686d01f85c8 100644
--- a/media-gfx/netgen/Manifest
+++ b/media-gfx/netgen/Manifest
@@ -1 +1,2 @@
 DIST netgen-6.2.2302.tar.gz 3398683 BLAKE2B 7cf4626ee8163898864af0346cf2c4fa73dcca3ac2068d67f80b05ee926024b36552b33013c2ef8f74026ab942ae08c0628af0ce0c0dac2d004ba26e18bf4619 SHA512 da6e8e43d73af6b7bfae2e3c771d46e34601ff481c251924673f7330bae032a743fb9d5ff2792855e91ed5addb4d22fd4bf9cd7a9dcfb53f476e22a30f1eedb3
+DIST netgen-6.2.2406.tar.gz 3452436 BLAKE2B 4cb42f20e7627a98e54a9f2e6da5d1b4af174fa7e33c6f72a731b4879c3e4324b20016f1980d2ceb50976fedc2b001a0824e2edd03b03c434c49baa947ded126 SHA512 262e57dca39519c797ea58b32eb886d523926aa48979b31df0c61839f9db09eea76346d3519742b7173a78a80335c16960860772646edd20f365dab1e1a6bed8

diff --git a/media-gfx/netgen/files/netgen-6.2.2406-encoding_h.patch b/media-gfx/netgen/files/netgen-6.2.2406-encoding_h.patch
new file mode 100644
index 000000000000..9d9288412efb
--- /dev/null
+++ b/media-gfx/netgen/files/netgen-6.2.2406-encoding_h.patch
@@ -0,0 +1,121 @@
+From 8504832e746b1581d5b51be7f04f24826440255f Mon Sep 17 00:00:00 2001
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+Date: Thu, 6 Jun 2024 15:59:51 +0200
+Subject: [PATCH 1/2] use std namespace prefix
+
+Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
+---
+ ng/encoding.hpp | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/ng/encoding.hpp b/ng/encoding.hpp
+index 9ea2ffb..498431c 100644
+--- a/ng/encoding.hpp
++++ b/ng/encoding.hpp
+@@ -16,6 +16,8 @@ extern "C" {
+ #include <libswresample/swresample.h>
+ }
+ 
++#include <iostream>
++
+ constexpr int BITRATE = 50000000;
+ 
+ class Mpeg {
+@@ -55,6 +57,8 @@ class Mpeg {
+     int height;
+     bool IsStarted() { return is_started; }
+     int AddFrame() {
++        using std::cerr;
++        using std::endl;
+         int ret;
+         int got_packet = 0;
+         AVPacket pkt = { 0 };
+@@ -113,7 +117,9 @@ class Mpeg {
+         return 0;
+     }
+ 
+-    int Start(string filename) {
++    int Start(std::string filename) {
++        using std::cerr;
++        using std::endl;
+         AVCodec *video_codec;
+         if(is_started) {
+             cerr << "Stream already started" << endl;
+-- 
+2.45.2
+
+
+From 2e52e913603745670cfc5c4a461845a6fb22e118 Mon Sep 17 00:00:00 2001
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+Date: Thu, 6 Jun 2024 16:00:40 +0200
+Subject: [PATCH 2/2] av_init_packet is deprecated
+
+Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
+---
+ ng/encoding.hpp | 18 +++++++++++-------
+ 1 file changed, 11 insertions(+), 7 deletions(-)
+
+diff --git a/ng/encoding.hpp b/ng/encoding.hpp
+index 498431c..97b9e6a 100644
+--- a/ng/encoding.hpp
++++ b/ng/encoding.hpp
+@@ -61,7 +61,6 @@ class Mpeg {
+         using std::endl;
+         int ret;
+         int got_packet = 0;
+-        AVPacket pkt = { 0 };
+ 
+         glReadPixels (0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, rgb_buffer);
+         av_image_fill_arrays(rgb_frame->data, rgb_frame->linesize, rgb_buffer, AV_PIX_FMT_RGB24, width, height, 1);
+@@ -77,8 +76,6 @@ class Mpeg {
+         sws_scale(sws_ctx, flipped_data, flipped_stride, 0, enc->height, frame->data, frame->linesize);
+ 
+ 
+-        av_init_packet(&pkt);
+-
+         got_packet = 0;
+         ret = avcodec_send_frame(enc, frame);
+         if (ret < 0)
+@@ -87,28 +84,35 @@ class Mpeg {
+             return(1);
+         }
+ 
+-        ret = avcodec_receive_packet(enc, &pkt);
++        AVPacket* pkt = av_packet_alloc();
++        ret = avcodec_receive_packet(enc, pkt);
+         if (!ret)
+             got_packet = 1;
+         if (ret == AVERROR(EAGAIN))
++        {
++            av_packet_free(&pkt);
+             return 0;
++        }
+ 
+         if (ret < 0) {
+             cerr << "Error encoding video frame: " << endl;
++            av_packet_free(&pkt);
+             return 1;
+         }
+ 
+         if (got_packet) {
+             /* rescale output packet timestamp values from codec to stream timebase */
+-            av_packet_rescale_ts(&pkt, enc->time_base, st->time_base);
+-            pkt.stream_index = st->index;
++            av_packet_rescale_ts(pkt, enc->time_base, st->time_base);
++            pkt->stream_index = st->index;
+ 
+             /* Write the compressed frame to the media file. */
+-            ret = av_interleaved_write_frame(oc, &pkt);
++            ret = av_interleaved_write_frame(oc, pkt);
+         } else {
+             ret = 0;
+         }
+ 
++        av_packet_free(&pkt);
++
+         if (ret < 0) {
+             cerr << "Error while writing video frame: " << endl;
+             return(1);
+-- 
+2.45.2
+

diff --git a/media-gfx/netgen/files/netgen-6.2.2406-find-libjpeg-turbo-library.patch b/media-gfx/netgen/files/netgen-6.2.2406-find-libjpeg-turbo-library.patch
new file mode 100644
index 000000000000..ef58deb5261c
--- /dev/null
+++ b/media-gfx/netgen/files/netgen-6.2.2406-find-libjpeg-turbo-library.patch
@@ -0,0 +1,29 @@
+From 49507f7708d72b25fd5e350f7f6b30aa80a50cb4 Mon Sep 17 00:00:00 2001
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+Date: Thu, 6 Jun 2024 15:40:10 +0200
+Subject: [PATCH] [PATCH] find libjpeg-turbo library
+
+Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
+---
+ nglib/CMakeLists.txt | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/nglib/CMakeLists.txt b/nglib/CMakeLists.txt
+index b1036ea..78340b6 100644
+--- a/nglib/CMakeLists.txt
++++ b/nglib/CMakeLists.txt
+@@ -11,6 +11,11 @@ if(EMSCRIPTEN)
+   target_include_directories(nglib PUBLIC $<TARGET_PROPERTY:ngcore,INTERFACE_INCLUDE_DIRECTORIES>)
+ else(EMSCRIPTEN)
+   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_libs netgen_cgns )
+ endif(EMSCRIPTEN)
+ 
+-- 
+2.45.2
+

diff --git a/media-gfx/netgen/files/netgen-6.2.2406-link-against-ffmpeg.patch b/media-gfx/netgen/files/netgen-6.2.2406-link-against-ffmpeg.patch
new file mode 100644
index 000000000000..c609e06fe94b
--- /dev/null
+++ b/media-gfx/netgen/files/netgen-6.2.2406-link-against-ffmpeg.patch
@@ -0,0 +1,17 @@
+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 ${Python3_LIBRARIES} ${TCL_LIBRARY} ${TK_LIBRARY})
++    target_link_libraries( netgen ${Python3_LIBRARIES} ${TCL_LIBRARY} ${TK_LIBRARY} ${FFMPEG_LIBRARIES})
+     endif(NOT BUILD_FOR_CONDA)
+ 
+     install(TARGETS nggui ${NG_INSTALL_DIR})

diff --git a/media-gfx/netgen/netgen-6.2.2406.ebuild b/media-gfx/netgen/netgen-6.2.2406.ebuild
new file mode 100644
index 000000000000..b12748d38fb9
--- /dev/null
+++ b/media-gfx/netgen/netgen-6.2.2406.ebuild
@@ -0,0 +1,180 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..13} )
+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"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE="ffmpeg gui jpeg 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
+		media-libs/libglvnd[X]
+		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
+	gui? ( virtual/imagemagick-tools[png] )
+	test? (
+		<dev-cpp/catch-3:0
+		python? ( $(python_gen_cond_dep '
+			dev-python/pytest-check[${PYTHON_USEDEP}]
+		') )
+	)
+"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-6.2.2204-find-Tk-include-directories.patch"
+	"${FILESDIR}/${PN}-6.2.2406-link-against-ffmpeg.patch"
+	"${FILESDIR}/${PN}-6.2.2204-use-system-catch.patch"
+	"${FILESDIR}/${PN}-6.2.2406-find-libjpeg-turbo-library.patch"
+	"${FILESDIR}/${PN}-6.2.2301-fix-nullptr-deref-in-archive.patch"
+	"${FILESDIR}/${PN}-6.2.2406-encoding_h.patch"
+)
+
+pkg_setup() {
+	if use python; then
+			python-single-r1_pkg_setup
+
+			# NOTE This calls find_package(Python3) without specifying Interpreter in COMPONENTS.
+			# Python3_FIND_UNVERSIONED_NAMES=FIRST is thus never checked and we search the highest python version first.
+			pushd "${T}/${EPYTHON}/bin" > /dev/null || die
+			cp "python-config" "${EPYTHON}-config" || die
+			chmod +x "${EPYTHON}-config" || die
+			popd > /dev/null || die
+	fi
+}
+
+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-08eec44
+	# EOF
+
+	rm external_dependencies -r || die
+
+	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_SUPERBUILD=OFF
+		-DNETGEN_VERSION_GIT="v${PV}"
+	)
+	# 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_test() {
+	DESTDIR="${T}" cmake_build install
+
+	export PYTHONPATH="${T}/$(python_get_sitedir):${T}/usr/$(get_libdir):${BUILD_DIR}/libsrc/core"
+
+	CMAKE_SKIP_TESTS=(
+		'^unit_symboltable$'
+		'^pytest$' # SEGFAULT
+	)
+	cmake_src_test
+}
+
+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	other threads:[~2025-01-05 20:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-05 20:35 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-02-09 21:08 [gentoo-commits] repo/gentoo:master commit in: media-gfx/netgen/files/, media-gfx/netgen/ Alexey Shvetsov
2025-01-06  1:00 Sam James
2024-11-25  2:40 Sam James

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1736109205.ce8f479f9c17840d0a8be94b8c90ef4cdb3b2922.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox