git: 763124badcba - main - cad/freecad: fix desktop integration

From: Max Brazhnikov <makc_at_FreeBSD.org>
Date: Mon, 02 Jan 2023 12:14:33 UTC
The branch main has been updated by makc:

URL: https://cgit.FreeBSD.org/ports/commit/?id=763124badcba812eb72f72397357062296d7bd72

commit 763124badcba812eb72f72397357062296d7bd72
Author:     Max Brazhnikov <makc@FreeBSD.org>
AuthorDate: 2023-01-02 12:10:02 +0000
Commit:     Max Brazhnikov <makc@FreeBSD.org>
CommitDate: 2023-01-02 12:11:11 +0000

    cad/freecad: fix desktop integration
    
    - Install XDG files to the standard path, where DE can find them
    - Install freecad-thumbnailer
    - Add missing USES
    
    PR:             268094
    Approved by:    maintainer timeout (18 days)
---
 cad/freecad/Makefile  | 16 ++++++++++++----
 cad/freecad/pkg-plist | 27 +++++++++++++++------------
 2 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/cad/freecad/Makefile b/cad/freecad/Makefile
index d76e9f774dea..ba1cc6a4ea8f 100644
--- a/cad/freecad/Makefile
+++ b/cad/freecad/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	FreeCAD
 DISTVERSION=	0.20.2
+PORTREVISION=	1
 # use these for bugfixes/snapshots
 # DISTVERSION=	0.18-16093 # git rev-list --count
 # DISTVERSIONSUFFIX=	-g690774c0e
@@ -35,7 +36,8 @@ RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pivy>0:graphics/py-pivy@${PY_FLAVOR} \
 		${PYTHON_SITELIBDIR}/matplotlib/__init__.py:math/py-matplotlib@${PY_FLAVOR}
 
 USES=		dos2unix compiler:c++17-lang cmake cpe gl eigen:3 fortran jpeg \
-		localbase:ldflags mpi:openmpi pkgconfig python:3.7+ localbase qt:5 xorg
+		localbase:ldflags mpi:openmpi pkgconfig python:3.7+ localbase qt:5 xorg \
+		desktop-file-utils shared-mime-info shebangfix
 USE_GITHUB=	yes
 USE_XORG=	ice sm x11 xext xt
 USE_GL=		gl glu
@@ -49,6 +51,7 @@ CPE_VENDOR=	freecad_project
 VTK_VER=	9.2
 
 DOS2UNIX_GLOB=	*.txt *.h *.cpp *.py *.qss *.csv *.pov *.stp *.ui *.wrl *.WRL
+SHEBANG_FILES=	src/Tools/freecad-thumbnailer
 
 CMAKE_ARGS+=	-DOCC_INCLUDE_DIR="${LOCALBASE}/include/OpenCASCADE" \
 		-DOPENMPI_INCLUDE_DIRS="${LOCALBASE}/mpi/openmpi/include" \
@@ -68,15 +71,14 @@ CMAKE_ARGS+=	-DOCC_INCLUDE_DIR="${LOCALBASE}/include/OpenCASCADE" \
 		-DBUILD_ENABLE_CXX_STD=C++17
 
 CMAKE_INSTALL_PREFIX=	${PREFIX}/${PORTNAME}
+# Install XDG icons and files to the standard path
+CMAKE_ARGS+=	-DXDG_DATADIR="${PREFIX}/share"
 
 OPTIONS_DEFINE=	COLLADA
 
 COLLADA_DESC=		Install pycollada for Collada files import
 COLLADA_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pycollada>0:graphics/py-pycollada@${PY_FLAVOR}
 
-DESKTOP_ENTRIES=${PORTNAME} "" "${PREFIX}/FreeCAD/data/freecad.svg" \
-		${PORTNAME} "Graphics;Engineering;" false
-
 .include <bsd.port.options.mk>
 
 .if ${ARCH} == aarch64 || ${ARCH} == amd64 || ${ARCH} == i386
@@ -88,9 +90,15 @@ USE_QT+=	webkit
 post-patch:
 	@${REINPLACE_CMD} -e '/self\.rev/s/Unknown/${DISTVERSION:C/.*-//}/' \
 		${WRKSRC}/src/Tools/SubWCRev.py
