commit: 9cea95ba389362e85935d32bb5a027993531d698 Author: leycec <leycec <AT> gmail <DOT> com> AuthorDate: Tue Aug 3 04:41:46 2021 +0000 Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org> CommitDate: Thu Aug 5 16:56:23 2021 +0000 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=9cea95ba
dev-python/cadquery-ocp: relax OCCT requirement build CadQuery OCP against any OCCT 7.5.x version rather than just 7.5.2 by rebuilding its internal OCCT symbol table with LIEF Signed-off-by: Cecil Curry <leycec <AT> gmail.com> Closes: https://github.com/gentoo/sci/pull/1103 Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org> .../cadquery-ocp/cadquery-ocp-7.5.2_beta.ebuild | 36 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/dev-python/cadquery-ocp/cadquery-ocp-7.5.2_beta.ebuild b/dev-python/cadquery-ocp/cadquery-ocp-7.5.2_beta.ebuild index 57e223c07..9bed84595 100644 --- a/dev-python/cadquery-ocp/cadquery-ocp-7.5.2_beta.ebuild +++ b/dev-python/cadquery-ocp/cadquery-ocp-7.5.2_beta.ebuild @@ -23,11 +23,16 @@ SLOT="0" REQUIRED_USE="${PYTHON_REQUIRED_USE}" # CMake and VTK requirements derive from the "OCP/CMakeLists.txt" file -# generated by the src_prepare() phase. -BDEPEND=">=dev-util/cmake-3.16" +# generated by the src_prepare() phase. OCP currently requires opencascade +# (OCCT) to be built with "-DUSE_GLES2=OFF" and thus "-gles2". See also: +# https://github.com/CadQuery/OCP/issues/46#issuecomment-808920994 +BDEPEND=" + >=dev-libs/lief-0.11.5[python] + >=dev-util/cmake-3.16 +" RDEPEND=" ${PYTHON_DEPS} - ~sci-libs/opencascade-${OCCT_PV}[json,tbb,vtk] + sci-libs/opencascade:7.5=[json,tbb,vtk,-gles2] >=sci-libs/vtk-9.0.0[python,${PYTHON_SINGLE_USEDEP}] " DEPEND="${RDEPEND} @@ -37,7 +42,7 @@ DEPEND="${RDEPEND} S="${WORKDIR}/${MY_P}" -# Explicitly set ${BUILD_DIR} to avoid eclass conflicts. +# The source "OCP/CMakeLists.txt" file is output by "bindgen" in src_prepare(). CMAKE_IN_SOURCE_BUILD=True # Ensure the path returned by get_llvm_prefix() contains clang. @@ -83,6 +88,11 @@ src_prepare() { local _OCCT_INCLUDE_DIR="${EPREFIX}/usr/include/opencascade-${OCCT_PV}" local _OCCT_LIB_DIR="${EPREFIX}/usr/lib64/opencascade-${OCCT_PV}" + # Absolute dirname of a temporary directory to store symbol tables for this + # OCCT version dumped below by the "dump_symbols.py" script. + local _OCCT_DUMP_SYMBOLS_ROOT_DIR="${T}/dump_symbols" + local _OCCT_DUMP_SYMBOLS_DIR="${_OCCT_DUMP_SYMBOLS_ROOT_DIR}/lib_linux" + # Absolute dirname of VTK's include directory, local _VTK_INCLUDE_DIR="${EPREFIX}/usr/include/vtk-${_VTK_VERSION}" @@ -100,13 +110,27 @@ src_prepare() { has_version -r "=${_CLANG_PYTHON_ATOM}" || die "${_CLANG_PYTHON_ATOM} not installed." - # Remove all vendored subdirectories. - rm -r conda opencascade pywrap || die + # Remove all vendored paths. + rm -r conda opencascade pywrap *.dat || die # Inject a symlink to OCCT's include directory. ln -s "${_OCCT_INCLUDE_DIR}" opencascade || die + # Inject a symlink from OCCT's shared library directory into this temporary + # directory as required by the "dump_symbols.py" script. + mkdir -p "${_OCCT_DUMP_SYMBOLS_DIR}" || die + ln -s "${_OCCT_LIB_DIR}" "${_OCCT_DUMP_SYMBOLS_DIR}"/. || die + + # Update all hardcoded OCCT shared library versions in "dump_symbols.py". + sed -i -e 's~\(\.so\.\)[0-9]\+.[0-9]\+.[0-9]\+~\1'${OCCT_PV}'~' \ + dump_symbols.py || die + + # Dump (i.e., generate) symbol tables for this OCCT version. + einfo 'Dumping OCCT symbol tables...' + ${EPYTHON} dump_symbols.py "${_OCCT_DUMP_SYMBOLS_ROOT_DIR}" || die + # Generate OCCT bindings in the "OCP/" subdirectory. + einfo 'Building OCP CMake binary tree...' ${EPYTHON} -m bindgen \ --verbose \ --njobs $(makeopts_jobs) \
