blob: 4f7c18a4d1914accda57f9360e9f5e3e78c589dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{13..14} )
inherit cmake desktop dot-a flag-o-matic 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? ( ${PYTHON_REQUIRED_USE} )
ffmpeg? ( gui )
jpeg? ( gui )
python? ( gui )
"
DEPEND="
virtual/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"
"${FILESDIR}/${PN}-6.2.2406-link-against-jpeg.patch"
"${FILESDIR}/${PN}-PR202-std_map.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 ls-remote --tags https://github.com/NGSolve/netgen.git refs/tags/v${PV} | cut -c-8
# git describe --tags --match "v[0-9]*" --long --dirty
# cat <<- EOF > "${S}/version.txt" || die
# v${PV}-0-gd1a9f7ee
# EOF
# 855214 needs git
sed \
-e '/-DBDIR=${CMAKE_CURRENT_BINARY_DIR}/a -DNETGEN_VERSION_GIT=${NETGEN_VERSION_GIT}' \
-i CMakeLists.txt || die
if use python; then
sed \
-e "s/Python3_EXECUTABLE/PYTHON_EXECUTABLE/" \
-i cmake/NetgenConfig.cmake.in || die
fi
rm -r external_dependencies || die
cmake_src_prepare
}
src_configure() {
use gui && lto-guarantee-fat
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=no
-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}-0-gd1a9f7ee"
)
# no need to set this, if we only build the library
if use gui; then
mycmakeargs+=(
-DTK_INCLUDE_PATH="${ESYSROOT}/usr/$(get_libdir)/tk8.6/include"
)
fi
if use python; then
append-cppflags -DPYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF
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
if use python; then
local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
local -x NETGENDIR="${T}/usr/bin"
local -x PYTHONPATH="${T}$(python_get_sitedir):${T}/usr/$(get_libdir):${BUILD_DIR}/libsrc/core"
fi
CMAKE_SKIP_TESTS=(
'^unit_symboltable$'
'^pytest$' # floating point errors
'^pytest-mpi$' # needs pytest-mpi
)
cmake_src_test
rm -r "${T}/usr" || die
}
src_install() {
cmake_src_install
strip-lto-bytecode
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
}
|