git: 4f80881f6058 - main - cad/kicad: attempt to fix 3D-Viewer by using bundled GLEW
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 07 May 2022 15:30:48 UTC
The branch main has been updated by cmt:
URL: https://cgit.FreeBSD.org/ports/commit/?id=4f80881f60588b2d02541647ceb7d635928faac9
commit 4f80881f60588b2d02541647ceb7d635928faac9
Author: Christoph Moench-Tegeder <cmt@FreeBSD.org>
AuthorDate: 2022-05-07 15:29:23 +0000
Commit: Christoph Moench-Tegeder <cmt@FreeBSD.org>
CommitDate: 2022-05-07 15:29:23 +0000
cad/kicad: attempt to fix 3D-Viewer by using bundled GLEW
The 3D-Viewer (e.g. from the Footprint Editor) may fail to start
with an "Unknown error" message. Investigation indicates that
kicad really needs it's bundles libGLEW, using the system one
was a mistake.
While here, fix a possible nullpointer dereference in the 3D cache
destructor - this is only relevant when the 3D viewer fails unexpectedly,
but then it is quite annoying during debugging.
PR: 262802
Reported by: Tomasz "CeDeROM" CEDRO
---
cad/kicad/Makefile | 5 +++--
cad/kicad/files/patch-3d-viewer_3d__cache_3d__cache.cpp | 12 ++++++++++++
cad/kicad/files/patch-thirdparty_glew_CMakeLists.txt | 10 ++++++++++
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/cad/kicad/Makefile b/cad/kicad/Makefile
index 5ef818579d2a..028c5aa600fc 100644
--- a/cad/kicad/Makefile
+++ b/cad/kicad/Makefile
@@ -2,6 +2,7 @@
PORTNAME= kicad
PORTVERSION= 6.0.5
+PORTREVISION= 1
PORTEPOCH= 2
CATEGORIES= cad
MASTER_SITES= https://gitlab.com/${PORTNAME}/code/${PORTNAME}/-/archive/${DISTVERSION}/
@@ -30,7 +31,7 @@ USES= cmake:noninja compiler:c++11-lib desktop-file-utils gl \
SHEBANG_FILES= pcbnew/python/plugins/touch_slider_wizard.py
USE_XORG= ice x11 xext
-USE_GL= gl glew glu glut
+USE_GL= gl glu glut
USE_WX= 3.1
WX_COMPS= python:lib wx
USE_GNOME= atk cairo gdkpixbuf2 gtk30 pango
@@ -41,7 +42,7 @@ CMAKE_ARGS= -DwxWidgets_CONFIG_EXECUTABLE=${WX_CONFIG} \
-DKICAD_SCRIPTING_WXPYTHON=ON \
-DKICAD_USE_OCC=ON \
-DKICAD_USE_EGL=ON \
- -DKICAD_USE_BUNDLED_GLEW=OFF \
+ -DKICAD_USE_BUNDLED_GLEW=ON \
-DOCC_INCLUDE_DIR=${LOCALBASE}/include/OpenCASCADE
USE_LDCONFIG= yes
diff --git a/cad/kicad/files/patch-3d-viewer_3d__cache_3d__cache.cpp b/cad/kicad/files/patch-3d-viewer_3d__cache_3d__cache.cpp
new file mode 100644
index 000000000000..d33fb5620970
--- /dev/null
+++ b/cad/kicad/files/patch-3d-viewer_3d__cache_3d__cache.cpp
@@ -0,0 +1,12 @@
+--- 3d-viewer/3d_cache/3d_cache.cpp.orig 2022-05-06 18:57:13 +0200
++++ 3d-viewer/3d_cache/3d_cache.cpp
+@@ -199,7 +199,8 @@
+ FlushCache();
+
+ // We'll delete ".3dc" cache files older than this many days
+- int clearCacheInterval = commonSettings->m_System.clear_3d_cache_interval;
++ int clearCacheInterval = 0;
++ if(commonSettings) clearCacheInterval = commonSettings->m_System.clear_3d_cache_interval;
+
+ // An interval of zero means the user doesn't want to ever clear the cache
+
diff --git a/cad/kicad/files/patch-thirdparty_glew_CMakeLists.txt b/cad/kicad/files/patch-thirdparty_glew_CMakeLists.txt
new file mode 100644
index 000000000000..18c5a496dd6c
--- /dev/null
+++ b/cad/kicad/files/patch-thirdparty_glew_CMakeLists.txt
@@ -0,0 +1,10 @@
+--- thirdparty/glew/CMakeLists.txt.orig 2022-05-07 15:44:23 +0200
++++ thirdparty/glew/CMakeLists.txt
+@@ -5,6 +5,7 @@
+ # The actual include directories will be added to the global include paths as
+ # system headers
+ target_include_directories( glew PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" )
++target_include_directories( glew SYSTEM PRIVATE "${CMAKE_INSTALL_PREFIX}/include" )
+
+ # Definitions for compiling GLEW staticly for EGL (extracted from the main GLEW CMakeLists.txt file)
+ add_definitions( -DGLEW_STATIC )