git: 41acfec7a1ce - main - misc/gedkeeper: the port had been improved (+)

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Wed, 05 Apr 2023 13:16:55 UTC
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=41acfec7a1ce77f8135080f7cc6e8689a1cfe84c

commit 41acfec7a1ce77f8135080f7cc6e8689a1cfe84c
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2023-04-05 13:16:16 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2023-04-05 13:16:16 +0000

    misc/gedkeeper: the port had been improved (+)
    
    - Make GetTempDir() function Unix-aware, where TMP environment
      variable is preferred over Windows' TEMP, and fallback to /tmp
      when it is unset
    - Change GetAppPath() function to uphold that we do not install
      the main program in another subdirectory (bin) since the whole
      project already lives under $DATADIR (Mono/.NET programs are
      not always hier(7)-conforming)
    - Fix provided *.desktop file (respect PREFIX and replace badly
      named startup wrapper script with ours)
---
 misc/gedkeeper/Makefile                            |  8 +++++++
 .../files/patch-projects_GKCore_GKCore_GKUtils.cs  | 25 ++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/misc/gedkeeper/Makefile b/misc/gedkeeper/Makefile
index fe34618f21e3..eeff45f6e590 100644
--- a/misc/gedkeeper/Makefile
+++ b/misc/gedkeeper/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	gedkeeper
 PORTVERSION=	2.25.0
 DISTVERSIONPREFIX=	v
+PORTREVISION=	1
 CATEGORIES=	misc
 
 MAINTAINER=	danfe@FreeBSD.org
@@ -22,6 +23,11 @@ GH_SUBDIR=	projects/GKCommunicator:gkc projects/GKGenetix:gkg
 _BUILD_TYPE=	Release
 DATADIR=	${PREFIX}/lib/${PORTNAME}
 
+post-patch:
+	@${REINPLACE_CMD} -E '/^(Path|Icon)=/s,/usr,${PREFIX}, ; \
+	    /^Exec=/s,gk_run\.sh,${PORTNAME},' \
+		${WRKSRC}/deploy/gedkeeper.desktop
+
 do-build:
 	cd ${BUILD_WRKSRC} && msbuild projects/GKv2/GEDKeeper2.sln \
 		/p:Configuration=${_BUILD_TYPE} /p:MonoCS=true \
@@ -51,3 +57,5 @@ do-test:
 		projects/GKTests/bin/${_BUILD_TYPE}/GKTests.dll
 
 .include <bsd.port.mk>
+
+PATCH_ARGS=	-l
diff --git a/misc/gedkeeper/files/patch-projects_GKCore_GKCore_GKUtils.cs b/misc/gedkeeper/files/patch-projects_GKCore_GKCore_GKUtils.cs
new file mode 100644
index 000000000000..7de8d94f966c
--- /dev/null
+++ b/misc/gedkeeper/files/patch-projects_GKCore_GKCore_GKUtils.cs
@@ -0,0 +1,25 @@
+--- projects/GKCore/GKCore/GKUtils.cs.orig	2023-03-27 21:40:19 UTC
++++ projects/GKCore/GKCore/GKUtils.cs
+@@ -1758,7 +1758,11 @@ namespace GKCore
+ 
+         public static string GetTempDir()
+         {
+-            string tempPath = Environment.GetEnvironmentVariable("TEMP");
++            string tempPath;
++            if (SysUtils.IsUnix())
++                tempPath = Environment.GetEnvironmentVariable("TMP") ?? "/tmp";
++            else
++                tempPath = Environment.GetEnvironmentVariable("TEMP");
+             return tempPath + Path.DirectorySeparatorChar;
+         }
+ 
+@@ -1772,8 +1776,7 @@ namespace GKCore
+ 
+         public static string GetAppPath()
+         {
+-            string result = Path.GetFullPath(Path.Combine(GetBinPath(), @".." + Path.DirectorySeparatorChar));
+-            return result;
++            return GetBinPath();
+         }
+ 
+         public static string GetPluginsPath()