commit:     3a529685c95f6c74ed4b46d4c7501373b0a55769
Author:     Bernd Waibel <waebbl-gentoo <AT> posteo <DOT> net>
AuthorDate: Tue Feb  9 21:20:39 2021 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Thu Feb 18 09:36:11 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a529685

sci-libs/opencascade: fix paths in cmake config

Thanks to Fabio Rossi for reporting the issue.
See also upstream bug at
https://tracker.dev.opencascade.org/view.php?id=32035

Closes: https://bugs.gentoo.org/763162
Package-Manager: Portage-3.0.14, Repoman-3.0.2
Signed-off-by: Bernd Waibel <waebbl-gentoo <AT> posteo.net>
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 ...7.4.0-fix-issue-with-cmake-path-variables.patch |  41 ++++++
 sci-libs/opencascade/opencascade-7.4.0-r4.ebuild   | 148 +++++++++++++++++++++
 2 files changed, 189 insertions(+)

diff --git 
a/sci-libs/opencascade/files/opencascade-7.4.0-fix-issue-with-cmake-path-variables.patch
 
b/sci-libs/opencascade/files/opencascade-7.4.0-fix-issue-with-cmake-path-variables.patch
new file mode 100644
index 00000000000..aacb642019f
--- /dev/null
+++ 
b/sci-libs/opencascade/files/opencascade-7.4.0-fix-issue-with-cmake-path-variables.patch
@@ -0,0 +1,41 @@
+From cefaa5bddedcb90a06d6ef8f0837a11619e5d87e Mon Sep 17 00:00:00 2001
+From: Bernd Waibel <[email protected]>
+Date: Tue, 9 Feb 2021 20:58:43 +0100
+Subject: [PATCH] fix issue with cmake path variables
+
+Thanks to Fabio Rossi for reporting the issue.
+Upstream bug: https://tracker.dev.opencascade.org/view.php?id=32035
+
+Signed-off-by: Bernd Waibel <[email protected]>
+---
+ adm/templates/OpenCASCADEConfig.cmake.in | 14 +-------------
+ 1 file changed, 1 insertion(+), 13 deletions(-)
+
+diff --git a/adm/templates/OpenCASCADEConfig.cmake.in 
b/adm/templates/OpenCASCADEConfig.cmake.in
+index 4937103b..db99a8d1 100644
+--- a/adm/templates/OpenCASCADEConfig.cmake.in
++++ b/adm/templates/OpenCASCADEConfig.cmake.in
+@@ -16,19 +16,7 @@ set (OpenCASCADE_MINOR_VERSION       "@OCC_VERSION_MINOR@")
+ set (OpenCASCADE_MAINTENANCE_VERSION "@OCC_VERSION_MAINTENANCE@")
+ set (OpenCASCADE_DEVELOPMENT_VERSION "@OCC_VERSION_DEVELOPMENT@")
+ 
+-# Compute the installation prefix from this OpenCASCADEConfig.cmake file 
+-# location, by going up one level + one level if "cmake" + one level if "lib".
+-# This is made to support different locations of CMake files:
+-# - in UNIX style: $INSTALL_DIR/lib/cmake/opencascade-<version>
+-# - in Windows style: $INSTALL_DIR/cmake
+-get_filename_component (OpenCASCADE_INSTALL_PREFIX 
"${CMAKE_CURRENT_LIST_FILE}" PATH)
+-get_filename_component (OpenCASCADE_INSTALL_PREFIX 
"${OpenCASCADE_INSTALL_PREFIX}" PATH)
+-if (OpenCASCADE_INSTALL_PREFIX MATCHES "/cmake$")
+-  get_filename_component (OpenCASCADE_INSTALL_PREFIX 
"${OpenCASCADE_INSTALL_PREFIX}" PATH)
+-endif()
+-if (OpenCASCADE_INSTALL_PREFIX MATCHES "/lib$")
+-  get_filename_component (OpenCASCADE_INSTALL_PREFIX 
"${OpenCASCADE_INSTALL_PREFIX}" PATH)
+-endif()
++set (OpenCASCADE_INSTALL_PREFIX "$ENV{CASROOT}")
+ 
+ # Set OpenCASCADE paths to headers, binaries, libraries, resources, tests, 
samples, data
+ set (OpenCASCADE_BINARY_DIR   
"${OpenCASCADE_INSTALL_PREFIX}/@INSTALL_DIR_BIN@")
+-- 
+2.30.0
+

diff --git a/sci-libs/opencascade/opencascade-7.4.0-r4.ebuild 
b/sci-libs/opencascade/opencascade-7.4.0-r4.ebuild
new file mode 100644
index 00000000000..a6b119a193b
--- /dev/null
+++ b/sci-libs/opencascade/opencascade-7.4.0-r4.ebuild
@@ -0,0 +1,148 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# TODO:
+# check the src files referenced in 51opencascade, i.e. resources and the like
+# check where cmake gets it's '-s' linker flag to avoid pre-stripping (QA)
+
+EAPI=7
+
+inherit check-reqs cmake flag-o-matic java-pkg-opt-2
+
+DESCRIPTION="Development platform for CAD/CAE, 3D surface/solid modeling and 
data exchange"
+HOMEPAGE="https://www.opencascade.com";
+MY_PV="$(ver_rs 1- '_')"
+SRC_URI="https://git.dev.opencascade.org/gitweb/?p=occt.git;a=snapshot;h=refs/tags/V${MY_PV};sf=tgz
 -> ${P}.tar.gz"
