diff options
author | Paul Zander <negril.nx+gentoo@gmail.com> | 2024-11-16 18:21:47 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-11-16 21:39:08 +0000 |
commit | d5515a801258b39900cb36fe6090c9085518ef8c (patch) | |
tree | 4f6808573530816d92a30ed4e55b4dd4ee45578d /media-gfx/openscad | |
parent | sci-mathematics/clipper2: update ebuild, add tests (diff) | |
download | gentoo-d5515a801258b39900cb36fe6090c9085518ef8c.tar.gz gentoo-d5515a801258b39900cb36fe6090c9085518ef8c.tar.bz2 gentoo-d5515a801258b39900cb36fe6090c9085518ef8c.zip |
media-gfx/openscad: 20241114 enable tests
Drop USE=gamepad as 9999 no longer supports qt5
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'media-gfx/openscad')
-rw-r--r-- | media-gfx/openscad/metadata.xml | 3 | ||||
-rw-r--r-- | media-gfx/openscad/openscad-20241114.ebuild | 125 | ||||
-rw-r--r-- | media-gfx/openscad/openscad-9999.ebuild | 213 |
3 files changed, 256 insertions, 85 deletions
diff --git a/media-gfx/openscad/metadata.xml b/media-gfx/openscad/metadata.xml index ac47d0a9f5d3..65b56ea5a6ce 100644 --- a/media-gfx/openscad/metadata.xml +++ b/media-gfx/openscad/metadata.xml @@ -27,9 +27,6 @@ <flag name="experimental"> Enable experimental features </flag> - <flag name="gamepad"> - Add support for gamepads through <pkg>dev-qt/qtgamepad</pkg> - </flag> <flag name="glx"> Enable GLX to interface OpenGL and X11 </flag> diff --git a/media-gfx/openscad/openscad-20241114.ebuild b/media-gfx/openscad/openscad-20241114.ebuild index ec08be8aa0b5..238288a09864 100644 --- a/media-gfx/openscad/openscad-20241114.ebuild +++ b/media-gfx/openscad/openscad-20241114.ebuild @@ -3,34 +3,46 @@ EAPI=8 -inherit cmake flag-o-matic multiprocessing optfeature virtualx xdg - -COMMIT="bc0d078e0361d7dba66723ac31bdb3b650ecff37" -SANITIZERS_CMAKE_COMMIT="3f0542e4e034aab417c51b2b22c94f83355dee15" -MCAD_COMMIT="bd0a7ba3f042bfbced5ca1894b236cea08904e26" +inherit cmake flag-o-matic optfeature virtualx xdg DESCRIPTION="The Programmers Solid 3D CAD Modeller" HOMEPAGE="https://openscad.org/" -SRC_URI=" - https://github.com/openscad/openscad/archive/${COMMIT}.tar.gz - -> ${P}.tar.gz - https://github.com/arsenm/sanitizers-cmake/archive/${SANITIZERS_CMAKE_COMMIT}.tar.gz - -> sanitizers-cmake-${SANITIZERS_CMAKE_COMMIT}.tar.gz - test? ( - https://github.com/openscad/MCAD/archive/${MCAD_COMMIT}.tar.gz -> ${PN}-MCAD-${MCAD_COMMIT}.tar.gz + +if [[ ${PV} = *9999* ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/openscad/openscad.git" + EGIT_SUBMODULES=( + '*' + '-mimalloc' + '-submodules/manifold' + '-OpenCSG' ) -" -# doc downloads are not versioned and found at: -# https://files.openscad.org/documentation/ -S="${WORKDIR}/${PN}-${COMMIT}" +else + COMMIT="bc0d078e0361d7dba66723ac31bdb3b650ecff37" + SANITIZERS_CMAKE_COMMIT="3f0542e4e034aab417c51b2b22c94f83355dee15" + MCAD_COMMIT="bd0a7ba3f042bfbced5ca1894b236cea08904e26" + + SRC_URI=" + https://github.com/openscad/openscad/archive/${COMMIT}.tar.gz + -> ${P}.tar.gz + https://github.com/arsenm/sanitizers-cmake/archive/${SANITIZERS_CMAKE_COMMIT}.tar.gz + -> sanitizers-cmake-${SANITIZERS_CMAKE_COMMIT}.tar.gz + test? ( + https://github.com/openscad/MCAD/archive/${MCAD_COMMIT}.tar.gz -> ${PN}-MCAD-${MCAD_COMMIT}.tar.gz + ) + " + # doc downloads are not versioned and found at: + # https://files.openscad.org/documentation/ + S="${WORKDIR}/${PN}-${COMMIT}" + KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86" +fi # Code is GPL-3+, MCAD library is LGPL-2.1 LICENSE="GPL-3+ LGPL-2.1" SLOT="0" -KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86" IUSE="dbus +egl experimental glx +gui hidapi +manifold mimalloc pdf spacenav test" -RESTRICT="test" # many tests fail +RESTRICT="!test? ( test )" REQUIRED_USE=" dbus? ( gui ) @@ -91,7 +103,7 @@ DOCS=( ) src_prepare() { - if use test; then + if use test && [[ ${PV} != *9999* ]] ; then mv -f "${WORKDIR}/MCAD-${MCAD_COMMIT}"/* "${S}/libraries/MCAD/" || die fi @@ -110,11 +122,6 @@ src_configure() { filter-lto local mycmakeargs=( - -DCMAKE_MODULE_PATH="${WORKDIR}/sanitizers-cmake-${SANITIZERS_CMAKE_COMMIT}/cmake" - - -DOPENSCAD_COMMIT="${COMMIT:0:9}" - -DOPENSCAD_VERSION="${PV:0:4}.${PV:4:2}.${PV:6:2}" - -DCLANG_TIDY="no" -DENABLE_CAIRO="$(usex pdf)" -DENABLE_CGAL="yes" @@ -145,14 +152,76 @@ src_configure() { ) fi + if [[ ${PV} != *9999* ]] ; then + mycmakeargs+=( + -DCMAKE_MODULE_PATH="${WORKDIR}/sanitizers-cmake-${SANITIZERS_CMAKE_COMMIT}/cmake" + -DOPENSCAD_COMMIT="${COMMIT:0:9}" + -DOPENSCAD_VERSION="${PV:0:4}.${PV:4:2}.${PV:6:2}" + ) + fi + cmake_src_configure } src_test() { - xdg_environment_reset - pushd "${BUILD_DIR}" > /dev/null || die - virtx ctest -j "$(makeopts_jobs "${MAKEOPTS}" 999)" - popd > /dev/null || die + local i WRITE=() + + if [[ -d "/dev/udmabuf" ]]; then + WRITE+=( + "/dev/udmabuf" + ) + fi + + if [[ -d /sys/module/nvidia ]]; then + # /dev/dri/card* + # /dev/dri/renderD* + readarray -t dri <<<"$( + find /sys/module/nvidia/drivers/*/*:*:*.*/drm \ + -mindepth 1 -maxdepth 1 -type d -exec basename {} \; \ + | sed 's:^:/dev/dri/:' + )" + + # /dev/nvidia{0-9} + readarray -t cards <<<"$(find /dev -regextype sed -regex '/dev/nvidia[0-9]*')" + + WRITE+=( + "${dri[@]}" + "${cards[@]}" + "/dev/nvidiactl" + "/dev/nvidia-caps/" + "/dev/nvidia-modeset" + "/dev/nvidia-uvm" + "/dev/nvidia-uvm-tools" + ) + fi + + WRITE+=( + # for portage + "/proc/self/task/" + ) + for i in "${WRITE[@]}"; do + if [[ ! -w "$i" ]]; then + eqawarn "addwrite $i" + addwrite "$i" + + if [[ ! -d "$i" ]] && [[ ! -w "$i" ]]; then + eqawarn "can not access $i after addwrite" + fi + fi + done + + sed \ + -e "s/OPENSCAD_BINARY/OPENSCADPATH/g" \ + -i tests/test_cmdline_tool.py || die + + cd "${BUILD_DIR}" || die + + # NOTE link in from CMAKE_USE_DIR + ln -s "${CMAKE_USE_DIR}/color-schemes" . || die + ln -s "${CMAKE_USE_DIR}/locale" . || die + ln -s "${CMAKE_USE_DIR}/shaders" . || die + + virtx cmake_src_test -j1 } src_install() { diff --git a/media-gfx/openscad/openscad-9999.ebuild b/media-gfx/openscad/openscad-9999.ebuild index 4cfaae64dfac..238288a09864 100644 --- a/media-gfx/openscad/openscad-9999.ebuild +++ b/media-gfx/openscad/openscad-9999.ebuild @@ -1,35 +1,57 @@ # Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -# TODO's -# package and unbundle manifold -# set up proper testing -# set up OFFLINE_DOCS and add doc USE flag - EAPI=8 -inherit cmake flag-o-matic git-r3 optfeature xdg +inherit cmake flag-o-matic optfeature virtualx xdg DESCRIPTION="The Programmers Solid 3D CAD Modeller" HOMEPAGE="https://openscad.org/" -SRC_URI="" -EGIT_REPO_URI="https://github.com/openscad/openscad.git" + +if [[ ${PV} = *9999* ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/openscad/openscad.git" + EGIT_SUBMODULES=( + '*' + '-mimalloc' + '-submodules/manifold' + '-OpenCSG' + ) +else + COMMIT="bc0d078e0361d7dba66723ac31bdb3b650ecff37" + SANITIZERS_CMAKE_COMMIT="3f0542e4e034aab417c51b2b22c94f83355dee15" + MCAD_COMMIT="bd0a7ba3f042bfbced5ca1894b236cea08904e26" + + SRC_URI=" + https://github.com/openscad/openscad/archive/${COMMIT}.tar.gz + -> ${P}.tar.gz + https://github.com/arsenm/sanitizers-cmake/archive/${SANITIZERS_CMAKE_COMMIT}.tar.gz + -> sanitizers-cmake-${SANITIZERS_CMAKE_COMMIT}.tar.gz + test? ( + https://github.com/openscad/MCAD/archive/${MCAD_COMMIT}.tar.gz -> ${PN}-MCAD-${MCAD_COMMIT}.tar.gz + ) + " + # doc downloads are not versioned and found at: + # https://files.openscad.org/documentation/ + S="${WORKDIR}/${PN}-${COMMIT}" + KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86" +fi # Code is GPL-3+, MCAD library is LGPL-2.1 LICENSE="GPL-3+ LGPL-2.1" SLOT="0" -KEYWORDS="" -IUSE="cairo dbus egl experimental gamepad gui hidapi mimalloc spacenav" -RESTRICT="test" # 32 out 1300+ tests fail + +IUSE="dbus +egl experimental glx +gui hidapi +manifold mimalloc pdf spacenav test" +RESTRICT="!test? ( test )" REQUIRED_USE=" dbus? ( gui ) - gamepad? ( gui ) + hidapi? ( gui ) spacenav? ( gui ) + || ( egl glx ) " RDEPEND=" - dev-cpp/eigen:3 dev-libs/boost:= dev-libs/double-conversion:= dev-libs/glib:2 @@ -38,35 +60,34 @@ RDEPEND=" media-gfx/opencsg:= media-libs/fontconfig media-libs/freetype - media-libs/glew:0= media-libs/harfbuzz:= media-libs/lib3mf:= sci-mathematics/cgal:= - virtual/opengl - cairo? ( x11-libs/cairo ) + media-libs/libglvnd[X] gui? ( - dev-qt/qtconcurrent:5 - dev-qt/qtcore:5 - dev-qt/qtgui:5[-gles2-only] - dev-qt/qtmultimedia:5 - dev-qt/qtnetwork:5 - dev-qt/qtopengl:5 - dev-qt/qtsvg:5 - dev-qt/qtwidgets:5 - x11-libs/libX11 - x11-libs/qscintilla:=[qt5(+)] - dbus? ( dev-qt/qtdbus:5 ) - gamepad? ( dev-qt/qtgamepad:5 ) + dev-qt/qt5compat:6 + dev-qt/qtbase:6[concurrent,dbus?,-gles2-only,network,opengl,widgets] + dev-qt/qtmultimedia:6 + dev-qt/qtsvg:6 + x11-libs/qscintilla:=[qt6] ) hidapi? ( dev-libs/hidapi ) + manifold? ( + dev-cpp/tbb + sci-mathematics/manifold + ) mimalloc? ( dev-libs/mimalloc:= ) + pdf? ( x11-libs/cairo ) spacenav? ( dev-libs/libspnav ) " -DEPEND="${RDEPEND}" +DEPEND=" + ${RDEPEND} + dev-cpp/eigen:3 +" BDEPEND=" - dev-util/itstool app-alternatives/yacc app-alternatives/lex + dev-util/itstool sys-devel/gettext virtual/pkgconfig " @@ -81,39 +102,131 @@ DOCS=( doc/translation.txt ) +src_prepare() { + if use test && [[ ${PV} != *9999* ]] ; then + mv -f "${WORKDIR}/MCAD-${MCAD_COMMIT}"/* "${S}/libraries/MCAD/" || die + fi + + # NOTE adhere CMP0167 + # https://cmake.org/cmake/help/latest/policy/CMP0167.html + sed \ + -e '/find_package(Boost/s/)/ CONFIG)/g' \ + -i CMakeLists.txt || die + + cmake_src_prepare +} + src_configure() { # -Werror=odr # https://github.com/openscad/openscad/issues/5239 filter-lto local mycmakeargs=( - -DCLANG_TIDY=OFF - -DENABLE_CAIRO=$(usex cairo) - -DENABLE_EGL=$(usex egl) - -DENABLE_HIDAPI=$(usex hidapi) - # needs python deps, unbundle first before enabling - -DENABLE_MANIFOLD=OFF - -DENABLE_SPNAV=$(usex spacenav) - -DENABLE_TESTS=OFF - -DEXPERIMENTAL=$(usex experimental) - -DHEADLESS=$(usex gui OFF ON) - -DOFFLINE_DOCS=OFF - -DUSE_CCACHE=OFF - -DUSE_MIMALLOC=$(usex mimalloc) + -DCLANG_TIDY="no" + -DENABLE_CAIRO="$(usex pdf)" + -DENABLE_CGAL="yes" + -DENABLE_EGL="$(usex egl)" + -DENABLE_GLX="$(usex glx)" + -DENABLE_MANIFOLD="$(usex manifold)" + -DENABLE_PYTHON="no" + -DENABLE_TESTS="$(usex test)" + + -DEXPERIMENTAL="$(usex experimental)" + + -DHEADLESS="$(usex !gui)" + -DUSE_BUILTIN_MANIFOLD="no" + -DUSE_CCACHE="no" + -DUSE_GLAD="yes" + -DUSE_GLEW="no" + -DUSE_LEGACY_RENDERERS="no" + -DUSE_MIMALLOC="$(usex mimalloc)" + -DUSE_QT6="$(usex gui)" + -DOFFLINE_DOCS="no" # TODO ) if use gui; then mycmakeargs+=( - -DENABLE_GAMEPAD=$(usex gamepad) - -DENABLE_QTDBUS=$(usex dbus) + -DENABLE_HIDAPI="$(usex hidapi)" + -DENABLE_QTDBUS="$(usex dbus)" + -DENABLE_SPNAV="$(usex spacenav)" + ) + fi + + if [[ ${PV} != *9999* ]] ; then + mycmakeargs+=( + -DCMAKE_MODULE_PATH="${WORKDIR}/sanitizers-cmake-${SANITIZERS_CMAKE_COMMIT}/cmake" + -DOPENSCAD_COMMIT="${COMMIT:0:9}" + -DOPENSCAD_VERSION="${PV:0:4}.${PV:4:2}.${PV:6:2}" ) fi cmake_src_configure } +src_test() { + local i WRITE=() + + if [[ -d "/dev/udmabuf" ]]; then + WRITE+=( + "/dev/udmabuf" + ) + fi + + if [[ -d /sys/module/nvidia ]]; then + # /dev/dri/card* + # /dev/dri/renderD* + readarray -t dri <<<"$( + find /sys/module/nvidia/drivers/*/*:*:*.*/drm \ + -mindepth 1 -maxdepth 1 -type d -exec basename {} \; \ + | sed 's:^:/dev/dri/:' + )" + + # /dev/nvidia{0-9} + readarray -t cards <<<"$(find /dev -regextype sed -regex '/dev/nvidia[0-9]*')" + + WRITE+=( + "${dri[@]}" + "${cards[@]}" + "/dev/nvidiactl" + "/dev/nvidia-caps/" + "/dev/nvidia-modeset" + "/dev/nvidia-uvm" + "/dev/nvidia-uvm-tools" + ) + fi + + WRITE+=( + # for portage + "/proc/self/task/" + ) + for i in "${WRITE[@]}"; do + if [[ ! -w "$i" ]]; then + eqawarn "addwrite $i" + addwrite "$i" + + if [[ ! -d "$i" ]] && [[ ! -w "$i" ]]; then + eqawarn "can not access $i after addwrite" + fi + fi + done + + sed \ + -e "s/OPENSCAD_BINARY/OPENSCADPATH/g" \ + -i tests/test_cmdline_tool.py || die + + cd "${BUILD_DIR}" || die + + # NOTE link in from CMAKE_USE_DIR + ln -s "${CMAKE_USE_DIR}/color-schemes" . || die + ln -s "${CMAKE_USE_DIR}/locale" . || die + ln -s "${CMAKE_USE_DIR}/shaders" . || die + + virtx cmake_src_test -j1 +} + src_install() { DOCS+=( doc/*.pdf ) + cmake_src_install mv -i "${ED}"/usr/share/openscad/locale "${ED}"/usr/share || die "failed to move locales" @@ -121,15 +234,7 @@ src_install() { } pkg_postinst() { - xdg_desktop_database_update - xdg_icon_cache_update - xdg_mimeinfo_database_update + xdg_pkg_postinst optfeature "support scad major mode in GNU Emacs" app-emacs/scad-mode } - -pkg_postrm() { - xdg_desktop_database_update - xdg_icon_cache_update - xdg_mimeinfo_database_update -} |