git: c4f9e628de90 - main - editors/focuswriter: Port improvements

From: Nuno Teixeira <eduardo_at_FreeBSD.org>
Date: Fri, 16 Sep 2022 12:37:32 UTC
The branch main has been updated by eduardo:

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

commit c4f9e628de90729f36ff6f8d7c70da329fed081c
Author:     Nuno Teixeira <eduardo@FreeBSD.org>
AuthorDate: 2022-09-16 12:03:12 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2022-09-16 12:37:20 +0000

    editors/focuswriter: Port improvements
    
     - Add LTO option
     - Fix version not showing up in command line and About dialog
     - Bump PORTREVISION
---
 editors/focuswriter/Makefile                       | 10 ++++++---
 .../patch-cmake_AddVersionCompileDefinition.cmake  | 24 ++++++++++++++++++++++
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/editors/focuswriter/Makefile b/editors/focuswriter/Makefile
index f8bc11d3bb57..0b7fbf30ebe8 100644
--- a/editors/focuswriter/Makefile
+++ b/editors/focuswriter/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	focuswriter
 DISTVERSION=	1.8.2
+PORTREVISION=	1
 CATEGORIES=	editors
 MASTER_SITES=	https://gottcode.org/${PORTNAME}/
 
@@ -19,9 +20,12 @@ USES=		cmake compiler:c++17-lang desktop-file-utils gl iconv pkgconfig \
 USE_GL=		gl
 USE_QT=		base multimedia tools:build
 
-PORTDATA=	*
-PORTDOCS=	CREDITS ChangeLog README
-OPTIONS_DEFINE=	DOCS
+PORTDATA=		*
+PORTDOCS=		CREDITS ChangeLog README
+OPTIONS_DEFINE=		DOCS LTO
+OPTIONS_DEFAULT=	LTO
+
+LTO_CMAKE_BOOL=	ENABLE_LINK_TIME_OPTIMIZATION
 
 post-install-DOCS-on:
 	cd ${WRKSRC} && ${COPYTREE_SHARE} "${PORTDOCS}" ${STAGEDIR}${DOCSDIR}
diff --git a/editors/focuswriter/files/patch-cmake_AddVersionCompileDefinition.cmake b/editors/focuswriter/files/patch-cmake_AddVersionCompileDefinition.cmake
new file mode 100644
index 000000000000..37016448e711
--- /dev/null
+++ b/editors/focuswriter/files/patch-cmake_AddVersionCompileDefinition.cmake
@@ -0,0 +1,24 @@
+--- cmake/AddVersionCompileDefinition.cmake.orig	2022-09-01 14:29:17 UTC
++++ cmake/AddVersionCompileDefinition.cmake
+@@ -3,9 +3,6 @@ function(add_version_compile_definition versionstr_fil
+ # SPDX-License-Identifier: GPL-3.0-or-later
+ 
+ function(add_version_compile_definition versionstr_file versionstr_def)
+-	# Use project's VERSION by default
+-	set(versionstr ${PROJECT_VERSION})
+-
+ 	find_package(Git QUIET)
+ 	if(Git_FOUND)
+ 		# Find git repository
+@@ -38,6 +35,11 @@ function(add_version_compile_definition versionstr_fil
+ 				)
+ 			endif()
+ 		endif()
++	endif()
++
++	# Fall back to project's VERSION
++	if ("${versionstr}" STREQUAL "")
++		set(versionstr ${PROJECT_VERSION})
+ 	endif()
+ 
+ 	# Pass version as compile definition to file