+# Install XDG icons and files to the standard path
+	@${REINPLACE_CMD} -e 's/CMAKE_INSTALL_DATAROOTDIR/XDG_DATADIR/g' \
+		${WRKSRC}/src/XDGData/CMakeLists.txt \
+		${WRKSRC}/src/Gui/CMakeLists.txt
 
 post-install:
 	${LN} -s ../${PORTNAME}/bin/FreeCAD ${STAGEDIR}${LOCALBASE}/bin/FreeCAD
 	${LN} -s ../${PORTNAME}/bin/FreeCADCmd ${STAGEDIR}${LOCALBASE}/bin/FreeCADCmd
+	${INSTALL_SCRIPT} ${WRKSRC}/src/Tools/freecad-thumbnailer \
+		${STAGEDIR}${PREFIX}/bin/freecad-thumbnailer
 
 .include <bsd.port.mk>
diff --git a/cad/freecad/pkg-plist b/cad/freecad/pkg-plist
index 84d77dfdc2b8..7bd8392bfc8d 100644
--- a/cad/freecad/pkg-plist
+++ b/cad/freecad/pkg-plist
@@ -1959,7 +1959,8 @@ FreeCAD/share/Mod/TechDraw/Templates/zh_CN/portrait/A3_Portrait_CN_CLIP.svg
 FreeCAD/share/Mod/TechDraw/Templates/zh_CN/portrait/A4_Portrait_CN_CLIP.svg
 FreeCAD/share/Mod/Test/Resources/icons/TestWorkbench.svg
 FreeCAD/share/Mod/Web/Resources/icons/WebWorkbench.svg
-FreeCAD/share/applications/org.freecadweb.FreeCAD.desktop
+@comment FreeCAD/share/doc/FreeCAD/LICENSE.html
+@comment FreeCAD/share/doc/FreeCAD/ThirdPartyLibraries.html
 FreeCAD/share/examples/ArchDetail.FCStd
 FreeCAD/share/examples/EngineBlock.FCStd
 FreeCAD/share/examples/FemCalculixCantilever2D.FCStd
@@ -1969,19 +1970,21 @@ FreeCAD/share/examples/PartDesignExample.FCStd
 FreeCAD/share/examples/RobotExample.FCStd
 FreeCAD/share/examples/Schenkel.stp
 FreeCAD/share/examples/draft_test_objects.FCStd
-FreeCAD/share/icons/hicolor/16x16/apps/freecad.png
-FreeCAD/share/icons/hicolor/32x32/apps/freecad.png
-FreeCAD/share/icons/hicolor/48x48/apps/freecad.png
-FreeCAD/share/icons/hicolor/64x64/apps/freecad.png
-FreeCAD/share/icons/hicolor/scalable/apps/freecad.svg
-FreeCAD/share/icons/hicolor/scalable/apps/org.freecadweb.FreeCAD.svg
-FreeCAD/share/icons/hicolor/scalable/mimetypes/application-x-extension-fcstd.svg
-FreeCAD/share/metainfo/org.freecadweb.FreeCAD.appdata.xml
-FreeCAD/share/mime/packages/org.freecadweb.FreeCAD.xml
-FreeCAD/share/pixmaps/freecad.xpm
-FreeCAD/share/thumbnailers/FreeCAD.thumbnailer
 bin/FreeCAD
 bin/FreeCADCmd
+bin/freecad-thumbnailer
+share/applications/org.freecadweb.FreeCAD.desktop
+share/icons/hicolor/16x16/apps/freecad.png
+share/icons/hicolor/32x32/apps/freecad.png
+share/icons/hicolor/48x48/apps/freecad.png
+share/icons/hicolor/64x64/apps/freecad.png
+share/icons/hicolor/scalable/apps/freecad.svg
+share/icons/hicolor/scalable/apps/org.freecadweb.FreeCAD.svg
+share/icons/hicolor/scalable/mimetypes/application-x-extension-fcstd.svg
+share/metainfo/org.freecadweb.FreeCAD.appdata.xml
+share/mime/packages/org.freecadweb.FreeCAD.xml
+share/pixmaps/freecad.xpm
+share/thumbnailers/FreeCAD.thumbnailer
 @dir FreeCAD
 @dir FreeCAD/share
 @dir FreeCAD/share/Mod/Material/StandardMaterial/Tools