Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-gfx/freecad/
Date: Tue, 02 Nov 2021 10:04:57
Message-Id: 1635847478.5851bd091fca1165c97a27e96232807548b5df84.sam@gentoo
1 commit: 5851bd091fca1165c97a27e96232807548b5df84
2 Author: Bernd Waibel <waebbl-gentoo <AT> posteo <DOT> net>
3 AuthorDate: Mon Oct 18 04:53:51 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 2 10:04:38 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5851bd09
7
8 media-gfx/freecad: backport some changes from live ebuild
9
10 - install freecad-thumbnailer
11 - bump to EAPI 8
12 - clean inherit statement
13 - clean optfeature statements from packages which are installed anyway
14 or controlled by use flags
15 - use C++17
16
17 Bug: https://bugs.gentoo.org/821160
18 Package-Manager: Portage-3.0.28, Repoman-3.0.3
19 Signed-off-by: Bernd Waibel <waebbl-gentoo <AT> posteo.net>
20 Signed-off-by: Sam James <sam <AT> gentoo.org>
21
22 media-gfx/freecad/freecad-0.19.2-r4.ebuild | 357 +++++++++++++++++++++++++++++
23 1 file changed, 357 insertions(+)
24
25 diff --git a/media-gfx/freecad/freecad-0.19.2-r4.ebuild b/media-gfx/freecad/freecad-0.19.2-r4.ebuild
26 new file mode 100644
27 index 00000000000..24dc6a70339
28 --- /dev/null
29 +++ b/media-gfx/freecad/freecad-0.19.2-r4.ebuild
30 @@ -0,0 +1,357 @@
31 +# Copyright 1999-2021 Gentoo Authors
32 +# Distributed under the terms of the GNU General Public License v2
33 +
34 +EAPI=8
35 +
36 +PYTHON_COMPAT=( python3_{8,9} )
37 +
38 +inherit check-reqs cmake optfeature python-single-r1 xdg
39 +
40 +DESCRIPTION="QT based Computer Aided Design application"
41 +HOMEPAGE="https://www.freecadweb.org/ https://github.com/FreeCAD/FreeCAD"
42 +
43 +MY_PN=FreeCAD
44 +
45 +if [[ ${PV} = *9999 ]]; then
46 + inherit git-r3
47 + EGIT_REPO_URI="https://github.com/${MY_PN}/${MY_PN}.git"
48 + S="${WORKDIR}/freecad-${PV}"
49 +else
50 + MY_PV=$(ver_cut 1-2)
51 + MY_PV=$(ver_rs 1 '_' ${MY_PV})
52 + SRC_URI="https://github.com/${MY_PN}/${MY_PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz
53 + https://raw.githubusercontent.com/waebbl/waebbl-gentoo/master/patches/${P}-0005-Make-smesh-compile-with-vtk9.patch.xz"
54 + KEYWORDS="~amd64"
55 + S="${WORKDIR}/FreeCAD-${PV}"
56 +fi
57 +
58 +# code is licensed LGPL-2
59 +# examples are licensed CC-BY-SA (without note of specific version)
60 +LICENSE="LGPL-2 CC-BY-SA-4.0"
61 +SLOT="0"
62 +IUSE="debug headless pcl test"
63 +RESTRICT="!test? ( test )"
64 +
65 +FREECAD_EXPERIMENTAL_MODULES="cloud plot ship"
66 +FREECAD_STABLE_MODULES="addonmgr fem idf image inspection material
67 + openscad part-design path points raytracing robot show surface
68 + techdraw tux"
69 +
70 +for module in ${FREECAD_STABLE_MODULES}; do
71 + IUSE="${IUSE} +${module}"
72 +done
73 +for module in ${FREECAD_EXPERIMENTAL_MODULES}; do
74 + IUSE="${IUSE} ${module}"
75 +done
76 +unset module
77 +
78 +RDEPEND="
79 + ${PYTHON_DEPS}
80 + >=dev-cpp/eigen-3.3.1:3
81 + dev-libs/OpenNI2[opengl(+)]
82 + dev-libs/libspnav[X]
83 + dev-libs/xerces-c[icu]
84 + dev-qt/designer:5
85 + dev-qt/qtconcurrent:5
86 + dev-qt/qtcore:5
87 + dev-qt/qtgui:5
88 + dev-qt/qtnetwork:5
89 + dev-qt/qtopengl:5
90 + dev-qt/qtprintsupport:5
91 + dev-qt/qtsvg:5
92 + dev-qt/qtwebengine:5[widgets]
93 + dev-qt/qtwidgets:5
94 + dev-qt/qtx11extras:5
95 + dev-qt/qtxml:5
96 + >=media-libs/coin-4.0.0
97 + media-libs/freetype
98 + media-libs/qhull:=
99 + sci-libs/flann[openmp]
100 + sci-libs/hdf5:=[fortran,zlib]
101 + >=sci-libs/med-4.0.0-r1[python,${PYTHON_SINGLE_USEDEP}]
102 + sci-libs/opencascade:=[vtk(+)]
103 + sci-libs/orocos_kdl:=
104 + sys-libs/zlib
105 + virtual/glu
106 + virtual/libusb:1
107 + virtual/opengl
108 + cloud? (
109 + dev-libs/openssl:=
110 + net-misc/curl
111 + )
112 + fem? ( sci-libs/vtk:=[boost,python,qt5,rendering,${PYTHON_SINGLE_USEDEP}] )
113 + openscad? ( media-gfx/openscad )
114 + pcl? ( >=sci-libs/pcl-1.8.1:=[opengl,openni2(+),qt5(+),vtk(+)] )
115 + $(python_gen_cond_dep '
116 + dev-libs/boost:=[python,threads(+),${PYTHON_USEDEP}]
117 + dev-python/matplotlib[${PYTHON_USEDEP}]
118 + dev-python/numpy[${PYTHON_USEDEP}]
119 + >=dev-python/pivy-0.6.5[${PYTHON_USEDEP}]
120 + dev-python/pybind11[${PYTHON_USEDEP}]
121 + dev-python/pyside2[gui,svg,${PYTHON_USEDEP}]
122 + dev-python/shiboken2[${PYTHON_USEDEP}]
123 + addonmgr? ( dev-python/GitPython[${PYTHON_USEDEP}] )
124 + fem? ( dev-python/ply[${PYTHON_USEDEP}] )
125 + ')
126 +"
127 +DEPEND="${RDEPEND}"
128 +BDEPEND="dev-lang/swig"
129 +
130 +# To get required dependencies:
131 +# 'grep REQUIRES_MODS cMake/FreeCAD_Helpers/CheckInterModuleDependencies.cmake'
132 +# We set the following requirements by default:
133 +# arch, draft, drawing, import, mesh, part, qt5, sketcher, spreadsheet, start, web.
134 +#
135 +# Additionally, we auto-enable mesh_part, flat_mesh and smesh
136 +# Fem actually needs smesh, but as long as we don't have a smesh package, we enable
137 +# smesh through the mesh USE flag. Note however, the fem<-smesh dependency isn't
138 +# reflected by the REQUIRES_MODS macro, but at
139 +# cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake:187.
140 +#
141 +# The increase in auto-enabled workbenches is due to their need in parts of the
142 +# test suite when compiled with a minimal set of USE flags.
143 +REQUIRED_USE="
144 + ${PYTHON_REQUIRED_USE}
145 + inspection? ( points )
146 + path? ( robot )
147 + ship? ( image plot )
148 +"
149 +
150 +PATCHES=(
151 + "${FILESDIR}"/${PN}-0.19_pre20201231-0003-Gentoo-specific-don-t-check-vcs.patch
152 + "${FILESDIR}"/${PN}-0.19.1-0001-Gentoo-specific-Remove-ccache-usage.patch
153 + "${FILESDIR}"/${P}-0001-fix-failing-test-workbench-testcase.patch
154 + "${FILESDIR}"/${P}-0002-fix-femtest-failure-with-yaml-load.patch
155 + "${FILESDIR}"/${P}-0003-fix-test-when-built-without-GUI.patch
156 + "${WORKDIR}"/${P}-0005-Make-smesh-compile-with-vtk9.patch
157 + "${FILESDIR}"/${P}-0006-add-boost-serialization-to-find_package.patch
158 + "${FILESDIR}"/${P}-0007-fix-build-failure-with-opencascade-7.5.2.patch
159 +)
160 +
161 +DOCS=( CODE_OF_CONDUCT.md ChangeLog.txt README.md )
162 +
163 +CHECKREQS_DISK_BUILD="2G"
164 +
165 +pkg_setup() {
166 + check-reqs_pkg_setup
167 + python-single-r1_pkg_setup
168 + [[ -z ${CASROOT} ]] && die "\${CASROOT} not set, plesae run eselect opencascade"
169 +}
170 +
171 +src_prepare() {
172 + # the upstream provided file doesn't find the coin doc tag file,
173 + # but cmake ships a working one, so we use this.
174 + rm "${S}/cMake/FindCoin3D.cmake" || die
175 +
176 + # Fix OpenCASCADE lookup
177 + local OCC_P=$(best_version sci-libs/opencascade[vtk])
178 + OCC_P=${OCC_P#sci-libs/}
179 + local OCC_PV=${OCC_P#opencascade-}
180 + OCC_PV=$(ver_cut 1-2 ${OCC_PV})
181 + # check for CASROOT needed to ensure occ-7.5 is eselected and profile resourced
182 + if [[ ${OCC_PV} = 7.5 && ${CASROOT} = "/usr" ]]; then
183 + sed -e 's|/usr/include/opencascade|'${CASROOT}'/include/'${OCC_P}'|' \
184 + -e 's|/usr/lib|'${CASROOT}'/'$(get_libdir)'/'${OCC_P}' NO_DEFAULT_PATH|' \
185 + -i cMake/FindOpenCasCade.cmake || die
186 + else
187 + sed -e 's|/usr/include/opencascade|${CASROOT}/include/opencascade|' \
188 + -e 's|/usr/lib|${CASROOT}/'$(get_libdir)' NO_DEFAULT_PATH|' \
189 + -i cMake/FindOpenCasCade.cmake || die
190 + fi
191 +
192 + # Fix desktop file
193 + sed -e 's/Exec=FreeCAD/Exec=freecad/' -i src/XDGData/org.freecadweb.FreeCAD.desktop || die
194 +
195 + cmake_src_prepare
196 +}
197 +
198 +src_configure() {
199 + local mycmakeargs=(
200 + -DBUILD_ADDONMGR=$(usex addonmgr)
201 + -DBUILD_ARCH=ON
202 + -DBUILD_ASSEMBLY=OFF # deprecated
203 + -DBUILD_CLOUD=$(usex cloud)
204 + -DBUILD_COMPLETE=OFF # deprecated
205 + -DBUILD_DRAFT=ON
206 + -DBUILD_DRAWING=ON
207 + -DBUILD_ENABLE_CXX_STD:STRING="C++17" # needed for >=boost-1.77.0
208 + -DBUILD_FEM=$(usex fem)
209 + -DBUILD_FEM_NETGEN=OFF
210 + -DBUILD_FLAT_MESH=ON
211 + -DBUILD_FORCE_DIRECTORY=ON # force building in a dedicated directory
212 + -DBUILD_FREETYPE=ON # automagic dep
213 + -DBUILD_GUI=$(usex !headless)
214 + -DBUILD_IDF=$(usex idf)
215 + -DBUILD_IMAGE=$(usex image)
216 + -DBUILD_IMPORT=ON # import module for various file formats
217 + -DBUILD_INSPECTION=$(usex inspection)
218 + -DBUILD_JTREADER=OFF # code has been removed upstream, but option is still there
219 + -DBUILD_MATERIAL=$(usex material)
220 + -DBUILD_MESH=ON
221 + -DBUILD_MESH_PART=ON
222 + -DBUILD_OPENSCAD=$(usex openscad)
223 + -DBUILD_PART=ON
224 + -DBUILD_PART_DESIGN=$(usex part-design)
225 + -DBUILD_PATH=$(usex path)
226 + -DBUILD_PLOT=$(usex plot) # conflicts with possible external workbench
227 + -DBUILD_POINTS=$(usex points)
228 + -DBUILD_QT5=ON # OFF means to use Qt4
229 + -DBUILD_RAYTRACING=$(usex raytracing)
230 + -DBUILD_REVERSEENGINEERING=OFF # currently only an empty sandbox
231 + -DBUILD_ROBOT=$(usex robot)
232 + -DBUILD_SHIP=$(usex ship) # conflicts with possible external workbench
233 + -DBUILD_SHOW=$(usex show)
234 + -DBUILD_SKETCHER=ON # needed by draft workspace
235 + -DBUILD_SMESH=ON
236 + -DBUILD_SPREADSHEET=ON
237 + -DBUILD_START=ON
238 + -DBUILD_SURFACE=$(usex surface)
239 + -DBUILD_TECHDRAW=$(usex techdraw)
240 + -DBUILD_TEST=ON # always build test workbench for run-time testing
241 + -DBUILD_TUX=$(usex tux)
242 + -DBUILD_VR=OFF
243 + -DBUILD_WEB=ON # needed by start workspace
244 + -DBUILD_WITH_CONDA=OFF
245 +
246 + -DCMAKE_INSTALL_DATADIR=/usr/share/${PN}/data
247 + -DCMAKE_INSTALL_DOCDIR=/usr/share/doc/${PF}
248 + -DCMAKE_INSTALL_INCLUDEDIR=/usr/include/${PN}
249 + -DCMAKE_INSTALL_PREFIX=/usr/$(get_libdir)/${PN}
250 +
251 + -DFREECAD_BUILD_DEBIAN=OFF
252 +
253 + -DFREECAD_USE_EXTERNAL_KDL=ON
254 + -DFREECAD_USE_EXTERNAL_SMESH=OFF # no package in Gentoo
255 + -DFREECAD_USE_EXTERNAL_ZIPIOS=OFF # doesn't work yet, also no package in Gentoo tree
256 + -DFREECAD_USE_FREETYPE=ON
257 + -DFREECAD_USE_OCC_VARIANT:STRING="Official Version"
258 + -DFREECAD_USE_PCL=$(usex pcl)
259 + -DFREECAD_USE_PYBIND11=ON
260 + -DFREECAD_USE_QT_FILEDIALOG=ON
261 + -DFREECAD_USE_QTWEBMODULE:STRING="Qt WebEngine"
262 +
263 + # install python modules to site-packages' dir. True only for the main package,
264 + # sub-packages will still be installed inside /usr/lib64/freecad
265 + -DINSTALL_TO_SITEPACKAGES=ON
266 +
267 + # Use the version of shiboken2 that matches the selected python version
268 + -DPYTHON_CONFIG_SUFFIX="-${EPYTHON}"
269 + -DPython3_EXECUTABLE=${PYTHON}
270 +
271 + -DOCCT_CMAKE_FALLBACK=ON # don't use occt-config which isn't included in opencascade for Gentoo
272 + )
273 +
274 + if has_version ">=sci-libs/opencascade-7.5"; then
275 + # bug https://bugs.gentoo.org/788274
276 + local OCC_P=$(best_version sci-libs/opencascade[vtk])
277 + OCC_P=${OCC_P#sci-libs/}
278 + OCC_P=${OCC_P%-r*}
279 + mycmakeargs+=(
280 + -DOCC_INCLUDE_DIR="${CASROOT}"/include/${OCC_P}
281 + -DOCC_LIBRARY_DIR="${CASROOT}"/$(get_libdir)/${OCC_P}
282 + )
283 + else
284 + # <occ-7.5 uses different layout
285 + mycmakeargs+=(
286 + -DOCC_INCLUDE_DIR="${CASROOT}"/include/opencascade
287 + -DOCC_LIBRARY_DIR="${CASROOT}"/$(get_libdir)
288 + )
289 + fi
290 +
291 + if use debug; then
292 + mycmakeargs+=(
293 + -DBUILD_SANDBOX=ON
294 + -DBUILD_TEMPLATE=ON
295 + )
296 + else
297 + mycmakeargs+=(
298 + -DBUILD_SANDBOX=OFF
299 + -DBUILD_TEMPLATE=OFF
300 + )
301 + fi
302 +
303 + cmake_src_configure
304 +}
305 +
306 +# We use the FreeCADCmd binary instead of the FreeCAD binary here
307 +# for two reasons:
308 +# 1. It works out of the box with USE=headless as well, not needing a guard
309 +# 2. We don't need virtualx.eclass and it's dependencies
310 +# The exported environment variables are needed, so freecad does know
311 +# where to save it's temporary files, and where to look and write it's
312 +# configuration. Without those, there are sandbox violation, when it
313 +# tries to create /var/lib/portage/home/.FreeCAD directory.
314 +src_test() {
315 + pushd "${BUILD_DIR}" > /dev/null || die
316 + export FREECAD_USER_HOME="${HOME}"
317 + export FREECAD_USER_DATA="${T}"
318 + export FREECAD_USER_TEMP="${T}"
319 + nonfatal ./bin/FreeCADCmd --run-test 0
320 + popd > /dev/null || die
321 +}
322 +
323 +src_install() {
324 + cmake_src_install
325 +
326 + dobin src/Tools/freecad-thumbnailer
327 +
328 + if ! use headless; then
329 + dosym -r /usr/$(get_libdir)/${PN}/bin/FreeCAD /usr/bin/freecad
330 + mv "${ED}"/usr/$(get_libdir)/freecad/share/* "${ED}"/usr/share || die "failed to move shared ressources"
331 + fi
332 + dosym -r /usr/$(get_libdir)/${PN}/bin/FreeCADCmd /usr/bin/freecadcmd
333 +
334 + python_optimize "${ED}"/usr/share/${PN}/data/Mod/Start/StartPage "${ED}"/usr/$(get_libdir)/${PN}{/Ext,/Mod}/
335 + # compile main package in python site-packages as well
336 + python_optimize
337 +
338 + doenvd "${FILESDIR}/99${PN}"
339 +}
340 +
341 +pkg_postinst() {
342 + xdg_pkg_postinst
343 +
344 + if use plot; then
345 + einfo "Note: You are enabling the 'plot' USE flag."
346 + einfo "This conflicts with the plot workbench that can be loaded"
347 + einfo "via the addon manager! You can only install one of those."
348 + fi
349 +
350 + if use ship; then
351 + einfo "Note: You are enabling the 'ship' USE flag."
352 + einfo "This conflicts with the ship workbench that can be loaded"
353 + einfo "via the addon manager! You can only install one of those."
354 + fi
355 +
356 + einfo "You can load a lot of additional workbenches using the integrated"
357 + einfo "AddonManager."
358 +
359 + # ToDo: check opencv, pysolar (::science), elmerfem (::science)
360 + # ifc++, ifcopenshell, netgen, z88 (no pkgs), calculix-ccx (::waebbl)
361 + einfo "There are a lot of additional tools, for which FreeCAD has builtin"
362 + einfo "support. Some of them are available in Gentoo. Take a look at"
363 + einfo "https://wiki.freecadweb.org/Installing#External_software_supported_by_FreeCAD"
364 + optfeature_header "Computational utilities"
365 + optfeature "BLAS library" sci-libs/openblas
366 + optfeature "Statistical computation with Python" dev-python/pandas
367 + optfeature "Use scientific computation with Python" dev-python/scipy
368 + optfeature "Use symbolic math with Python" dev-python/sympy
369 + optfeature_header "Imaging, Plotting and Rendering utilities"
370 + optfeature "Dependency graphs" media-gfx/graphviz
371 + optfeature "PBR Rendering" media-gfx/povray
372 + optfeature_header "Import / Export"
373 + optfeature "Interact with git repositories" dev-python/GitPython
374 + optfeature "Work with COLLADA documents" dev-python/pycollada
375 + optfeature "YAML importer and emitter" dev-python/pyyaml
376 + optfeature "Importing and exporting 2D AutoCAD DWG files" media-gfx/libredwg
377 + optfeature "Importing and exporting geospatial data formats" sci-libs/gdal
378 + optfeature "Working with projection data" sci-libs/proj
379 + optfeature_header "Meshing and FEM"
380 + optfeature "FEM mesh generator" sci-libs/gmsh
381 + optfeature "Triangulating meshes" sci-libs/gts
382 + optfeature "Visualization" sci-visualization/paraview
383 +}
384 +
385 +pkg_postrm() {
386 + xdg_pkg_postrm
387 +}