Gentoo Archives: gentoo-commits

From: Andrew Ammerlaan <andrewammerlaan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: media-gfx/netgen/, media-gfx/netgen/files/
Date: Fri, 30 Dec 2022 10:53:15
Message-Id: 1672397349.17bb597408259e7752da517e31ef4c502c015045.andrewammerlaan@gentoo
1 commit: 17bb597408259e7752da517e31ef4c502c015045
2 Author: Bernd Waibel <waebbl-gentoo <AT> posteo <DOT> net>
3 AuthorDate: Tue Dec 13 07:18:29 2022 +0000
4 Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 30 10:49:09 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=17bb5974
7
8 media-gfx/netgen: enable logging and tests
9
10 - enable logging, using dev-libs/spdlog
11 - enable tests, disable some tests which do not work
12
13 Signed-off-by: Bernd Waibel <waebbl-gentoo <AT> posteo.net>
14 Closes: https://github.com/gentoo/sci/pull/1186
15 Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>
16
17 .../netgen-6.2.2204-disable-failing-tests.patch | 19 ++++++++++
18 .../netgen-6.2.2204-disable-python-tests.patch | 17 +++++++++
19 .../files/netgen-6.2.2204-use-system-catch.patch | 40 ++++++++++++++++++++++
20 .../files/netgen-6.2.2204-use-system-spdlog.patch | 40 ++++++++++++++++++++++
21 media-gfx/netgen/metadata.xml | 3 +-
22 media-gfx/netgen/netgen-6.2.2204.ebuild | 37 ++++++++++++++------
23 6 files changed, 144 insertions(+), 12 deletions(-)
24
25 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
26 new file mode 100644
27 index 000000000..a11df8e3d
28 --- /dev/null
29 +++ b/media-gfx/netgen/files/netgen-6.2.2204-disable-failing-tests.patch
30 @@ -0,0 +1,19 @@
31 +From 21bfc56e76a448170dc4bb305c97b8f957b6e75d Mon Sep 17 00:00:00 2001
32 +From: Bernd Waibel <waebbl-gentoo@××××××.net>
33 +Date: Wed, 14 Dec 2022 07:12:04 +0100
34 +Subject: [PATCH] disable failing tests
35 +
36 +Signed-off-by: Bernd Waibel <waebbl-gentoo@××××××.net>
37 +--- a/tests/catch/CMakeLists.txt
38 ++++ b/tests/catch/CMakeLists.txt
39 +@@ -34,7 +34,6 @@ add_unit_test(archive archive.cpp)
40 + target_link_libraries(test_archive netgen_python)
41 + add_unit_test(array array.cpp)
42 + add_unit_test(ranges ranges.cpp)
43 +-add_unit_test(symboltable symboltable.cpp)
44 + add_unit_test(utils utils.cpp)
45 + add_unit_test(version version.cpp)
46 +
47 +--
48 +2.38.1
49 +
50
51 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
52 new file mode 100644
53 index 000000000..7a6def418
54 --- /dev/null
55 +++ b/media-gfx/netgen/files/netgen-6.2.2204-disable-python-tests.patch
56 @@ -0,0 +1,17 @@
57 +From 2c402f3b552ce18483119de1d3a91fd457c9c170 Mon Sep 17 00:00:00 2001
58 +From: Bernd Waibel <waebbl-gentoo@××××××.net>
59 +Date: Wed, 14 Dec 2022 08:50:07 +0100
60 +Subject: [PATCH] disable python tests
61 +
62 +Signed-off-by: Bernd Waibel <waebbl-gentoo@××××××.net>
63 +--- a/tests/CMakeLists.txt
64 ++++ b/tests/CMakeLists.txt
65 +@@ -1,5 +1,4 @@
66 + add_subdirectory(catch)
67 +-add_subdirectory(pytest)
68 +
69 + # this code goes here, because tests is the last add_subdirectory (otherwise it gets executed too early)
70 + if(APPLE AND BUILD_FOR_CONDA)
71 +--
72 +2.38.1
73 +
74
75 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
76 new file mode 100644
77 index 000000000..1c08e49e7
78 --- /dev/null
79 +++ b/media-gfx/netgen/files/netgen-6.2.2204-use-system-catch.patch
80 @@ -0,0 +1,40 @@
81 +From 6eaa13cc02ccd5f1bfa448fbcff3a1d9af8ba90a Mon Sep 17 00:00:00 2001
82 +From: Bernd Waibel <waebbl-gentoo@××××××.net>
83 +Date: Wed, 14 Dec 2022 07:04:29 +0100
84 +Subject: [PATCH] use system catch
85 +
86 +Signed-off-by: Bernd Waibel <waebbl-gentoo@××××××.net>
87 +--- a/CMakeLists.txt
88 ++++ b/CMakeLists.txt
89 +@@ -474,7 +474,7 @@ enable_testing()
90 + include(CTest)
91 +
92 + if(ENABLE_UNIT_TESTS)
93 +- include(${CMAKE_CURRENT_LIST_DIR}/cmake/external_projects/catch.cmake)
94 ++ find_package(Catch2 REQUIRED)
95 + endif(ENABLE_UNIT_TESTS)
96 +
97 +
98 +--- a/tests/catch/CMakeLists.txt
99 ++++ b/tests/catch/CMakeLists.txt
100 +@@ -3,11 +3,15 @@ if(ENABLE_UNIT_TESTS)
101 + add_custom_target(unit_tests)
102 +
103 + # Build catch_main test object
104 +-include_directories(${CATCH_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../../libsrc/include ${SPDLOG_INCLUDE_DIR})
105 ++if(TARGET Catch2::Catch2)
106 ++ get_target_property(CATCH_INCLUDE_DIR Catch2::Catch2 INTERFACE_INCLUDE_DIRECTORIES)
107 ++ include_directories(${CATCH_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../../libsrc/include ${SPDLOG_INCLUDE_DIR})
108 ++else()
109 ++ message(SEND_ERROR "Catch header files couldn't be found.")
110 ++endif()
111 + add_library(catch_main STATIC main.cpp)
112 + set_target_properties(catch_main PROPERTIES CXX_STANDARD 17)
113 + add_dependencies(unit_tests catch_main)
114 +-add_dependencies(catch_main project_catch)
115 +
116 + # ensure the test targets are built before testing
117 + add_test(NAME unit_tests_built COMMAND ${CMAKE_COMMAND} --build . --target unit_tests --config ${CMAKE_BUILD_TYPE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../.. )
118 +--
119 +2.38.1
120 +
121
122 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
123 new file mode 100644
124 index 000000000..cbd45ca07
125 --- /dev/null
126 +++ b/media-gfx/netgen/files/netgen-6.2.2204-use-system-spdlog.patch
127 @@ -0,0 +1,40 @@
128 +From e20e1e2e2109f1ce6580587f63ad000ac6bdd877 Mon Sep 17 00:00:00 2001
129 +From: Bernd Waibel <waebbl-gentoo@××××××.net>
130 +Date: Tue, 13 Dec 2022 08:14:12 +0100
131 +Subject: [PATCH] use system spdlog
132 +
133 +Signed-off-by: Bernd Waibel <waebbl-gentoo@××××××.net>
134 +--- a/CMakeLists.txt
135 ++++ b/CMakeLists.txt
136 +@@ -481,8 +481,13 @@ endif(ENABLE_UNIT_TESTS)
137 + #######################################################################
138 +
139 + if(USE_SPDLOG)
140 +- include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/external_projects/spdlog.cmake)
141 +- include_directories(${SPDLOG_INCLUDE_DIR})
142 ++ find_package(spdlog REQUIRED CONFIG)
143 ++ if(TARGET spdlog::spdlog)
144 ++ get_target_property(SPDLOG_INCLUDE_DIR spdlog::spdlog INTERFACE_INCLUDE_DIRECTORIES)
145 ++ include_directories(${SPDLOG_INCLUDE_DIR})
146 ++ else()
147 ++ message(SEND_ERROR "You enabled USE_SPDLOG, but the spdlog package could not be found.")
148 ++ endif()
149 + endif(USE_SPDLOG)
150 +
151 + if(ENABLE_CPP_CORE_GUIDELINES_CHECK)
152 +--- a/libsrc/core/CMakeLists.txt
153 ++++ b/libsrc/core/CMakeLists.txt
154 +@@ -50,10 +50,6 @@ endif(TRACE_MEMORY)
155 +
156 + if(USE_SPDLOG)
157 + include_directories(${SPDLOG_INCLUDE_DIR})
158 +- install(DIRECTORY ${SPDLOG_INCLUDE_DIR}
159 +- DESTINATION ${NG_INSTALL_DIR_INCLUDE}
160 +- )
161 +- add_dependencies(ngcore project_spdlog)
162 + target_compile_definitions(ngcore PUBLIC NETGEN_USE_SPDLOG)
163 + if(DEBUG_LOG)
164 + target_compile_definitions(ngcore PUBLIC NETGEN_LOG_DEBUG)
165 +--
166 +2.38.1
167 +
168
169 diff --git a/media-gfx/netgen/metadata.xml b/media-gfx/netgen/metadata.xml
170 index cb94caeca..f19c0cf6e 100644
171 --- a/media-gfx/netgen/metadata.xml
172 +++ b/media-gfx/netgen/metadata.xml
173 @@ -6,7 +6,8 @@
174 <name>Gentoo Mathematics Project</name>
175 </maintainer>
176 <use>
177 - <flag name="opencascade"> Enable OpenCASCADE support</flag>
178 + <flag name="logging">Enable logging through <pkg>dev-libs/spdlog</pkg></flag>
179 + <flag name="opencascade">Enable OpenCASCADE support</flag>
180 </use>
181 <upstream>
182 <remote-id type="github">NGSolve/netgen</remote-id>
183
184 diff --git a/media-gfx/netgen/netgen-6.2.2204.ebuild b/media-gfx/netgen/netgen-6.2.2204.ebuild
185 index 06a2bf53f..492170dbf 100644
186 --- a/media-gfx/netgen/netgen-6.2.2204.ebuild
187 +++ b/media-gfx/netgen/netgen-6.2.2204.ebuild
188 @@ -14,7 +14,9 @@ SLOT="0"
189 LICENSE="LGPL-2.1"
190 KEYWORDS="~amd64 ~x86"
191
192 -IUSE="ffmpeg jpeg mpi opencascade python gui"
193 +IUSE="ffmpeg gui jpeg logging mpi opencascade python test"
194 +RESTRICT="!test? ( test )"
195 +
196 REQUIRED_USE="
197 ${PYTHON_REQUIRED_USE}
198 ffmpeg? ( gui )
199 @@ -35,6 +37,7 @@ DEPEND="
200 x11-libs/libxcb:=
201 )
202 jpeg? ( media-libs/libjpeg-turbo:0= )
203 + logging? ( dev-libs/spdlog:= )
204 mpi? (
205 sci-libs/metis
206 virtual/mpi
207 @@ -55,13 +58,21 @@ RDEPEND="${DEPEND}"
208 BDEPEND="
209 sys-apps/lsb-release
210 virtual/pkgconfig
211 + test? (
212 + <dev-cpp/catch-3:0
213 + python? ( $(python_gen_cond_dep 'dev-python/pytest[${PYTHON_USEDEP}]') )
214 + )
215 "
216
217 PATCHES=(
218 - "${FILESDIR}/${P}-use-external-pybind11.patch"
219 - "${FILESDIR}/${P}-find-Tk-include-directories.patch"
220 - "${FILESDIR}/${P}-find-libjpeg-turbo-library.patch"
221 - "${FILESDIR}/${P}-link-against-ffmpeg.patch"
222 + "${FILESDIR}/${PN}-6.2.2204-use-external-pybind11.patch"
223 + "${FILESDIR}/${PN}-6.2.2204-find-Tk-include-directories.patch"
224 + "${FILESDIR}/${PN}-6.2.2204-find-libjpeg-turbo-library.patch"
225 + "${FILESDIR}/${PN}-6.2.2204-link-against-ffmpeg.patch"
226 + "${FILESDIR}/${PN}-6.2.2204-use-system-spdlog.patch"
227 + "${FILESDIR}/${PN}-6.2.2204-use-system-catch.patch"
228 + "${FILESDIR}/${PN}-6.2.2204-disable-failing-tests.patch"
229 + "${FILESDIR}/${PN}-6.2.2204-disable-python-tests.patch"
230 )
231
232 pkg_setup() {
233 @@ -81,6 +92,7 @@ src_configure() {
234 # currently not working in a sandbox, expects netgen to be installed
235 # see https://github.com/NGSolve/netgen/issues/132
236 -DBUILD_STUB_FILES=OFF
237 + -DENABLE_UNIT_TESTS=$(usex test)
238 -DINSTALL_PROFILES=OFF
239 -DNG_INSTALL_DIR_CMAKE="$(get_libdir)/cmake/${PN}"
240 -DNG_INSTALL_DIR_INCLUDE="include/${PN}"
241 @@ -88,15 +100,16 @@ src_configure() {
242 -DUSE_CCACHE=OFF
243 # doesn't build with this version
244 -DUSE_CGNS=OFF
245 - -DUSE_GUI="$(usex gui)"
246 + -DUSE_GUI=$(usex gui)
247 -DUSE_INTERNAL_TCL=OFF
248 - -DUSE_JPEG="$(usex jpeg)"
249 - -DUSE_MPEG="$(usex ffmpeg)"
250 + -DUSE_JPEG=$(usex jpeg)
251 + -DUSE_MPEG=$(usex ffmpeg)
252 # respect users -march= choice
253 -DUSE_NATIVE_ARCH=OFF
254 - -DUSE_MPI="$(usex mpi)"
255 - -DUSE_OCC="$(usex opencascade)"
256 - -DUSE_PYTHON="$(usex python)"
257 + -DUSE_MPI=$(usex mpi)
258 + -DUSE_OCC=$(usex opencascade)
259 + -DUSE_PYTHON=$(usex python)
260 + -DUSE_SPDLOG=$(usex logging)
261 -DUSE_SUPERBUILD=OFF
262 )
263 # no need to set this, if we only build the library
264 @@ -134,4 +147,6 @@ src_install() {
265
266 mv "${ED}"/usr/share/${PN}/doc/ng4.pdf "${ED}"/usr/share/doc/${PF} || die
267 dosym -r /usr/share/doc/${PF}/ng4.pdf /usr/share/${PN}/doc/ng4.pdf
268 +
269 + use python || rm -r "${ED}${NETGENDIR}"/py_tutorials || die
270 }