sci-libs/opencascade: add 7.7.1, 7.7.2, 7.8.0, 9999

Closes: https://bugs.gentoo.org/923350
Closes: https://bugs.gentoo.org/911578
Closes: https://bugs.gentoo.org/908889
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/35374
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Paul Zander
2024-02-16 16:02:28 +01:00
committed by Sam James
parent ee4cd7a0bc
commit 6c55a8ea86
9 changed files with 1539 additions and 21 deletions

View File

@@ -1,2 +1,7 @@
DIST opencascade-7.6.3.tar.gz 48216090 BLAKE2B ff0b63250e77b0240bd99bba38cd0e6b0a8c88bf39e495f5d51d7913f097e2cad83a5ad121e9d56de11c74008249c99a41f4615269a085b7cf97c3d7f0477d6d SHA512 c708f76edb707ba18bdfe7442ed8fa500894ee6c1cd8d0313eb906b3aa7dfa40a575f04dbccd70e84395d670f2b93fb8529f3d59726449234e627b9f35b9dded
DIST opencascade-7.7.0.tar.gz 48393806 BLAKE2B b41da7bdd07aa6ef52f7833bef3e8a9fc2ca16cbf754773cb7adcc059c11c2a7937d279a2b6cf3096e7af6fbb42c6fdc2a5c98340d6b084d2ba100ba2c538f2a SHA512 6c90e2761f752241417ae6f18d819f51e66b32f3a50a97384f29ed73fa07f4cded84c71a6f6ba302d5e35c57e2fc13001619521eaf45757e4e5ff670d94bbf5c
DIST opencascade-7.7.1.tar.gz 48408076 BLAKE2B 46e14a47a0ce555ac17a3fca520c1f21d7ca05c67b54259e3d2d8560618db096313d5be3d5e4a24acad1912534c17293ad203f48dd7464690aec86e287d9f230 SHA512 f095848d212afbe7e71614d46f57222e347246aec7c92aafae59e6f07798f5371c7a125042c149393ee7d361f28eb89b5196de17a7cc37233f1586ba919c0839
DIST opencascade-7.7.2.tar.gz 48404428 BLAKE2B 28d637e75eca570e38401a0a59127ffdbcb06838a91cc3899fe905834bb47e0e9a92d16cde52027d94e78b0fbddc2043340a35dcb0f4a472c4f2bdac2713216c SHA512 d9e882d44bb65616f8cfce68ebdcd5765669b84e3d82cfb2d1bc22b71b0e878442c079bacc37e9d54f28ce98a7c23bf81f2a3e3e7bbeeec38927ca739f423dee
DIST opencascade-7.8.0.tar.gz 48428565 BLAKE2B 91253101072af27c94b82b82beed5c1f1d7460f4154600fba805c5b2d27976a4841b9a9dfab9e67706d02463b2c630c5b63d1f056e84c69c9c8eeaca7e7caebf SHA512 af176cbd105c49949282c16bb6e30f69167bc6c00a50e0ae69aea555815d47ac3c4540c233e596c5add7cb846c2b33d7be267d8e02472286e758b662b4a652ab
DIST opencascade-dataset-7.7.0.tar.gz 128392200 BLAKE2B ebfbe6f24520144ca4a82e4ddd0486890552c2de1b62bf5c0d4990d777d4a1458dea54f8a6f08d8a0999582fb4325eda0002fc8a0137b9e66d024a47145d1279 SHA512 71d7e807b1d629fe7371b9d1d503024d00b7c1ae1775e62803eeffd127bd1c768e5240fdd1f949a237737089d528b5d4e43d26db025bbe14a4e0e4616ebdc5d8
DIST opencascade-dataset-7.8.0.tar.xz 97049756 BLAKE2B aae5f076d9fc8a0d8a05028b0d9ffb527978e7acfdf5ecbc7e71c5ee3d6060cd7db9e56dba5b94a445bf5cf208126711cda70306607bdc5cd5e8b68df8fc150c SHA512 9b4c91d7b4743c47f2cf8d9a3b6ded73409a13133013424150ee9bdb61fd771c0b8799c7f31b459a7d2ba140399b9c0c972e2d0476188006361b4fb04042d990

View File

@@ -0,0 +1,27 @@
From: Paul Zander <negril.nx+gentoo@gmail.com>
Only try to find the jemalloc libs we are going to use
diff --git a/adm/cmake/jemalloc.cmake b/adm/cmake/jemalloc.cmake
index b37d5d276..deef66d6c 100644
--- a/adm/cmake/jemalloc.cmake
+++ b/adm/cmake/jemalloc.cmake
@@ -128,6 +128,7 @@ endmacro()
# Reset CSF variable
set (CSF_MMGR "")
+if(BUILD_LIBRARY_TYPE EQUAL "Static")
# find static jemalloc lib
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a")
if (WIN32)
@@ -137,7 +138,10 @@ elseif(NOT WIN32)
SET(CMAKE_FIND_LIBRARY_SUFFIXES "" "so")
JEMALLOC_LIB_SEARCH ("jemalloc.so.2" "SHARED")
endif()
+endif()
+if(BUILD_LIBRARY_TYPE EQUAL "Shared")
# find shared jemalloc lib
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".so")
JEMALLOC_LIB_SEARCH ("jemalloc" "SHARED")
+endif()

View File

@@ -0,0 +1,14 @@
From: Paul Zander <negril.nx+gentoo@gmail.com>
Bump cmake minimum version to remove warning
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 88d34f0..232c643 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.1 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/adm/cmake")

View File

