git: 67189e73e058 - 2022Q2 - x11-toolkits/nanogui: Fix several issues

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 19 Apr 2022 06:14:14 UTC
The branch 2022Q2 has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=67189e73e0583d8aa367298e20a9a26e90e066ed

commit 67189e73e0583d8aa367298e20a9a26e90e066ed
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-04-10 20:30:52 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-04-19 06:14:12 +0000

    x11-toolkits/nanogui: Fix several issues
    
    * nanogui doesn't depend on Eigen any more
    * use external glfw package
    * for Python, __init__.py is installed
    * for tests, zenity executable is installed
    
    PR:             263194
    Original patch submitted by:    Hiroo Ono <hiroo.ono+freebsd@gmail.com>
    
    (cherry picked from commit 563c4a8cd859eeb4657a6d54730d65bde1541d36)
---
 x11-toolkits/nanogui/Makefile                   | 19 ++++++++++---------
 x11-toolkits/nanogui/files/patch-CMakeLists.txt | 25 +++++++++++++++++++++++--
 x11-toolkits/nanogui/pkg-plist                  |  3 ++-
 3 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/x11-toolkits/nanogui/Makefile b/x11-toolkits/nanogui/Makefile
index 0af92116fc15..d61dd7a3de6c 100644
--- a/x11-toolkits/nanogui/Makefile
+++ b/x11-toolkits/nanogui/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	nanogui
 DISTVERSION=	g20220215
+PORTREVISION=	1
 CATEGORIES=	x11-toolkits
 
 MAINTAINER=	yuri@FreeBSD.org
@@ -8,7 +9,10 @@ COMMENT=	Minimalistic GUI library for OpenGL
 LICENSE=	BSD3CLAUSE
 LICENSE_FILE=	${WRKSRC}/LICENSE.txt
 
-USES=		cmake compiler:c++17-lang eigen:3,build,run gl xorg
+LIB_DEPENDS=	libglfw.so:graphics/glfw
+TEST_DEPENDS=	zenity:x11/zenity
+
+USES=		cmake compiler:c++17-lang gl xorg
 USE_GL=		gl
 USE_XORG=	x11 xcursor xi xinerama xrandr xxf86vm
 USE_LDCONFIG=	yes
@@ -23,23 +27,20 @@ GH_TUPLE=	wjakob:nanovg:bf2320d1175122374a9b806d91e9e666c9336375:wjakob_nanovg/e
 
 CMAKE_ARGS=	-DCMAKE_INSTALL_INCLUDEDIR=${LOCALBASE}/include \
 		-DCMAKE_INSTALL_DATAROOTDIR=${LOCALBASE}/lib
-CMAKE_ON=	NANOGUI_BUILD_GLFW
-CMAKE_OFF=	NANOGUI_BUILD_EXAMPLES
+CMAKE_OFF=	NANOGUI_BUILD_GLFW NANOGUI_BUILD_EXAMPLES
 
 OPTIONS_DEFINE=		PYTHON
 OPTIONS_DEFAULT=	PYTHON
 OPTIONS_SUB=		yes
 
-PYTHON_CMAKE_BOOL=	NANOGUI_BUILD_PYTHON
 PYTHON_USES=		python
+PYTHON_CMAKE_BOOL=	NANOGUI_BUILD_PYTHON
 PYTHON_CMAKE_ON=	-DFREEBSD_PYTHON_DISTVERSION=${PYTHON_DISTVERSION}
 
-post-install: # workaround for https://github.com/mitsuba-renderer/nanogui/issues/116
-	@${RM} -r ${STAGEDIR}${PREFIX}/include/GLFW
-
 post-install-PYTHON-on:
-	@${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
-	${MV} ${STAGEDIR}${PREFIX}/lib/nanogui*.so ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+	@${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/nanogui
+	${INSTALL_DATA} ${WRKSRC}/nanogui/__init__.py ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/nanogui
+	${MV} ${STAGEDIR}${PREFIX}/lib/nanogui*.so ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/nanogui
 
 do-test:
 	@cd ${BUILD_WRKSRC} && \
diff --git a/x11-toolkits/nanogui/files/patch-CMakeLists.txt b/x11-toolkits/nanogui/files/patch-CMakeLists.txt
index 690e8bffbd12..9a10b4409cb3 100644
--- a/x11-toolkits/nanogui/files/patch-CMakeLists.txt
+++ b/x11-toolkits/nanogui/files/patch-CMakeLists.txt
@@ -1,4 +1,4 @@
---- CMakeLists.txt.orig	2022-02-15 15:25:41 UTC
+--- CMakeLists.txt.orig	2022-04-10 13:30:19 UTC
 +++ CMakeLists.txt
 @@ -1,6 +1,8 @@
  cmake_minimum_required (VERSION 3.13..3.18)
@@ -9,7 +9,28 @@
  # Extract project version from source
  file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/include/nanogui/common.h"
    nanogui_version_defines REGEX "#define NANOGUI_VERSION_(MAJOR|MINOR|PATCH) ")
-@@ -580,7 +582,7 @@ if (NANOGUI_BUILD_PYTHON)
+@@ -497,6 +504,12 @@ if (EXISTS /opt/vc/include)
+   target_include_directories(nanogui PUBLIC /opt/vc/include)
+ endif()
+ 
++# Find glfw if nanogui is not compiling it internally.
++if (NOT NANOGUI_BUILD_GLFW)
++  find_package(glfw3 CONFIG REQUIRED)
++  target_link_libraries(nanogui PUBLIC glfw)
++endif()
++
+ if (NANOGUI_INSTALL)
+   install(TARGETS nanogui
+           LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+@@ -522,6 +535,7 @@ if (NANOGUI_INSTALL)
+ 
+   set(NANOGUI_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/cmake/nanogui")
+ 
++  include(CMakePackageConfigHelpers)
+   configure_package_config_file(
+     resources/nanoguiConfig.cmake.in nanoguiConfig.cmake
+     INSTALL_DESTINATION ${NANOGUI_CMAKECONFIG_INSTALL_DIR})
+@@ -580,7 +594,7 @@ if (NANOGUI_BUILD_PYTHON)
          list(APPEND CMAKE_PREFIX_PATH "${_tmp_dir}")
        find_package(pybind11 CONFIG REQUIRED)
      else()
diff --git a/x11-toolkits/nanogui/pkg-plist b/x11-toolkits/nanogui/pkg-plist
index 1b0f4f7c53e7..b5426bcda933 100644
--- a/x11-toolkits/nanogui/pkg-plist
+++ b/x11-toolkits/nanogui/pkg-plist
@@ -47,4 +47,5 @@ lib/cmake/nanogui/nanoguiConfigVersion.cmake
 lib/cmake/nanogui/nanoguiTargets-%%CMAKE_BUILD_TYPE%%.cmake
 lib/cmake/nanogui/nanoguiTargets.cmake
 lib/libnanogui.so
-%%PYTHON%%%%PYTHON_SITELIBDIR%%/nanogui_ext%%PYTHON_EXT_SUFFIX%%.so
+%%PYTHON%%%%PYTHON_SITELIBDIR%%/nanogui/__init__.py
+%%PYTHON%%%%PYTHON_SITELIBDIR%%/nanogui/nanogui_ext%%PYTHON_EXT_SUFFIX%%.so