+
+LICENSE="|| ( Open-CASCADE-LGPL-2.1-Exception-1.0 LGPL-2.1 )"
+SLOT="${PV}"
+KEYWORDS="~amd64 ~x86"
+# gl2ps
+IUSE="debug doc examples ffmpeg freeimage gles2 inspector java optimize qt5 
tbb +vtk"
+
+REQUIRED_USE="
+       inspector? ( qt5 )
+       ?? ( optimize tbb )
+"
+
+#      gl2ps? ( x11-libs/gl2ps )
+RDEPEND="
+       app-eselect/eselect-opencascade
+       dev-cpp/eigen
+       dev-lang/tcl:0=
+       dev-lang/tk:0=
+       dev-tcltk/itcl
+       dev-tcltk/itk
+       dev-tcltk/tix
+       media-libs/freetype:2
+       media-libs/ftgl
+       virtual/glu
+       virtual/opengl
+       x11-libs/libXmu
+       ffmpeg? ( media-video/ffmpeg )
+       freeimage? ( media-libs/freeimage )
+       java? ( virtual/jdk:1.8 )
+       qt5? (
+               dev-qt/qtcore:5
+               dev-qt/qtgui:5
+               dev-qt/qtquickcontrols2:5
+               dev-qt/qtwidgets:5
+               dev-qt/qtxml:5
+       )
+       tbb? ( dev-cpp/tbb )
+       vtk? ( >=sci-libs/vtk-8.1.0[rendering] )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+       doc? (
+               app-doc/doxygen
+               qt5? ( dev-qt/linguist-tools:5 )
+       )
+"
+
+# There's no easy way to test. Testing needs a rather big environment
+# properly set up.
+RESTRICT="test"
+
+CHECKREQS_MEMORY="256M"
+CHECKREQS_DISK_BUILD="3584M"
+
+CMAKE_BUILD_TYPE=Release
+
+S="${WORKDIR}/occt-V${MY_PV}"
+
+PATCHES=(
+       "${FILESDIR}/${P}-find-qt.patch"
+       "${FILESDIR}/${P}-fix-install.patch"
+       "${FILESDIR}/${P}-fix-issue-with-cmake-path-variables.patch"
+)
+
+pkg_setup() {
+       check-reqs_pkg_setup
+       use java && java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+       cmake_src_prepare
+       use java && java-pkg-opt-2_src_prepare
+#      sed -e 's/\/lib\$/\/'$(get_libdir)'\$/' \
+#              -i adm/templates/OpenCASCADEConfig.cmake.in || die
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DBUILD_DOC_Overview=$(usex doc)
+               -DBUILD_Inspector=$(usex inspector)
+               -DBUILD_WITH_DEBUG=$(usex debug)
+               -DCMAKE_CONFIGURATION_TYPES="Gentoo"
+               -DCMAKE_INSTALL_PREFIX="/usr/$(get_libdir)/${P}/ros"
+               -DINSTALL_DIR_DOC="/usr/share/doc/${PF}"
+               -DINSTALL_DIR_CMAKE="/usr/$(get_libdir)/cmake"
+#              -DINSTALL_DOC_Overview=$(usex doc)
+               -DINSTALL_SAMPLES=$(usex examples)
+               -DINSTALL_TEST_CASES=NO
+               -DUSE_D3D=no
+               -DUSE_FFMPEG=$(usex ffmpeg)
+               -DUSE_FREEIMAGE=$(usex freeimage)
+#              -DUSE_GL2PS=$(usex gl2ps)
+               -DUSE_GLES2=$(usex gles2)
+               -DUSE_TBB=$(usex tbb)
+               -DUSE_VTK=$(usex vtk)
+       )
+
+       use examples && mycmakeargs+=( -DBUILD_SAMPLES_QT=$(usex qt5) )
+
+       cmake_src_configure
+
+       # prepare /etc/env.d file
+       sed -e 's|VAR_CASROOT|'${EROOT%}'/usr/'$(get_libdir)'/'${P}'/ros|g' < 
"${FILESDIR}/${P}.env.in" >> "${T}/${PV}" || die
+       sed -i -e 's|ros/lib|ros/'$(get_libdir)'|' "${T}/${PV}" || die
+
+       # use TBB for memory allocation optimizations?
+       use tbb && (sed -i -e 's|^#MMGT_OPT=0$|MMGT_OPT=2|' "${T}/${PV}" || die)
+
+       if use optimize ; then
+               # use internal optimized memory manager?
+               sed -i -e 's|^#MMGT_OPT=0$|MMGT_OPT=1|' "${T}/${PV}" || die
+               # don't clear memory ?
+               sed -i -e 's|^#MMGT_CLEAR=1$|MMGT_CLEAR=0|' "${T}/${PV}" || die
+       fi
+}
+
+src_install() {
+       cmake_src_install
+
+       # respect slotting
+       insinto "/etc/env.d/${PN}"
+       doins "${T}/${PV}"
+
+       # remove examples
+       use examples || (rm -rf 
"${ED}/usr/$(get_libdir)/${P}/ros/share/${PN}/samples" || die)
+       use java || (rm -rf 
"${ED}/usr/$(get_libdir)/${P}/ros/share/${PN}/samples/java" || die)
+       use qt5 || (rm -rf 
"${ED}/usr/$(get_libdir)/${P}/ros/share/${PN}/samples/qt" || die)
+}
+
+pkg_postinst() {
+       eselect ${PN} set ${PV} || die "failed to switch to updated 
implementation"
+       einfo "You can switch between available ${PN} implementations using 
eselect ${PN}"
+}

Reply via email to