Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/opencascade/
Date: Sat, 06 Nov 2021 06:03:37
Message-Id: 1636178584.9f74703d8f9637f484ee9cdbe18d23efb5704a19.sam@gentoo
1 commit: 9f74703d8f9637f484ee9cdbe18d23efb5704a19
2 Author: Bernd Waibel <waebbl-gentoo <AT> posteo <DOT> net>
3 AuthorDate: Fri Nov 5 16:31:23 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sat Nov 6 06:03:04 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9f74703d
7
8 sci-libs/opencascade: restrict dependency on dev-cpp/tbb
9
10 Version tbb-2021.4.0 has some header files removed, so we restrict to
11 earlier versions.
12
13 Bug: https://bugs.gentoo.org/821655
14 Package-Manager: Portage-3.0.28, Repoman-3.0.3
15 Signed-off-by: Bernd Waibel <waebbl-gentoo <AT> posteo.net>
16 Signed-off-by: Sam James <sam <AT> gentoo.org>
17
18 sci-libs/opencascade/opencascade-7.5.2-r2.ebuild | 171 +++++++++++++++++++++++
19 1 file changed, 171 insertions(+)
20
21 diff --git a/sci-libs/opencascade/opencascade-7.5.2-r2.ebuild b/sci-libs/opencascade/opencascade-7.5.2-r2.ebuild
22 new file mode 100644
23 index 00000000000..cf90cc0c8aa
24 --- /dev/null
25 +++ b/sci-libs/opencascade/opencascade-7.5.2-r2.ebuild
26 @@ -0,0 +1,171 @@
27 +# Copyright 1999-2021 Gentoo Authors
28 +# Distributed under the terms of the GNU General Public License v2
29 +
30 +EAPI=7
31 +
32 +inherit cmake flag-o-matic
33 +
34 +MY_PV="$(ver_rs 1- '_')"
35 +PV_MAJ="$(ver_cut 1-2)"
36 +
37 +DESCRIPTION="Development platform for CAD/CAE, 3D surface/solid modeling and data exchange"
38 +HOMEPAGE="https://www.opencascade.com"
39 +SRC_URI="https://git.dev.opencascade.org/gitweb/?p=occt.git;a=snapshot;h=refs/tags/V${MY_PV};sf=tgz -> ${P}.tar.gz"
40 +S="${WORKDIR}/occt-V${MY_PV}"
41 +
42 +LICENSE="|| ( Open-CASCADE-LGPL-2.1-Exception-1.0 LGPL-2.1 )"
43 +SLOT="${PV_MAJ}"
44 +KEYWORDS="~amd64 ~arm64 ~x86"
45 +IUSE="debug doc examples ffmpeg freeimage gles2 json optimize tbb vtk"
46 +
47 +REQUIRED_USE="?? ( optimize tbb )"
48 +
49 +# There's no easy way to test. Testing needs a rather big environment
50 +# properly set up.
51 +RESTRICT="test"
52 +
53 +RDEPEND="
54 + app-eselect/eselect-opencascade
55 + dev-lang/tcl:=
56 + dev-lang/tk:=
57 + dev-tcltk/itcl
58 + dev-tcltk/itk
59 + dev-tcltk/tix
60 + media-libs/fontconfig
61 + media-libs/freetype:2
62 + media-libs/ftgl
63 + virtual/glu
64 + virtual/opengl
65 + x11-libs/libXmu
66 + examples? (
67 + dev-qt/qtcore:5
68 + dev-qt/qtgui:5
69 + dev-qt/qtquickcontrols2:5
70 + dev-qt/qtwidgets:5
71 + dev-qt/qtxml:5
72 + )
73 + ffmpeg? ( media-video/ffmpeg:= )
74 + freeimage? ( media-libs/freeimage )
75 + tbb? ( <dev-cpp/tbb-2021.4.0 )
76 + vtk? ( sci-libs/vtk:=[rendering] )
77 +"
78 +DEPEND="
79 + ${RDEPEND}
80 + dev-cpp/eigen
81 + dev-libs/rapidjson
82 +"
83 +BDEPEND="
84 + app-eselect/eselect-opencascade
85 + doc? ( app-doc/doxygen )
86 + examples? ( dev-qt/linguist-tools:5 )
87 +"
88 +
89 +PATCHES=(
90 + "${FILESDIR}"/${PN}-7.5.1-0001-allow-default-search-path-for-Qt5.patch
91 + "${FILESDIR}"/${PN}-7.5.1-0002-remove-unnecessary-Qt5-check.patch
92 + "${FILESDIR}"/${PN}-7.5.1-0003-add-Gentoo-configuration-type.patch
93 + "${FILESDIR}"/${PN}-7.5.1-0004-fix-installation-of-cmake-config-files.patch
94 + "${FILESDIR}"/${PN}-7.5.1-0005-fix-write-permissions-on-scripts.patch
95 + "${FILESDIR}"/${PN}-7.5.1-0006-fix-creation-of-custom.sh-script.patch
96 + "${FILESDIR}"/${PN}-7.5.1-fix-AllValues-name-collision-with-vtk-9.0.patch
97 +)
98 +
99 +src_prepare() {
100 + cmake_src_prepare
101 +
102 + use debug && append-cppflags -DDEBUG
103 +
104 + sed -e 's|/lib\$|/'$(get_libdir)'\$|' \
105 + -i adm/templates/OpenCASCADEConfig.cmake.in || die
106 +
107 + # There is an OCCT_UPDATE_TARGET_FILE cmake macro that fails due to some
108 + # assumptions it makes about installation paths. Rather than fixing it, just
109 + # get rid of the mechanism altogether - its purpose is to allow a
110 + # side-by-side installation of release and debug libraries.
111 + sed -e 's|\\${OCCT_INSTALL_BIN_LETTER}||' \
112 + -i adm/cmake/occt_toolkit.cmake || die
113 +}
114 +
115 +src_configure() {
116 + local mycmakeargs=(
117 + -DBUILD_DOC_Overview=$(usex doc)
118 + -DBUILD_Inspector=$(usex examples)
119 + -DBUILD_WITH_DEBUG=$(usex debug)
120 + -DINSTALL_DIR_BIN="$(get_libdir)/${P}/bin"
121 + -DINSTALL_DIR_CMAKE="$(get_libdir)/cmake/${P}"
122 + -DINSTALL_DIR_DOC="share/doc/${PF}"
123 + -DINSTALL_DIR_LIB="$(get_libdir)/${P}"
124 + -DINSTALL_DIR_SCRIPT="$(get_libdir)/${P}/bin"
125 + -DINSTALL_DIR_WITH_VERSION=ON
126 + -DINSTALL_SAMPLES=$(usex examples)
127 + -DINSTALL_TEST_CASES=NO
128 + -DUSE_D3D=NO
129 + -DUSE_FFMPEG=$(usex ffmpeg)
130 + -DUSE_FREEIMAGE=$(usex freeimage)
131 + -DUSE_FREETYPE=ON
132 + -DUSE_GLES2=$(usex gles2)
133 + -DUSE_RAPIDJSON=$(usex json)
134 + -DUSE_TBB=$(usex tbb)
135 + -DUSE_VTK=$(usex vtk)
136 + )
137 +
138 + use doc && mycmakeargs+=( -DINSTALL_DOC_Overview=ON )
139 +
140 + if use examples; then
141 + mycmakeargs+=(
142 + -D3RDPARTY_QT_DIR="${ESYSROOT}"/usr
143 + -DBUILD_SAMPLES_QT=ON
144 + )
145 + fi
146 +
147 + if use vtk; then
148 + if has_version ">=sci-libs/vtk-9.0.0"; then
149 + mycmakeargs+=(
150 + -D3RDPARTY_VTK_DIR="${ESYSROOT}"/usr
151 + -D3RDPARTY_VTK_INCLUDE_DIR="${ESYSROOT}"/usr/include/vtk-9.0
152 + -D3RDPARTY_VTK_LIBRARY_DIR="${ESYSROOT}"/usr/$(get_libdir)
153 + )
154 + fi
155 + fi
156 +
157 + cmake_src_configure
158 +
159 + # prepare /etc/env.d file
160 + sed -e "s|lib/|$(get_libdir)/|" \
161 + -e "s|VAR_PV|${PV}|" \
162 + -e "s|VAR_CASROOT|${ESYSROOT}/usr|" \
163 + < "${FILESDIR}"/${PN}-${PV_MAJ}.env.in > "${T}"/${PV_MAJ} || die
164 +
165 + # use TBB for memory allocation optimizations
166 + if use tbb; then
167 + sed -e 's|^#MMGT_OPT=0$|MMGT_OPT=2|' -i "${T}"/${PV_MAJ} || die
168 + fi
169 +
170 + # use internal optimized memory manager and don't clear memory with this
171 + # memory manager.
172 + if use optimize ; then
173 + sed -e 's|^#MMGT_OPT=0$|MMGT_OPT=1|' \
174 + -e 's|^#MMGT_CLEAR=1$|MMGT_CLEAR=0|' \
175 + -i "${T}"/${PV_MAJ} || die
176 + fi
177 +}
178 +
179 +src_install() {
180 + cmake_src_install
181 +
182 + # respect slotting
183 + insinto "/etc/env.d/${PN}"
184 + doins "${T}/${PV_MAJ}"
185 +
186 + # remove examples
187 + if use !examples; then
188 + rm -r "${ED}/usr/share/${P}/samples" || die
189 + fi
190 +
191 + docompress -x /usr/share/doc/${PF}/overview/html
192 +}
193 +
194 +pkg_postinst() {
195 + eselect ${PN} set ${PV_MAJ} || die "failed to switch to updated implementation"
196 + einfo "You can switch between available ${PN} implementations using eselect ${PN}"
197 +}