Gentoo Archives: gentoo-commits

From: Alexey Shvetsov <alexxy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-gfx/freecad/
Date: Mon, 31 May 2021 19:26:23
Message-Id: 1622489169.04ff08820f7e8734963d046b496fbb03190b64c0.alexxy@gentoo
1 commit: 04ff08820f7e8734963d046b496fbb03190b64c0
2 Author: Bernd Waibel <waebbl-gentoo <AT> posteo <DOT> net>
3 AuthorDate: Tue May 18 22:16:39 2021 +0000
4 Commit: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
5 CommitDate: Mon May 31 19:26:09 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04ff0882
7
8 media-gfx/freecad: port changes from 0.19.2
9
10 Incorporate the changes from 0.19.2 ebuild.
11 Disable BUILD_SANDBOX if USE=debug, due to
12 https://forum.freecadweb.org/viewtopic.php?f=4&t=36071&start=30#p504595
13
14 Package-Manager: Portage-3.0.18, Repoman-3.0.3
15 Signed-off-by: Bernd Waibel <waebbl-gentoo <AT> posteo.net>
16 Closes: https://github.com/gentoo/gentoo/pull/20879
17 Signed-off-by: Alexey Shvetsov <alexxy <AT> gentoo.org>
18
19 media-gfx/freecad/freecad-9999.ebuild | 133 +++++++++++++++++++++++-----------
20 1 file changed, 90 insertions(+), 43 deletions(-)
21
22 diff --git a/media-gfx/freecad/freecad-9999.ebuild b/media-gfx/freecad/freecad-9999.ebuild
23 index 90acff50625..8b29013224e 100644
24 --- a/media-gfx/freecad/freecad-9999.ebuild
25 +++ b/media-gfx/freecad/freecad-9999.ebuild
26 @@ -11,14 +11,16 @@ inherit check-reqs cmake desktop eapi8-dosym optfeature python-single-r1 xdg
27 DESCRIPTION="QT based Computer Aided Design application"
28 HOMEPAGE="https://www.freecadweb.org/ https://github.com/FreeCAD/FreeCAD"
29
30 +MY_PN=FreeCAD
31 +
32 if [[ ${PV} = *9999 ]]; then
33 inherit git-r3
34 - EGIT_REPO_URI="https://github.com/FreeCAD/FreeCAD.git"
35 + EGIT_REPO_URI="https://github.com/${MY_PN}/${MY_PN}.git"
36 S="${WORKDIR}/freecad-${PV}"
37 else
38 MY_PV=$(ver_cut 1-2)
39 MY_PV=$(ver_rs 1 '_' ${MY_PV})
40 - SRC_URI="https://github.com/FreeCAD/FreeCAD/archive/${PV}.tar.gz -> ${P}.tar.gz"
41 + SRC_URI="https://github.com/${MY_PN}/${MY_PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
42 KEYWORDS="~amd64"
43 S="${WORKDIR}/FreeCAD-${PV}"
44 fi
45 @@ -31,9 +33,9 @@ IUSE="debug headless pcl test"
46 RESTRICT="!test? ( test )"
47
48 FREECAD_EXPERIMENTAL_MODULES="cloud plot ship"
49 -FREECAD_STABLE_MODULES="addonmgr arch drawing fem idf image
50 - inspection material mesh openscad part-design path points
51 - raytracing robot show spreadsheet surface techdraw tux"
52 +FREECAD_STABLE_MODULES="addonmgr fem idf image inspection material
53 + openscad part-design path points raytracing robot show surface
54 + techdraw tux"
55
56 for module in ${FREECAD_STABLE_MODULES}; do
57 IUSE="${IUSE} +${module}"
58 @@ -48,7 +50,7 @@ RDEPEND="
59 >=dev-cpp/eigen-3.3.1:3
60 dev-libs/OpenNI2[opengl(+)]
61 dev-libs/libspnav[X]
62 - dev-libs/xerces-c
63 + dev-libs/xerces-c[icu]
64 dev-qt/designer:5
65 dev-qt/qtconcurrent:5
66 dev-qt/qtcore:5
67 @@ -65,6 +67,7 @@ RDEPEND="
68 media-libs/freetype
69 media-libs/qhull
70 sci-libs/flann[openmp]
71 + sci-libs/hdf5:=[fortran,zlib]
72 >=sci-libs/med-4.0.0-r1[python,${PYTHON_SINGLE_USEDEP}]
73 sci-libs/opencascade:=[vtk(+)]
74 sci-libs/orocos_kdl:=
75 @@ -77,7 +80,6 @@ RDEPEND="
76 net-misc/curl
77 )
78 fem? ( <sci-libs/vtk-9[boost,python,qt5,rendering,${PYTHON_SINGLE_USEDEP}] )
79 - mesh? ( sci-libs/hdf5:=[fortran,zlib] )
80 openscad? ( media-gfx/openscad )
81 pcl? ( >=sci-libs/pcl-1.8.1:=[opengl,openni2(+),qt5(+),vtk(+)] )
82 $(python_gen_cond_dep '
83 @@ -85,10 +87,11 @@ RDEPEND="
84 dev-python/matplotlib[${PYTHON_MULTI_USEDEP}]
85 dev-python/numpy[${PYTHON_MULTI_USEDEP}]
86 >=dev-python/pivy-0.6.5[${PYTHON_MULTI_USEDEP}]
87 + dev-python/pybind11[${PYTHON_MULTI_USEDEP}]
88 dev-python/pyside2[gui,svg,${PYTHON_MULTI_USEDEP}]
89 dev-python/shiboken2[${PYTHON_MULTI_USEDEP}]
90 addonmgr? ( dev-python/GitPython[${PYTHON_MULTI_USEDEP}] )
91 - mesh? ( dev-python/pybind11[${PYTHON_MULTI_USEDEP}] )
92 + fem? ( dev-python/ply[${PYTHON_MULTI_USEDEP}] )
93 ')
94 "
95 DEPEND="${RDEPEND}"
96 @@ -97,35 +100,31 @@ BDEPEND="dev-lang/swig"
97 # To get required dependencies:
98 # 'grep REQUIRES_MODS cMake/FreeCAD_Helpers/CheckInterModuleDependencies.cmake'
99 # We set the following requirements by default:
100 -# draft, import, part, qt5, sketcher, start, web.
101 +# arch, draft, drawing, import, mesh, part, qt5, sketcher, spreadsheet, start, web.
102 #
103 -# Additionally if mesh is set, we auto-enable mesh_part, flat_mesh and smesh
104 +# Additionally, we auto-enable mesh_part, flat_mesh and smesh
105 # Fem actually needs smesh, but as long as we don't have a smesh package, we enable
106 # smesh through the mesh USE flag. Note however, the fem<-smesh dependency isn't
107 # reflected by the REQUIRES_MODS macro, but at
108 # cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake:187.
109 +#
110 +# The increase in auto-enabled workbenches is due to their need in parts of the
111 +# test suite when compiled with a minimal set of USE flags.
112 REQUIRED_USE="
113 ${PYTHON_REQUIRED_USE}
114 - arch? ( mesh )
115 - debug? ( mesh )
116 - drawing? ( spreadsheet )
117 - fem? ( mesh )
118 - inspection? ( mesh points )
119 - openscad? ( mesh )
120 - path? ( mesh robot )
121 + inspection? ( points )
122 + path? ( robot )
123 ship? ( image plot )
124 - techdraw? ( spreadsheet drawing )
125 "
126
127 PATCHES=(
128 - "${FILESDIR}"/${PN}-0.19_pre20201231-0001-FindCoin3DDoc.cmake-fix-patch-for-coin-docs.patch
129 "${FILESDIR}"/${PN}-0.19_pre20201231-0003-Gentoo-specific-don-t-check-vcs.patch
130 "${FILESDIR}"/${PN}-0.19.1-0001-Gentoo-specific-Remove-ccache-usage.patch
131 )
132
133 DOCS=( CODE_OF_CONDUCT.md ChangeLog.txt README.md )
134
135 -CHECKREQS_DISK_BUILD="3G"
136 +CHECKREQS_DISK_BUILD="2G"
137
138 pkg_setup() {
139 check-reqs_pkg_setup
140 @@ -139,9 +138,20 @@ src_prepare() {
141 rm "${S}/cMake/FindCoin3D.cmake" || die
142
143 # Fix OpenCASCADE lookup
144 - sed -e 's|/usr/include/opencascade|${CASROOT}/include/opencascade|' \
145 - -e 's|/usr/lib|${CASROOT}/'$(get_libdir)' NO_DEFAULT_PATH|' \
146 - -i cMake/FindOpenCasCade.cmake || die
147 + local OCC_P=$(best_version sci-libs/opencascade[vtk])
148 + OCC_P=${OCC_P#sci-libs/}
149 + local OCC_PV=${OCC_P#opencascade-}
150 + OCC_PV=$(ver_cut 1-2 ${OCC_PV})
151 + # check for CASROOT needed to ensure occ-7.5 is eselected and profile resourced
152 + if [[ ${OCC_PV} = 7.5 && ${CASROOT} = "/usr" ]]; then
153 + sed -e 's|/usr/include/opencascade|'${CASROOT}'/include/'${OCC_P}'|' \
154 + -e 's|/usr/lib|'${CASROOT}'/'$(get_libdir)'/'${OCC_P}' NO_DEFAULT_PATH|' \
155 + -i cMake/FindOpenCasCade.cmake || die
156 + else
157 + sed -e 's|/usr/include/opencascade|${CASROOT}/include/opencascade|' \
158 + -e 's|/usr/lib|${CASROOT}/'$(get_libdir)' NO_DEFAULT_PATH|' \
159 + -i cMake/FindOpenCasCade.cmake || die
160 + fi
161
162 # Fix desktop file
163 sed -e 's/Exec=FreeCAD/Exec=freecad/' -i src/XDGData/org.freecadweb.FreeCAD.desktop || die
164 @@ -152,16 +162,16 @@ src_prepare() {
165 src_configure() {
166 local mycmakeargs=(
167 -DBUILD_ADDONMGR=$(usex addonmgr)
168 - -DBUILD_ARCH=$(usex arch)
169 - -DBUILD_ASSEMBLY=OFF
170 + -DBUILD_ARCH=ON
171 + -DBUILD_ASSEMBLY=OFF # deprecated
172 -DBUILD_CLOUD=$(usex cloud)
173 -DBUILD_COMPLETE=OFF # deprecated
174 - -DBUILD_DRAFT=ON # basic workspace, enable it by default
175 - -DBUILD_DRAWING=$(usex drawing)
176 + -DBUILD_DRAFT=ON
177 + -DBUILD_DRAWING=ON
178 -DBUILD_ENABLE_CXX_STD:STRING="C++14" # needed for >=boost-1.75.0
179 -DBUILD_FEM=$(usex fem)
180 -DBUILD_FEM_NETGEN=OFF
181 - -DBUILD_FLAT_MESH=$(usex mesh)
182 + -DBUILD_FLAT_MESH=ON
183 -DBUILD_FORCE_DIRECTORY=ON # force building in a dedicated directory
184 -DBUILD_FREETYPE=ON # automagic dep
185 -DBUILD_GUI=$(usex !headless)
186 @@ -171,10 +181,10 @@ src_configure() {
187 -DBUILD_INSPECTION=$(usex inspection)
188 -DBUILD_JTREADER=OFF # code has been removed upstream, but option is still there
189 -DBUILD_MATERIAL=$(usex material)
190 - -DBUILD_MESH=$(usex mesh)
191 - -DBUILD_MESH_PART=$(usex mesh)
192 + -DBUILD_MESH=ON
193 + -DBUILD_MESH_PART=ON
194 -DBUILD_OPENSCAD=$(usex openscad)
195 - -DBUILD_PART=ON # basic workspace, enable it by default
196 + -DBUILD_PART=ON
197 -DBUILD_PART_DESIGN=$(usex part-design)
198 -DBUILD_PATH=$(usex path)
199 -DBUILD_PLOT=$(usex plot) # conflicts with possible external workbench
200 @@ -186,11 +196,12 @@ src_configure() {
201 -DBUILD_SHIP=$(usex ship) # conflicts with possible external workbench
202 -DBUILD_SHOW=$(usex show)
203 -DBUILD_SKETCHER=ON # needed by draft workspace
204 - -DBUILD_SMESH=$(usex mesh)
205 - -DBUILD_SPREADSHEET=$(usex spreadsheet)
206 - -DBUILD_START=ON # basic workspace, enable it by default
207 + -DBUILD_SMESH=ON
208 + -DBUILD_SPREADSHEET=ON
209 + -DBUILD_START=ON
210 -DBUILD_SURFACE=$(usex surface)
211 -DBUILD_TECHDRAW=$(usex techdraw)
212 + -DBUILD_TEST=ON # always build test workbench for run-time testing
213 -DBUILD_TUX=$(usex tux)
214 -DBUILD_VR=OFF
215 -DBUILD_WEB=ON # needed by start workspace
216 @@ -203,42 +214,74 @@ src_configure() {
217
218 -DFREECAD_BUILD_DEBIAN=OFF
219
220 - -DFREECAD_USE_CCACHE=OFF
221 -DFREECAD_USE_EXTERNAL_KDL=ON
222 -DFREECAD_USE_EXTERNAL_SMESH=OFF # no package in Gentoo
223 -DFREECAD_USE_EXTERNAL_ZIPIOS=OFF # doesn't work yet, also no package in Gentoo tree
224 -DFREECAD_USE_FREETYPE=ON
225 -DFREECAD_USE_OCC_VARIANT:STRING="Official Version"
226 -DFREECAD_USE_PCL=$(usex pcl)
227 - -DFREECAD_USE_PYBIND11=$(usex mesh)
228 + -DFREECAD_USE_PYBIND11=ON
229 -DFREECAD_USE_QT_FILEDIALOG=ON
230 -DFREECAD_USE_QTWEBMODULE:STRING="Qt WebEngine"
231
232 - -DPython3_EXECUTABLE=${PYTHON}
233 + # install python modules to site-packages' dir. True only for the main package,
234 + # sub-packages will still be installed inside /usr/lib64/freecad
235 + -DINSTALL_TO_SITEPACKAGES=ON
236
237 - -DOCC_INCLUDE_DIR="${CASROOT}"/include/opencascade
238 - -DOCC_LIBRARY_DIR="${CASROOT}"/$(get_libdir)
239 + -DPython3_EXECUTABLE=${PYTHON}
240 -DOCCT_CMAKE_FALLBACK=ON # don't use occt-config which isn't included in opencascade for Gentoo
241 )
242
243 + if has_version ">=sci-libs/opencascade-7.5"; then
244 + # bug https://bugs.gentoo.org/788274
245 + local OCC_P=$(best_version sci-libs/opencascade[vtk])
246 + OCC_P=${OCC_P#sci-libs/}
247 + mycmakeargs+=(
248 + -DOCC_INCLUDE_DIR="${CASROOT}"/include/${OCC_P}
249 + -DOCC_LIBRARY_DIR="${CASROOT}"/$(get_libdir)/${OCC_P}
250 + )
251 + else
252 + # <occ-7.5 uses different layout
253 + mycmakeargs+=(
254 + -DOCC_INCLUDE_DIR="${CASROOT}"/include/opencascade
255 + -DOCC_LIBRARY_DIR="${CASROOT}"/$(get_libdir)
256 + )
257 + fi
258 +
259 if use debug; then
260 + # BUILD_SANDBOX currently broken, see
261 + # https://forum.freecadweb.org/viewtopic.php?f=4&t=36071&start=30#p504595
262 mycmakeargs+=(
263 - # sandbox needs mesh support
264 - -DBUILD_SANDBOX=$(usex mesh)
265 + -DBUILD_SANDBOX=OFF
266 -DBUILD_TEMPLATE=ON
267 - -DBUILD_TEST=ON
268 )
269 else
270 mycmakeargs+=(
271 -DBUILD_SANDBOX=OFF
272 -DBUILD_TEMPLATE=OFF
273 - -DBUILD_TEST=OFF
274 )
275 fi
276
277 cmake_src_configure
278 }
279
280 +# We use the FreeCADCmd binary instead of the FreeCAD binary here
281 +# for two reasons:
282 +# 1. It works out of the box with USE=headless as well, not needing a guard
283 +# 2. We don't need virtualx.eclass and it's dependencies
284 +# The exported environment variables are needed, so freecad does know
285 +# where to save it's temporary files, and where to look and write it's
286 +# configuration. Without those, there are sandbox violation, when it
287 +# tries to create /var/lib/portage/home/.FreeCAD directory.
288 +src_test() {
289 + pushd "${BUILD_DIR}" > /dev/null || die
290 + export FREECAD_USER_HOME="${HOME}"
291 + export FREECAD_USER_DATA="${T}"
292 + export FREECAD_USER_TEMP="${T}"
293 + nonfatal ./bin/FreeCADCmd --run-test 0
294 + popd > /dev/null || die
295 +}
296 +
297 src_install() {
298 cmake_src_install
299
300 @@ -249,6 +292,10 @@ src_install() {
301 dosym8 -r /usr/$(get_libdir)/${PN}/bin/FreeCADCmd /usr/bin/freecadcmd
302
303 python_optimize "${ED}"/usr/share/${PN}/data/Mod/Start/StartPage "${ED}"/usr/$(get_libdir)/${PN}{/Ext,/Mod}/
304 + # compile main package in python site-packages as well
305 + python_optimize
306 +
307 + doenvd "${FILESDIR}/99${PN}"
308 }
309
310 pkg_postinst() {