@@ -0,0 +1,19 @@
From: Paul Zander <negril.nx+gentoo@gmail.com>
Fix test harness script
diff --git a/adm/templates/draw.sh b/adm/templates/draw.sh
index 02e6043..c7347e0 100755
--- a/adm/templates/draw.sh
+++ b/adm/templates/draw.sh
@@ -4,7 +4,8 @@ aCurrentPath="$PWD"
aScriptPath=${BASH_SOURCE%/*}; if [ -d "${aScriptPath}" ]; then cd "$aScriptPath"; fi; aScriptPath="$PWD";
source "${aScriptPath}/env.sh" "$1"
+shift
echo 'Hint: use "pload ALL" command to load standard commands'
-cd ${aCurrentPath}
-DRAWEXE
+cd "${aCurrentPath}"
+DRAWEXE "$@"

View File

@@ -10,26 +10,17 @@
<name>Proxy Maintainers</name>
</maintainer>
<use>
<flag name="eigen">
Enable support for eigenvalues through the header-only
<pkg>dev-cpp/eigen</pkg> package.
</flag>
<flag name="freeimage">
Enable support for image i/o via <pkg>media-libs/freeimage</pkg>
</flag>
<flag name="json">
Enable JSON support through <pkg>dev-libs/rapidjson</pkg>
</flag>
<flag name="optimize">
Don't clear allocated memory. Use optimized memory manager unless
tbb USE flag is set.
</flag>
<flag name="tbb">
Enable multithreading with the Intel Threads Building Block
<pkg>dev-cpp/tbb</pkg>
</flag>
<flag name="vtk">
Enable Visualization Toolkit support via <pkg>sci-libs/vtk</pkg>
</flag>
<flag name="eigen">Enable support for eigenvalues through the header-only <pkg>dev-cpp/eigen</pkg> package.</flag>
<flag name="freeimage">Enable support for image i/o via <pkg>media-libs/freeimage</pkg></flag>
<flag name="freetype">Enable <pkg>media-libs/freetype</pkg> support</flag>
<flag name="jemalloc">Enable jemalloc allocator support via <pkg>dev-libs/jemalloc</pkg></flag>
<flag name="json">Enable JSON support through <pkg>dev-libs/rapidjson</pkg></flag>
<flag name="optimize">Don't clear allocated memory. Use optimized memory manager unlesstbb USE flag is set.</flag>
<flag name="tbb">Enable multithreading with the Intel Threads Building Block <pkg>dev-cpp/tbb</pkg></flag>
<flag name="testprograms">Indicates whether non-regression OCCT test scripts should be installed</flag>
<flag name="vtk">Enable Visualization Toolkit support via <pkg>sci-libs/vtk</pkg></flag>
</use>
<upstream>
<remote-id type="github">Open-Cascade-SAS/OCCT</remote-id>
</upstream>
</pkgmetadata>

View File

@@ -0,0 +1,366 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake virtualx
DESCRIPTION="Development platform for CAD/CAE, 3D surface/solid modeling and data exchange"
HOMEPAGE="https://www.opencascade.com"
MY_PN="OCCT"
MY_TEST_PV="7.7.0"
MY_TEST_PV2="${MY_TEST_PV//./_}"
SRC_URI="
test? ( https://github.com/Open-Cascade-SAS/${MY_PN}/releases/download/V${MY_TEST_PV2}/${PN}-dataset-${MY_TEST_PV}.tgz
-> ${PN}-dataset-${MY_TEST_PV}.tar.gz )
"
if [[ ${PV} = *9999* ]] ; then
inherit git-r3
EGIT_REPO_URI="https://github.com/Open-Cascade-SAS/${MY_PN}.git"
else
MY_PV="${PV//./_}"
SRC_URI+="
https://github.com/Open-Cascade-SAS/${MY_PN}/archive/refs/tags/V${MY_PV}.tar.gz -> ${P}.tar.gz
"
S="${WORKDIR}/${MY_PN}-${MY_PV}"
KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86"
fi
LICENSE="|| ( Open-CASCADE-LGPL-2.1-Exception-1.0 LGPL-2.1 )"
SLOT="0/$(ver_cut 1-2)"
IUSE="X debug doc examples ffmpeg freeimage freetype gles2-only +gui jemalloc json +opengl optimize tbb test testprograms tk vtk"
REQUIRED_USE="
?? ( optimize tbb )
?? ( opengl gles2-only )
test? ( freeimage json opengl )
"
# There's no easy way to test. Testing needs a rather big environment properly set up.
RESTRICT="!test? ( test )"
# ffmpeg: https://tracker.dev.opencascade.org/view.php?id=32871
RDEPEND="
dev-lang/tcl:=
tk? ( dev-lang/tk:= )
dev-libs/double-conversion
freetype? (
media-libs/fontconfig
media-libs/freetype:2
)
opengl? (
media-libs/libglvnd
)
X? (
x11-libs/libX11
)
gui? (
examples? (
dev-qt/qtcore:5
dev-qt/qtgui:5
dev-qt/qtquickcontrols2:5
dev-qt/qtwidgets:5
dev-qt/qtxml:5
)
)
ffmpeg? ( <media-video/ffmpeg-5:= )
freeimage? ( media-libs/freeimage )
jemalloc? ( dev-libs/jemalloc )
tbb? ( dev-cpp/tbb:= )
vtk? (
sci-libs/vtk:=[rendering]
tbb? (
sci-libs/vtk:=[tbb,-cuda]
)
)
"
DEPEND="
${RDEPEND}
X? ( x11-base/xorg-proto )
json? ( dev-libs/rapidjson )
"
BDEPEND="
doc? ( app-text/doxygen[dot] )
gui? (
examples? ( dev-qt/linguist-tools:5 )
)
test? ( dev-tcltk/thread )
"
PATCHES=(
"${FILESDIR}/${PN}-7.5.1-0005-fix-write-permissions-on-scripts.patch"
"${FILESDIR}/${PN}-7.5.1-0006-fix-creation-of-custom.sh-script.patch"
"${FILESDIR}/${PN}-7.7.0-fix-installation-of-cmake-config-files.patch"
"${FILESDIR}/${PN}-7.7.0-avoid-pre-stripping-binaries.patch"
"${FILESDIR}/${PN}-7.7.0-build-against-vtk-9.2.patch"
"${FILESDIR}/${PN}-7.7.0-musl.patch"
"${FILESDIR}/${PN}-7.7.0-jemalloc-lib-type.patch"
"${FILESDIR}/${PN}-7.8.0-cmake-min-version.patch"
"${FILESDIR}/${PN}-7.8.0-tests.patch"
)
src_unpack() {
if [[ ${PV} = *9999* ]] ; then
git-r3_src_unpack
else
unpack "${P}.tar.gz"
fi
if use test; then
mkdir "${WORKDIR}/data"
pushd "${WORKDIR}/data" > /dev/null || die
# should be in paths indicated by CSF_TestDataPath environment variable,
# or in subfolder data in the script directory
unpack "${PN}-dataset-${MY_TEST_PV}.tar.gz"
popd > /dev/null || die
fi
}
src_prepare() {
cmake_src_prepare
sed -e 's|/lib\$|/'"$(get_libdir)"'\$|' \
-i adm/templates/OpenCASCADEConfig.cmake.in || die
# There is an OCCT_UPDATE_TARGET_FILE cmake macro that fails due to some
# assumptions it makes about installation paths. Rather than fixing it, just
# get rid of the mechanism altogether - its purpose is to allow a
# side-by-side installation of release and debug libraries.
sed -e 's|\\${OCCT_INSTALL_BIN_LETTER}||' \
-i adm/cmake/occt_toolkit.cmake || die
}
src_configure() {
local mycmakeargs=(
-D3RDPARTY_DIR="${ESYSROOT}/usr"
-DBUILD_CPP_STANDARD="C++17"
-DBUILD_SOVERSION_NUMBERS=2
-DBUILD_DOC_Overview="$(usex doc)"
-DBUILD_Inspector="$(usex gui)"
-DBUILD_ENABLE_FPE_SIGNAL_HANDLER="$(usex debug)"
-DBUILD_USE_PCH="no"
# -DBUILD_OPT_PROFILE="Default" # Production
# -DBUILD_RESOURCES="yes"
# -DBUILD_YACCLEX="yes"
-DBUILD_RELEASE_DISABLE_EXCEPTIONS="no" # bug #847916
-DINSTALL_DIR="${EPREFIX}/usr"
-DINSTALL_DIR_BIN="$(get_libdir)/${PN}/bin"
-DINSTALL_DIR_CMAKE="$(get_libdir)/cmake/${PN}"
-DINSTALL_DIR_DATA="share/${PN}/data"
-DINSTALL_DIR_DOC="share/doc/${PF}"
-DINSTALL_DIR_INCLUDE="include/${PN}"
-DINSTALL_DIR_LIB="$(get_libdir)/${PN}"
-DINSTALL_DIR_RESOURCE="share/${PN}/resources"
-DINSTALL_DIR_SAMPLES="share/${PN}/samples"
-DINSTALL_DIR_SCRIPT="$(get_libdir)/${PN}/bin"
-DINSTALL_DIR_TESTS="share/${PN}/tests"
-DINSTALL_DIR_WITH_VERSION="no"
-DINSTALL_SAMPLES="$(usex examples)"
-DINSTALL_TEST_CASES="$(usex testprograms)"
# no package yet in tree
-DUSE_DRACO="no"
-DUSE_FFMPEG="$(usex ffmpeg)"
-DUSE_FREEIMAGE="$(usex freeimage)"
-DUSE_FREETYPE="$(usex freetype)"
# Indicates whether OpenGL ES 2.0 should be used in OCCT visualization module
-DUSE_GLES2="$(usex gles2-only)"
# Indicates whether OpenGL desktop should be used in OCCT visualization module
-DUSE_OPENGL="$(usex opengl)"
# no package in tree
-DUSE_OPENVR="no"
-DUSE_RAPIDJSON="$(usex json)"
-DUSE_TBB="$(usex tbb)"
-DUSE_TK="$(usex tk)"
-DUSE_VTK="$(usex vtk)"
-DUSE_XLIB="$(usex X)"
)
# Select using memory manager tool.
if ! use jemalloc && ! use tbb; then
mycmakeargs+=( -DUSE_MMGR_TYPE=NATIVE )
elif use jemalloc && ! use tbb; then
mycmakeargs+=( -DUSE_MMGR_TYPE=JEMALLOC )
elif ! use jemalloc && use tbb; then
mycmakeargs+=( -DUSE_MMGR_TYPE=TBB )
elif use jemalloc && use tbb; then
mycmakeargs+=( -DUSE_MMGR_TYPE=FLEXIBLE )
fi
if use doc; then
mycmakeargs+=(
-DINSTALL_DOC_Overview="yes"
-D3RDPARTY_SKIP_DOT_EXECUTABLE="no"
)
fi
if use gui; then
mycmakeargs+=(
-D3RDPARTY_QT_DIR="${ESYSROOT}/usr"
-DBUILD_SAMPLES_QT="$(usex examples)"
)
fi
if use jemalloc; then
mycmakeargs+=(
-D3RDPARTY_JEMALLOC_INCLUDE_DIR="${ESYSROOT}/usr/include/jemalloc"
)
fi
if use tbb; then
mycmakeargs+=(
-D3RDPARTY_TBB_DIR="${ESYSROOT}/usr"
)
fi
if use vtk; then
local vtk_ver
vtk_ver="$(best_version "sci-libs/vtk")"
vtk_ver=$(ver_cut 1-2 "${vtk_ver#sci-libs/vtk-}")
mycmakeargs+=(
-D3RDPARTY_VTK_INCLUDE_DIR="${ESYSROOT}/usr/include/vtk-${vtk_ver}"
-D3RDPARTY_VTK_LIBRARY_DIR="${ESYSROOT}/usr/$(get_libdir)"
)
fi
cmake_src_configure
sed -e "s|lib/|$(get_libdir)/|" \
-e "s|VAR_CASROOT|${EPREFIX}/usr|" \
< "${FILESDIR}/${PN}.env.in" > "${T}/99${PN}" || die
# use TBB for memory allocation optimizations
if use tbb; then
sed -e 's|^#MMGT_OPT=0$|MMGT_OPT=2|' -i "${T}/99${PN}" || die
fi
# use internal optimized memory manager and don't clear memory with this
# memory manager.
if use optimize ; then
sed -e 's|^#MMGT_OPT=0$|MMGT_OPT=1|' \
-e 's|^#MMGT_CLEAR=1$|MMGT_CLEAR=0|' \
-i "${T}/99${PN}" || die
fi
}
src_test() {
echo "export CSF_OCCTDataPath=${WORKDIR}/data" >> "${BUILD_DIR}/custom.sh" || die
if has_version media-fonts/dejavu; then
cp "${ESYSROOT}/usr/share/fonts/dejavu/DejaVuSans.ttf" "${WORKDIR}/data/" # no die here as this isn't fatal
fi
local test_file=${T}/testscript.tcl
local draw_opts=(
i # see ${BUILD_DIR}/custom*.sh
# -b # batch mode (no GUI, no viewers)
-v # no GUI, use virtual (off-screen) windows for viewers
)
local test_names=(
"demo draw bug30430" # prone to dying due to cpu limit
)
local test_opts=( # run single tests
-overwrite
)
for test_name in "${test_names[@]}"; do
cat >> "${test_file}" <<- _EOF_ || die
test ${test_name} -outfile "${BUILD_DIR}/test_results/${test_name// /\/}.html" ${test_opts[@]}
_EOF_
done
local testgrid_opts=()
local SKIP_TESTS=()
if [[ "${OCCT_OPTIONAL_TESTS}" != "true" ]]; then
SKIP_TESTS+=(
'blend complex F4'
'bugs'
'geometry circ2d3Tan '{CircleCircleLin_11,CircleLinPoint_11}
'heal checkshape bug32448_1'
'hlr exact_hlr bug25813_2'
'hlr poly_hlr '{bug25813_2,bug25813_3,bug25813_4,Plate}
'lowalgos intss bug'{565,567_1,25950,27431,29807_i1003,29807_i2006,29807_i3003,29807_i5002,30703}
'lowalgos proximity '{A4,A5}
'opengl background bug27836'
'opengl drivers opengles'
'opengles3'
'demo draw bug30430'
)
local DEL_TESTS=(
'opengl/data/background/bug27836'
'perf/mesh/bug26965'
'v3d/trsf/bug26029'
)
for test in "${DEL_TESTS[@]}"; do
rm "${CMAKE_USE_DIR}/tests/${test}" || die
done
fi
if ! use vtk; then
SKIP_TESTS+=(
'vtk'
)
echo "IGNORE /Could not open: libTKIVtkDraw/skip VTK" >> "${CMAKE_USE_DIR}/tests/opengl/parse.rules"
fi
if [[ -n "${SKIP_TESTS[*]}" ]]; then
testgrid_opts+=( -exclude "$(IFS=',' ; echo "${SKIP_TESTS[*]}")" )
fi
testgrid_opts+=(
# -refresh 5
-overwrite
)
cat >> "${test_file}" <<- _EOF_ || die
testgrid -outdir "${BUILD_DIR}/test_results" ${testgrid_opts[@]}
_EOF_
# # regenerate summary in case we have to
# cat >> "${test_file}" <<- _EOF_ || die
# testsummarize "${BUILD_DIR}/test_results"
# _EOF_
# Work around zink warnings
export LIBGL_ALWAYS_SOFTWARE="true"
export CASROOT="${BUILD_DIR}"
virtx \
"${BUILD_DIR}/draw.sh" \
"${draw_opts[@]}" \
-f "${test_file}"
if [[ ! -f "${BUILD_DIR}/test_results/tests.log" ]]; then
eerror "tests never ran!"
die
fi
failed_tests="$(grep ": FAILED" "${BUILD_DIR}/test_results/tests.log")"
if [[ -n ${failed_tests} ]]; then
eerror "Failed tests:"
eerror "${failed_tests}"
die
fi
}
src_install() {
cmake_src_install
doenvd "${T}/99${PN}"
docompress -x "/usr/share/doc/${PF}/overview/html"
}

View File

@@ -0,0 +1,366 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake virtualx
DESCRIPTION="Development platform for CAD/CAE, 3D surface/solid modeling and data exchange"
HOMEPAGE="https://www.opencascade.com"
MY_PN="OCCT"
MY_TEST_PV="7.7.0"
MY_TEST_PV2="${MY_TEST_PV//./_}"
SRC_URI="
test? ( https://github.com/Open-Cascade-SAS/${MY_PN}/releases/download/V${MY_TEST_PV2}/${PN}-dataset-${MY_TEST_PV}.tgz
-> ${PN}-dataset-${MY_TEST_PV}.tar.gz )
"
if [[ ${PV} = *9999* ]] ; then
inherit git-r3
EGIT_REPO_URI="https://github.com/Open-Cascade-SAS/${MY_PN}.git"
else
MY_PV="${PV//./_}"
SRC_URI+="
https://github.com/Open-Cascade-SAS/${MY_PN}/archive/refs/tags/V${MY_PV}.tar.gz -> ${P}.tar.gz
"
S="${WORKDIR}/${MY_PN}-${MY_PV}"
KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86"
fi
LICENSE="|| ( Open-CASCADE-LGPL-2.1-Exception-1.0 LGPL-2.1 )"
SLOT="0/$(ver_cut 1-2)"
IUSE="X debug doc examples ffmpeg freeimage freetype gles2-only +gui jemalloc json +opengl optimize tbb test testprograms tk vtk"
REQUIRED_USE="
?? ( optimize tbb )
?? ( opengl gles2-only )
test? ( freeimage json opengl )
"
# There's no easy way to test. Testing needs a rather big environment properly set up.
RESTRICT="!test? ( test )"
# ffmpeg: https://tracker.dev.opencascade.org/view.php?id=32871
RDEPEND="
dev-lang/tcl:=
tk? ( dev-lang/tk:= )
dev-libs/double-conversion
freetype? (
media-libs/fontconfig
media-libs/freetype:2
)
opengl? (
media-libs/libglvnd
)
X? (
x11-libs/libX11
)
gui? (
examples? (
dev-qt/qtcore:5
dev-qt/qtgui:5
dev-qt/qtquickcontrols2:5
dev-qt/qtwidgets:5
dev-qt/qtxml:5
)
)
ffmpeg? ( <media-video/ffmpeg-5:= )
freeimage? ( media-libs/freeimage )
jemalloc? ( dev-libs/jemalloc )
tbb? ( dev-cpp/tbb:= )
vtk? (
sci-libs/vtk:=[rendering]
tbb? (
sci-libs/vtk:=[tbb,-cuda]
)
)
"
DEPEND="
${RDEPEND}
X? ( x11-base/xorg-proto )
json? ( dev-libs/rapidjson )
"
BDEPEND="
doc? ( app-text/doxygen[dot] )
gui? (
examples? ( dev-qt/linguist-tools:5 )
)
test? ( dev-tcltk/thread )
"
PATCHES=(
"${FILESDIR}/${PN}-7.5.1-0005-fix-write-permissions-on-scripts.patch"
"${FILESDIR}/${PN}-7.5.1-0006-fix-creation-of-custom.sh-script.patch"
"${FILESDIR}/${PN}-7.7.0-fix-installation-of-cmake-config-files.patch"
"${FILESDIR}/${PN}-7.7.0-avoid-pre-stripping-binaries.patch"
"${FILESDIR}/${PN}-7.7.0-build-against-vtk-9.2.patch"
"${FILESDIR}/${PN}-7.7.0-musl.patch"
"${FILESDIR}/${PN}-7.7.0-jemalloc-lib-type.patch"
"${FILESDIR}/${PN}-7.8.0-cmake-min-version.patch"
"${FILESDIR}/${PN}-7.8.0-tests.patch"
)
src_unpack() {
if [[ ${PV} = *9999* ]] ; then
git-r3_src_unpack
else
unpack "${P}.tar.gz"
fi
if use test; then
mkdir "${WORKDIR}/data"
pushd "${WORKDIR}/data" > /dev/null || die
# should be in paths indicated by CSF_TestDataPath environment variable,
# or in subfolder data in the script directory
unpack "${PN}-dataset-${MY_TEST_PV}.tar.gz"
popd > /dev/null || die
fi
}
src_prepare() {
cmake_src_prepare
sed -e 's|/lib\$|/'"$(get_libdir)"'\$|' \
-i adm/templates/OpenCASCADEConfig.cmake.in || die
# There is an OCCT_UPDATE_TARGET_FILE cmake macro that fails due to some
# assumptions it makes about installation paths. Rather than fixing it, just
# get rid of the mechanism altogether - its purpose is to allow a
# side-by-side installation of release and debug libraries.
sed -e 's|\\${OCCT_INSTALL_BIN_LETTER}||' \
-i adm/cmake/occt_toolkit.cmake || die
}
src_configure() {
local mycmakeargs=(
-D3RDPARTY_DIR="${ESYSROOT}/usr"
-DBUILD_CPP_STANDARD="C++17"
-DBUILD_SOVERSION_NUMBERS=2
-DBUILD_DOC_Overview="$(usex doc)"
-DBUILD_Inspector="$(usex gui)"
-DBUILD_ENABLE_FPE_SIGNAL_HANDLER="$(usex debug)"
-DBUILD_USE_PCH="no"
# -DBUILD_OPT_PROFILE="Default" # Production
# -DBUILD_RESOURCES="yes"
# -DBUILD_YACCLEX="yes"
-DBUILD_RELEASE_DISABLE_EXCEPTIONS="no" # bug #847916
-DINSTALL_DIR="${EPREFIX}/usr"
-DINSTALL_DIR_BIN="$(get_libdir)/${PN}/bin"
-DINSTALL_DIR_CMAKE="$(get_libdir)/cmake/${PN}"
-DINSTALL_DIR_DATA="share/${PN}/data"
-DINSTALL_DIR_DOC="share/doc/${PF}"
-DINSTALL_DIR_INCLUDE="include/${PN}"
-DINSTALL_DIR_LIB="$(get_libdir)/${PN}"
-DINSTALL_DIR_RESOURCE="share/${PN}/resources"
-DINSTALL_DIR_SAMPLES="share/${PN}/samples"
-DINSTALL_DIR_SCRIPT="$(get_libdir)/${PN}/bin"
-DINSTALL_DIR_TESTS="share/${PN}/tests"
-DINSTALL_DIR_WITH_VERSION="no"
-DINSTALL_SAMPLES="$(usex examples)"
-DINSTALL_TEST_CASES="$(usex testprograms)"
# no package yet in tree
-DUSE_DRACO="no"
-DUSE_FFMPEG="$(usex ffmpeg)"
-DUSE_FREEIMAGE="$(usex freeimage)"
-DUSE_FREETYPE="$(usex freetype)"
# Indicates whether OpenGL ES 2.0 should be used in OCCT visualization module
-DUSE_GLES2="$(usex gles2-only)"
# Indicates whether OpenGL desktop should be used in OCCT visualization module
-DUSE_OPENGL="$(usex opengl)"
# no package in tree
-DUSE_OPENVR="no"
-DUSE_RAPIDJSON="$(usex json)"
-DUSE_TBB="$(usex tbb)"
-DUSE_TK="$(usex tk)"
-DUSE_VTK="$(usex vtk)"
-DUSE_XLIB="$(usex X)"
)
# Select using memory manager tool.
if ! use jemalloc && ! use tbb; then
mycmakeargs+=( -DUSE_MMGR_TYPE=NATIVE )
elif use jemalloc && ! use tbb; then
mycmakeargs+=( -DUSE_MMGR_TYPE=JEMALLOC )
elif ! use jemalloc && use tbb; then
mycmakeargs+=( -DUSE_MMGR_TYPE=TBB )
elif use jemalloc && use tbb; then
mycmakeargs+=( -DUSE_MMGR_TYPE=FLEXIBLE )
fi
if use doc; then
mycmakeargs+=(
-DINSTALL_DOC_Overview="yes"
-D3RDPARTY_SKIP_DOT_EXECUTABLE="no"
)
fi
if use gui; then
mycmakeargs+=(
-D3RDPARTY_QT_DIR="${ESYSROOT}/usr"
-DBUILD_SAMPLES_QT="$(usex examples)"
)
fi
if use jemalloc; then
mycmakeargs+=(
-D3RDPARTY_JEMALLOC_INCLUDE_DIR="${ESYSROOT}/usr/include/jemalloc"
)
fi
if use tbb; then
mycmakeargs+=(
-D3RDPARTY_TBB_DIR="${ESYSROOT}/usr"
)
fi
if use vtk; then
local vtk_ver
vtk_ver="$(best_version "sci-libs/vtk")"
vtk_ver=$(ver_cut 1-2 "${vtk_ver#sci-libs/vtk-}")
mycmakeargs+=(
-D3RDPARTY_VTK_INCLUDE_DIR="${ESYSROOT}/usr/include/vtk-${vtk_ver}"
-D3RDPARTY_VTK_LIBRARY_DIR="${ESYSROOT}/usr/$(get_libdir)"
)
fi
cmake_src_configure
sed -e "s|lib/|$(get_libdir)/|" \
-e "s|VAR_CASROOT|${EPREFIX}/usr|" \
< "${FILESDIR}/${PN}.env.in" > "${T}/99${PN}" || die
# use TBB for memory allocation optimizations
if use tbb; then
sed -e 's|^#MMGT_OPT=0$|MMGT_OPT=2|' -i "${T}/99${PN}" || die
fi
# use internal optimized memory manager and don't clear memory with this
# memory manager.
if use optimize ; then
sed -e 's|^#MMGT_OPT=0$|MMGT_OPT=1|' \
-e 's|^#MMGT_CLEAR=1$|MMGT_CLEAR=0|' \
-i "${T}/99${PN}" || die
fi
}
src_test() {
echo "export CSF_OCCTDataPath=${WORKDIR}/data" >> "${BUILD_DIR}/custom.sh" || die
if has_version media-fonts/dejavu; then
cp "${ESYSROOT}/usr/share/fonts/dejavu/DejaVuSans.ttf" "${WORKDIR}/data/" # no die here as this isn't fatal
fi
local test_file=${T}/testscript.tcl
local draw_opts=(
i # see ${BUILD_DIR}/custom*.sh
# -b # batch mode (no GUI, no viewers)
-v # no GUI, use virtual (off-screen) windows for viewers
)
local test_names=(
"demo draw bug30430" # prone to dying due to cpu limit
)
local test_opts=( # run single tests
-overwrite
)
for test_name in "${test_names[@]}"; do
cat >> "${test_file}" <<- _EOF_ || die
test ${test_name} -outfile "${BUILD_DIR}/test_results/${test_name// /\/}.html" ${test_opts[@]}
_EOF_
done
local testgrid_opts=()
local SKIP_TESTS=()
if [[ "${OCCT_OPTIONAL_TESTS}" != "true" ]]; then
SKIP_TESTS+=(
'blend complex F4'
'bugs'
'geometry circ2d3Tan '{CircleCircleLin_11,CircleLinPoint_11}
'heal checkshape bug32448_1'
'hlr exact_hlr bug25813_2'
'hlr poly_hlr '{bug25813_2,bug25813_3,bug25813_4,Plate}
'lowalgos intss bug'{565,567_1,25950,27431,29807_i1003,29807_i2006,29807_i3003,29807_i5002,30703}
'lowalgos proximity '{A4,A5}
'opengl background bug27836'
'opengl drivers opengles'
'opengles3'
'demo draw bug30430'
)
local DEL_TESTS=(
'opengl/data/background/bug27836'
'perf/mesh/bug26965'
'v3d/trsf/bug26029'
)
for test in "${DEL_TESTS[@]}"; do
rm "${CMAKE_USE_DIR}/tests/${test}" || die
done
fi
if ! use vtk; then
SKIP_TESTS+=(
'vtk'
)
echo "IGNORE /Could not open: libTKIVtkDraw/skip VTK" >> "${CMAKE_USE_DIR}/tests/opengl/parse.rules"
fi
if [[ -n "${SKIP_TESTS[*]}" ]]; then
testgrid_opts+=( -exclude "$(IFS=',' ; echo "${SKIP_TESTS[*]}")" )
fi
testgrid_opts+=(
# -refresh 5
-overwrite
)
cat >> "${test_file}" <<- _EOF_ || die
testgrid -outdir "${BUILD_DIR}/test_results" ${testgrid_opts[@]}
_EOF_
# # regenerate summary in case we have to
# cat >> "${test_file}" <<- _EOF_ || die
# testsummarize "${BUILD_DIR}/test_results"
# _EOF_
# Work around zink warnings
export LIBGL_ALWAYS_SOFTWARE="true"
export CASROOT="${BUILD_DIR}"
virtx \
"${BUILD_DIR}/draw.sh" \
"${draw_opts[@]}" \
-f "${test_file}"
if [[ ! -f "${BUILD_DIR}/test_results/tests.log" ]]; then
eerror "tests never ran!"
die
fi
failed_tests="$(grep ": FAILED" "${BUILD_DIR}/test_results/tests.log")"
if [[ -n ${failed_tests} ]]; then
eerror "Failed tests:"
eerror "${failed_tests}"
die
fi
}
src_install() {
cmake_src_install
doenvd "${T}/99${PN}"
docompress -x "/usr/share/doc/${PF}/overview/html"
}

View File

@@ -0,0 +1,365 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake virtualx
DESCRIPTION="Development platform for CAD/CAE, 3D surface/solid modeling and data exchange"
HOMEPAGE="https://www.opencascade.com"
MY_PN="OCCT"
MY_TEST_PV="7.8.0"
MY_TEST_PV2="${MY_TEST_PV//./_}"
SRC_URI="
test? ( https://github.com/Open-Cascade-SAS/${MY_PN}/releases/download/V${MY_TEST_PV2}/${PN}-dataset-${MY_TEST_PV}.tar.xz )
"
if [[ ${PV} = *9999* ]] ; then
inherit git-r3
EGIT_REPO_URI="https://github.com/Open-Cascade-SAS/${MY_PN}.git"
else
MY_PV="${PV//./_}"
SRC_URI+="
https://github.com/Open-Cascade-SAS/${MY_PN}/archive/refs/tags/V${MY_PV}.tar.gz -> ${P}.tar.gz
"
S="${WORKDIR}/${MY_PN}-${MY_PV}"
KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86"
fi
LICENSE="|| ( Open-CASCADE-LGPL-2.1-Exception-1.0 LGPL-2.1 )"
SLOT="0/$(ver_cut 1-2)"
IUSE="X debug doc examples ffmpeg freeimage freetype gles2-only +gui jemalloc json +opengl optimize tbb test testprograms tk vtk"
REQUIRED_USE="
?? ( optimize tbb )
?? ( opengl gles2-only )
test? ( freeimage json opengl )
"
# There's no easy way to test. Testing needs a rather big environment properly set up.
RESTRICT="!test? ( test )"
# ffmpeg: https://tracker.dev.opencascade.org/view.php?id=32871
RDEPEND="
dev-lang/tcl:=
tk? ( dev-lang/tk:= )
dev-libs/double-conversion
freetype? (
media-libs/fontconfig
media-libs/freetype:2
)
opengl? (
media-libs/libglvnd
)
X? (
x11-libs/libX11
)
gui? (
examples? (
dev-qt/qtcore:5
dev-qt/qtgui:5
dev-qt/qtquickcontrols2:5
dev-qt/qtwidgets:5
dev-qt/qtxml:5
)
)
ffmpeg? ( <media-video/ffmpeg-5:= )
freeimage? ( media-libs/freeimage )
jemalloc? ( dev-libs/jemalloc )
tbb? ( dev-cpp/tbb:= )
vtk? (
sci-libs/vtk:=[rendering]
tbb? (
sci-libs/vtk:=[tbb,-cuda]
)
)
"
DEPEND="
${RDEPEND}
X? ( x11-base/xorg-proto )
json? ( dev-libs/rapidjson )
"
BDEPEND="
doc? ( app-text/doxygen[dot] )
gui? (
examples? ( dev-qt/linguist-tools:5 )
)
test? ( dev-tcltk/thread )
"
PATCHES=(
"${FILESDIR}/${PN}-7.5.1-0005-fix-write-permissions-on-scripts.patch"
"${FILESDIR}/${PN}-7.5.1-0006-fix-creation-of-custom.sh-script.patch"
"${FILESDIR}/${PN}-7.7.0-fix-installation-of-cmake-config-files.patch"
"${FILESDIR}/${PN}-7.7.0-avoid-pre-stripping-binaries.patch"
"${FILESDIR}/${PN}-7.7.0-build-against-vtk-9.2.patch"
"${FILESDIR}/${PN}-7.7.0-musl.patch"
"${FILESDIR}/${PN}-7.7.0-jemalloc-lib-type.patch"
"${FILESDIR}/${PN}-7.8.0-cmake-min-version.patch"
"${FILESDIR}/${PN}-7.8.0-tests.patch"
)
src_unpack() {
if [[ ${PV} = *9999* ]] ; then
git-r3_src_unpack
else
unpack "${P}.tar.gz"
fi
if use test; then
mkdir "${WORKDIR}/data"
pushd "${WORKDIR}/data" > /dev/null || die
# should be in paths indicated by CSF_TestDataPath environment variable,
# or in subfolder data in the script directory
unpack "${PN}-dataset-${MY_TEST_PV}.tar.xz"
popd > /dev/null || die
fi
}
src_prepare() {
cmake_src_prepare
sed -e 's|/lib\$|/'"$(get_libdir)"'\$|' \
-i adm/templates/OpenCASCADEConfig.cmake.in || die
# There is an OCCT_UPDATE_TARGET_FILE cmake macro that fails due to some
# assumptions it makes about installation paths. Rather than fixing it, just
# get rid of the mechanism altogether - its purpose is to allow a
# side-by-side installation of release and debug libraries.
sed -e 's|\\${OCCT_INSTALL_BIN_LETTER}||' \
-i adm/cmake/occt_toolkit.cmake || die
}
src_configure() {
local mycmakeargs=(
-D3RDPARTY_DIR="${ESYSROOT}/usr"
-DBUILD_CPP_STANDARD="C++17"
-DBUILD_SOVERSION_NUMBERS=2
-DBUILD_DOC_Overview="$(usex doc)"
-DBUILD_Inspector="$(usex gui)"
-DBUILD_ENABLE_FPE_SIGNAL_HANDLER="$(usex debug)"
-DBUILD_USE_PCH="no"
# -DBUILD_OPT_PROFILE="Default" # Production
# -DBUILD_RESOURCES="yes"
# -DBUILD_YACCLEX="yes"
-DBUILD_RELEASE_DISABLE_EXCEPTIONS="no" # bug #847916
-DINSTALL_DIR="${EPREFIX}/usr"
-DINSTALL_DIR_BIN="$(get_libdir)/${PN}/bin"
-DINSTALL_DIR_CMAKE="$(get_libdir)/cmake/${PN}"
-DINSTALL_DIR_DATA="share/${PN}/data"
-DINSTALL_DIR_DOC="share/doc/${PF}"
-DINSTALL_DIR_INCLUDE="include/${PN}"
-DINSTALL_DIR_LIB="$(get_libdir)/${PN}"
-DINSTALL_DIR_RESOURCE="share/${PN}/resources"
-DINSTALL_DIR_SAMPLES="share/${PN}/samples"
-DINSTALL_DIR_SCRIPT="$(get_libdir)/${PN}/bin"
-DINSTALL_DIR_TESTS="share/${PN}/tests"
-DINSTALL_DIR_WITH_VERSION="no"
-DINSTALL_SAMPLES="$(usex examples)"
-DINSTALL_TEST_CASES="$(usex testprograms)"
# no package yet in tree
-DUSE_DRACO="no"
-DUSE_FFMPEG="$(usex ffmpeg)"
-DUSE_FREEIMAGE="$(usex freeimage)"
-DUSE_FREETYPE="$(usex freetype)"
# Indicates whether OpenGL ES 2.0 should be used in OCCT visualization module
-DUSE_GLES2="$(usex gles2-only)"
# Indicates whether OpenGL desktop should be used in OCCT visualization module
-DUSE_OPENGL="$(usex opengl)"
# no package in tree
-DUSE_OPENVR="no"
-DUSE_RAPIDJSON="$(usex json)"
-DUSE_TBB="$(usex tbb)"
-DUSE_TK="$(usex tk)"
-DUSE_VTK="$(usex vtk)"
-DUSE_XLIB="$(usex X)"
)
# Select using memory manager tool.
if ! use jemalloc && ! use tbb; then
mycmakeargs+=( -DUSE_MMGR_TYPE=NATIVE )
elif use jemalloc && ! use tbb; then
mycmakeargs+=( -DUSE_MMGR_TYPE=JEMALLOC )
elif ! use jemalloc && use tbb; then
mycmakeargs+=( -DUSE_MMGR_TYPE=TBB )
elif use jemalloc && use tbb; then
mycmakeargs+=( -DUSE_MMGR_TYPE=FLEXIBLE )
fi
if use doc; then
mycmakeargs+=(
-DINSTALL_DOC_Overview="yes"
-D3RDPARTY_SKIP_DOT_EXECUTABLE="no"
)
fi
if use gui; then
mycmakeargs+=(
-D3RDPARTY_QT_DIR="${ESYSROOT}/usr"
-DBUILD_SAMPLES_QT="$(usex examples)"
)
fi
if use jemalloc; then
mycmakeargs+=(
-D3RDPARTY_JEMALLOC_INCLUDE_DIR="${ESYSROOT}/usr/include/jemalloc"
)
fi
if use tbb; then
mycmakeargs+=(
-D3RDPARTY_TBB_DIR="${ESYSROOT}/usr"
)
fi
if use vtk; then
local vtk_ver
vtk_ver="$(best_version "sci-libs/vtk")"
vtk_ver=$(ver_cut 1-2 "${vtk_ver#sci-libs/vtk-}")
mycmakeargs+=(
-D3RDPARTY_VTK_INCLUDE_DIR="${ESYSROOT}/usr/include/vtk-${vtk_ver}"
-D3RDPARTY_VTK_LIBRARY_DIR="${ESYSROOT}/usr/$(get_libdir)"
)
fi
cmake_src_configure
sed -e "s|lib/|$(get_libdir)/|" \
-e "s|VAR_CASROOT|${EPREFIX}/usr|" \
< "${FILESDIR}/${PN}.env.in" > "${T}/99${PN}" || die
# use TBB for memory allocation optimizations
if use tbb; then
sed -e 's|^#MMGT_OPT=0$|MMGT_OPT=2|' -i "${T}/99${PN}" || die
fi
# use internal optimized memory manager and don't clear memory with this
# memory manager.
if use optimize ; then
sed -e 's|^#MMGT_OPT=0$|MMGT_OPT=1|' \
-e 's|^#MMGT_CLEAR=1$|MMGT_CLEAR=0|' \
-i "${T}/99${PN}" || die
fi
}
src_test() {
echo "export CSF_OCCTDataPath=${WORKDIR}/data" >> "${BUILD_DIR}/custom.sh" || die
if has_version media-fonts/dejavu; then
cp "${ESYSROOT}/usr/share/fonts/dejavu/DejaVuSans.ttf" "${WORKDIR}/data/" # no die here as this isn't fatal
fi
local test_file=${T}/testscript.tcl
local draw_opts=(
i # see ${BUILD_DIR}/custom*.sh
# -b # batch mode (no GUI, no viewers)
-v # no GUI, use virtual (off-screen) windows for viewers
)
local test_names=(
"demo draw bug30430" # prone to dying due to cpu limit
)
local test_opts=( # run single tests
-overwrite
)
for test_name in "${test_names[@]}"; do
cat >> "${test_file}" <<- _EOF_ || die
test ${test_name} -outfile "${BUILD_DIR}/test_results/${test_name// /\/}.html" ${test_opts[@]}
_EOF_
done
local testgrid_opts=()
local SKIP_TESTS=()
if [[ "${OCCT_OPTIONAL_TESTS}" != "true" ]]; then
SKIP_TESTS+=(
'blend complex F4'
'bugs'
'geometry circ2d3Tan '{CircleCircleLin_11,CircleLinPoint_11}
'heal checkshape bug32448_1'
'hlr exact_hlr bug25813_2'
'hlr poly_hlr '{bug25813_2,bug25813_3,bug25813_4,Plate}
'lowalgos intss bug'{565,567_1,25950,27431,29807_i1003,29807_i2006,29807_i3003,29807_i5002,30703}
'lowalgos proximity '{A4,A5}
'opengl background bug27836'
'opengl drivers opengles'
'opengles3'
'demo draw bug30430'
)
local DEL_TESTS=(
'opengl/data/background/bug27836'
'perf/mesh/bug26965'
'v3d/trsf/bug26029'
)
for test in "${DEL_TESTS[@]}"; do
rm "${CMAKE_USE_DIR}/tests/${test}" || die
done
fi
if ! use vtk; then
SKIP_TESTS+=(
'vtk'
)
echo "IGNORE /Could not open: libTKIVtkDraw/skip VTK" >> "${CMAKE_USE_DIR}/tests/opengl/parse.rules"
fi
if [[ -n "${SKIP_TESTS[*]}" ]]; then
testgrid_opts+=( -exclude "$(IFS=',' ; echo "${SKIP_TESTS[*]}")" )
fi
testgrid_opts+=(
# -refresh 5
-overwrite
)
cat >> "${test_file}" <<- _EOF_ || die
testgrid -outdir "${BUILD_DIR}/test_results" ${testgrid_opts[@]}
_EOF_
# # regenerate summary in case we have to
# cat >> "${test_file}" <<- _EOF_ || die
# testsummarize "${BUILD_DIR}/test_results"
# _EOF_
# Work around zink warnings
export LIBGL_ALWAYS_SOFTWARE="true"
export CASROOT="${BUILD_DIR}"
virtx \
"${BUILD_DIR}/draw.sh" \
"${draw_opts[@]}" \
-f "${test_file}"
if [[ ! -f "${BUILD_DIR}/test_results/tests.log" ]]; then
eerror "tests never ran!"
die
fi
failed_tests="$(grep ": FAILED" "${BUILD_DIR}/test_results/tests.log")"
if [[ -n ${failed_tests} ]]; then
eerror "Failed tests:"
eerror "${failed_tests}"
die
fi
}
src_install() {
cmake_src_install
doenvd "${T}/99${PN}"
docompress -x "/usr/share/doc/${PF}/overview/html"
}

View File

@@ -0,0 +1,365 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake virtualx
DESCRIPTION="Development platform for CAD/CAE, 3D surface/solid modeling and data exchange"
HOMEPAGE="https://www.opencascade.com"
MY_PN="OCCT"
MY_TEST_PV="7.8.0"
MY_TEST_PV2="${MY_TEST_PV//./_}"
SRC_URI="
test? ( https://github.com/Open-Cascade-SAS/${MY_PN}/releases/download/V${MY_TEST_PV2}/${PN}-dataset-${MY_TEST_PV}.tar.xz )
"
if [[ ${PV} = *9999* ]] ; then
inherit git-r3
EGIT_REPO_URI="https://github.com/Open-Cascade-SAS/${MY_PN}.git"
else
MY_PV="${PV//./_}"
SRC_URI+="
https://github.com/Open-Cascade-SAS/${MY_PN}/archive/refs/tags/V${MY_PV}.tar.gz -> ${P}.tar.gz
"
S="${WORKDIR}/${MY_PN}-${MY_PV}"
KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86"
fi
LICENSE="|| ( Open-CASCADE-LGPL-2.1-Exception-1.0 LGPL-2.1 )"
SLOT="0/$(ver_cut 1-2)"
IUSE="X debug doc examples ffmpeg freeimage freetype gles2-only +gui jemalloc json +opengl optimize tbb test testprograms tk vtk"
REQUIRED_USE="
?? ( optimize tbb )
?? ( opengl gles2-only )
test? ( freeimage json opengl )
"
# There's no easy way to test. Testing needs a rather big environment properly set up.
RESTRICT="!test? ( test )"
# ffmpeg: https://tracker.dev.opencascade.org/view.php?id=32871
RDEPEND="
dev-lang/tcl:=
tk? ( dev-lang/tk:= )
dev-libs/double-conversion
freetype? (
media-libs/fontconfig
media-libs/freetype:2
)
opengl? (
media-libs/libglvnd
)
X? (
x11-libs/libX11
)
gui? (
examples? (
dev-qt/qtcore:5
dev-qt/qtgui:5
dev-qt/qtquickcontrols2:5
dev-qt/qtwidgets:5
dev-qt/qtxml:5
)
)
ffmpeg? ( <media-video/ffmpeg-5:= )
freeimage? ( media-libs/freeimage )
jemalloc? ( dev-libs/jemalloc )
tbb? ( dev-cpp/tbb:= )
vtk? (
sci-libs/vtk:=[rendering]
tbb? (
sci-libs/vtk:=[tbb,-cuda]
)
)
"
DEPEND="
${RDEPEND}
X? ( x11-base/xorg-proto )
json? ( dev-libs/rapidjson )
"
BDEPEND="
doc? ( app-text/doxygen[dot] )
gui? (
examples? ( dev-qt/linguist-tools:5 )
)
test? ( dev-tcltk/thread )
"
PATCHES=(
"${FILESDIR}/${PN}-7.5.1-0005-fix-write-permissions-on-scripts.patch"
"${FILESDIR}/${PN}-7.5.1-0006-fix-creation-of-custom.sh-script.patch"
"${FILESDIR}/${PN}-7.7.0-fix-installation-of-cmake-config-files.patch"
"${FILESDIR}/${PN}-7.7.0-avoid-pre-stripping-binaries.patch"
"${FILESDIR}/${PN}-7.7.0-build-against-vtk-9.2.patch"
"${FILESDIR}/${PN}-7.7.0-musl.patch"
"${FILESDIR}/${PN}-7.7.0-jemalloc-lib-type.patch"
"${FILESDIR}/${PN}-7.8.0-cmake-min-version.patch"
"${FILESDIR}/${PN}-7.8.0-tests.patch"
)
src_unpack() {
if [[ ${PV} = *9999* ]] ; then
git-r3_src_unpack
else
unpack "${P}.tar.gz"
fi
if use test; then
mkdir "${WORKDIR}/data"
pushd "${WORKDIR}/data" > /dev/null || die
# should be in paths indicated by CSF_TestDataPath environment variable,
# or in subfolder data in the script directory
unpack "${PN}-dataset-${MY_TEST_PV}.tar.xz"
popd > /dev/null || die
fi
}
src_prepare() {
cmake_src_prepare
sed -e 's|/lib\$|/'"$(get_libdir)"'\$|' \
-i adm/templates/OpenCASCADEConfig.cmake.in || die
# There is an OCCT_UPDATE_TARGET_FILE cmake macro that fails due to some
# assumptions it makes about installation paths. Rather than fixing it, just
# get rid of the mechanism altogether - its purpose is to allow a
# side-by-side installation of release and debug libraries.
sed -e 's|\\${OCCT_INSTALL_BIN_LETTER}||' \
-i adm/cmake/occt_toolkit.cmake || die
}
src_configure() {
local mycmakeargs=(
-D3RDPARTY_DIR="${ESYSROOT}/usr"
-DBUILD_CPP_STANDARD="C++17"
-DBUILD_SOVERSION_NUMBERS=2
-DBUILD_DOC_Overview="$(usex doc)"
-DBUILD_Inspector="$(usex gui)"
-DBUILD_ENABLE_FPE_SIGNAL_HANDLER="$(usex debug)"
-DBUILD_USE_PCH="no"
# -DBUILD_OPT_PROFILE="Default" # Production
# -DBUILD_RESOURCES="yes"
# -DBUILD_YACCLEX="yes"
-DBUILD_RELEASE_DISABLE_EXCEPTIONS="no" # bug #847916
-DINSTALL_DIR="${EPREFIX}/usr"
-DINSTALL_DIR_BIN="$(get_libdir)/${PN}/bin"
-DINSTALL_DIR_CMAKE="$(get_libdir)/cmake/${PN}"
-DINSTALL_DIR_DATA="share/${PN}/data"
-DINSTALL_DIR_DOC="share/doc/${PF}"
-DINSTALL_DIR_INCLUDE="include/${PN}"
-DINSTALL_DIR_LIB="$(get_libdir)/${PN}"
-DINSTALL_DIR_RESOURCE="share/${PN}/resources"
-DINSTALL_DIR_SAMPLES="share/${PN}/samples"
-DINSTALL_DIR_SCRIPT="$(get_libdir)/${PN}/bin"
-DINSTALL_DIR_TESTS="share/${PN}/tests"
-DINSTALL_DIR_WITH_VERSION="no"
-DINSTALL_SAMPLES="$(usex examples)"
-DINSTALL_TEST_CASES="$(usex testprograms)"
# no package yet in tree
-DUSE_DRACO="no"
-DUSE_FFMPEG="$(usex ffmpeg)"
-DUSE_FREEIMAGE="$(usex freeimage)"
-DUSE_FREETYPE="$(usex freetype)"
# Indicates whether OpenGL ES 2.0 should be used in OCCT visualization module
-DUSE_GLES2="$(usex gles2-only)"
# Indicates whether OpenGL desktop should be used in OCCT visualization module
-DUSE_OPENGL="$(usex opengl)"
# no package in tree
-DUSE_OPENVR="no"
-DUSE_RAPIDJSON="$(usex json)"
-DUSE_TBB="$(usex tbb)"
-DUSE_TK="$(usex tk)"
-DUSE_VTK="$(usex vtk)"
-DUSE_XLIB="$(usex X)"
)
# Select using memory manager tool.
if ! use jemalloc && ! use tbb; then
mycmakeargs+=( -DUSE_MMGR_TYPE=NATIVE )
elif use jemalloc && ! use tbb; then
mycmakeargs+=( -DUSE_MMGR_TYPE=JEMALLOC )
elif ! use jemalloc && use tbb; then
mycmakeargs+=( -DUSE_MMGR_TYPE=TBB )
elif use jemalloc && use tbb; then
mycmakeargs+=( -DUSE_MMGR_TYPE=FLEXIBLE )
fi
if use doc; then
mycmakeargs+=(
-DINSTALL_DOC_Overview="yes"
-D3RDPARTY_SKIP_DOT_EXECUTABLE="no"
)
fi
if use gui; then
mycmakeargs+=(
-D3RDPARTY_QT_DIR="${ESYSROOT}/usr"
-DBUILD_SAMPLES_QT="$(usex examples)"
)
fi
if use jemalloc; then
mycmakeargs+=(
-D3RDPARTY_JEMALLOC_INCLUDE_DIR="${ESYSROOT}/usr/include/jemalloc"
)
fi
if use tbb; then
mycmakeargs+=(
-D3RDPARTY_TBB_DIR="${ESYSROOT}/usr"
)
fi
if use vtk; then
local vtk_ver
vtk_ver="$(best_version "sci-libs/vtk")"
vtk_ver=$(ver_cut 1-2 "${vtk_ver#sci-libs/vtk-}")
mycmakeargs+=(
-D3RDPARTY_VTK_INCLUDE_DIR="${ESYSROOT}/usr/include/vtk-${vtk_ver}"
-D3RDPARTY_VTK_LIBRARY_DIR="${ESYSROOT}/usr/$(get_libdir)"
)
fi
cmake_src_configure
sed -e "s|lib/|$(get_libdir)/|" \
-e "s|VAR_CASROOT|${EPREFIX}/usr|" \
< "${FILESDIR}/${PN}.env.in" > "${T}/99${PN}" || die
# use TBB for memory allocation optimizations
if use tbb; then
sed -e 's|^#MMGT_OPT=0$|MMGT_OPT=2|' -i "${T}/99${PN}" || die
fi
# use internal optimized memory manager and don't clear memory with this
# memory manager.
if use optimize ; then
sed -e 's|^#MMGT_OPT=0$|MMGT_OPT=1|' \
-e 's|^#MMGT_CLEAR=1$|MMGT_CLEAR=0|' \
-i "${T}/99${PN}" || die
fi
}
src_test() {
echo "export CSF_OCCTDataPath=${WORKDIR}/data" >> "${BUILD_DIR}/custom.sh" || die
if has_version media-fonts/dejavu; then
cp "${ESYSROOT}/usr/share/fonts/dejavu/DejaVuSans.ttf" "${WORKDIR}/data/" # no die here as this isn't fatal
fi
local test_file=${T}/testscript.tcl
local draw_opts=(
i # see ${BUILD_DIR}/custom*.sh
# -b # batch mode (no GUI, no viewers)
-v # no GUI, use virtual (off-screen) windows for viewers
)
local test_names=(
"demo draw bug30430" # prone to dying due to cpu limit
)
local test_opts=( # run single tests
-overwrite
)
for test_name in "${test_names[@]}"; do
cat >> "${test_file}" <<- _EOF_ || die
test ${test_name} -outfile "${BUILD_DIR}/test_results/${test_name// /\/}.html" ${test_opts[@]}
_EOF_
done
local testgrid_opts=()
local SKIP_TESTS=()
if [[ "${OCCT_OPTIONAL_TESTS}" != "true" ]]; then
SKIP_TESTS+=(
'blend complex F4'
'bugs'
'geometry circ2d3Tan '{CircleCircleLin_11,CircleLinPoint_11}
'heal checkshape bug32448_1'
'hlr exact_hlr bug25813_2'
'hlr poly_hlr '{bug25813_2,bug25813_3,bug25813_4,Plate}
'lowalgos intss bug'{565,567_1,25950,27431,29807_i1003,29807_i2006,29807_i3003,29807_i5002,30703}
'lowalgos proximity '{A4,A5}
'opengl background bug27836'
'opengl drivers opengles'
'opengles3'
'demo draw bug30430'
)
local DEL_TESTS=(
'opengl/data/background/bug27836'
'perf/mesh/bug26965'
'v3d/trsf/bug26029'
)
for test in "${DEL_TESTS[@]}"; do
rm "${CMAKE_USE_DIR}/tests/${test}" || die
done
fi
if ! use vtk; then
SKIP_TESTS+=(
'vtk'
)
echo "IGNORE /Could not open: libTKIVtkDraw/skip VTK" >> "${CMAKE_USE_DIR}/tests/opengl/parse.rules"
fi
if [[ -n "${SKIP_TESTS[*]}" ]]; then
testgrid_opts+=( -exclude "$(IFS=',' ; echo "${SKIP_TESTS[*]}")" )
fi
testgrid_opts+=(
# -refresh 5
-overwrite
)
cat >> "${test_file}" <<- _EOF_ || die
testgrid -outdir "${BUILD_DIR}/test_results" ${testgrid_opts[@]}
_EOF_
# # regenerate summary in case we have to
# cat >> "${test_file}" <<- _EOF_ || die
# testsummarize "${BUILD_DIR}/test_results"
# _EOF_
# Work around zink warnings
export LIBGL_ALWAYS_SOFTWARE="true"
export CASROOT="${BUILD_DIR}"
virtx \
"${BUILD_DIR}/draw.sh" \
"${draw_opts[@]}" \
-f "${test_file}"
if [[ ! -f "${BUILD_DIR}/test_results/tests.log" ]]; then
eerror "tests never ran!"
die
fi
failed_tests="$(grep ": FAILED" "${BUILD_DIR}/test_results/tests.log")"
if [[ -n ${failed_tests} ]]; then
eerror "Failed tests:"
eerror "${failed_tests}"
die
fi
}
src_install() {
cmake_src_install
doenvd "${T}/99${PN}"
docompress -x "/usr/share/doc/${PF}/overview/html"
}