git: cf75f452e94a - main - sysutils/conky: Update to 1.14.0

From: Guido Falsi <madpilot_at_FreeBSD.org>
Date: Thu, 13 Oct 2022 18:24:09 UTC
The branch main has been updated by madpilot:

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

commit cf75f452e94a2eb6da98eabc5b9e002f138e4051
Author:     Guido Falsi <madpilot@FreeBSD.org>
AuthorDate: 2022-10-13 18:22:58 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2022-10-13 18:22:58 +0000

    sysutils/conky: Update to 1.14.0
    
    - Add patch implementing missing function for FreeBSD, already
      proposed upstream: https://github.com/brndnmtthws/conky/pull/1252
    
    - Updated dependencies, upstream changed its documentation build
      method
    
    Old html documentation has been removed, the information is now
    encoded in yaml files.
    
    Upstream code does not provide a method to automatically produce
    human readable documentation from the yaml files, so I install those
    directly in PORTDOCS.
---
 sysutils/conky/Makefile                           | 24 +++++++++---------
 sysutils/conky/distinfo                           |  6 ++---
 sysutils/conky/files/patch-CMakeLists.txt         | 18 +++-----------
 sysutils/conky/files/patch-doc_CMakeLists.txt     | 11 +++++++++
 sysutils/conky/files/patch-doc_docgen.sh          | 13 ----------
 sysutils/conky/files/patch-src_display-console.cc | 16 ------------
 sysutils/conky/files/patch-src_freebsd.cc         | 30 +++++++++++++++++++++++
 7 files changed, 61 insertions(+), 57 deletions(-)

diff --git a/sysutils/conky/Makefile b/sysutils/conky/Makefile
index 8921bf37c4b5..74c9a4df4102 100644
--- a/sysutils/conky/Makefile
+++ b/sysutils/conky/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	conky
-PORTVERSION=	1.13.1
+PORTVERSION=	1.14.0
 DISTVERSIONPREFIX=	v
 CATEGORIES=	sysutils
 
@@ -8,13 +8,13 @@ COMMENT?=	Advanced, highly configurable system monitor for X11
 WWW=		https://github.com/brndnmtthws/conky
 
 LIB_DEPENDS=	libinotify.so:devel/libinotify
-BUILD_DEPENDS=	db2x_xsltproc:textproc/docbook2X \
-		docbook-xsl>=0:textproc/docbook-xsl \
-		xsltproc:textproc/libxslt \
-		gsed:textproc/gsed
+BUILD_DEPENDS=	gsed:textproc/gsed \
+		pandoc:textproc/hs-pandoc \
+		${PYTHON_PKGNAMEPREFIX}yaml>0:devel/py-yaml@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}Jinja2>=0:devel/py-Jinja2@${PY_FLAVOR}
 
 USES=		cpe cmake:noninja compiler:c++11-lib gettext-runtime iconv \
-		localbase lua:52-53 pkgconfig tar:bzip2
+		localbase lua:52-53 pkgconfig python:3.7+,build tar:bzip2
 
 CMAKE_ARGS=	-DBUILD_PORT_MONITORS:BOOL=false \
 		-DBUILD_IBM:BOOL=false \
@@ -28,7 +28,7 @@ CONFLICTS?=	conky-awesome
 SLAVEDIRS=	sysutils/conky-awesome
 PLIST_FILES=	bin/conky man/man1/conky.1.gz
 PORTEXAMPLES=	conky.conf conky_no_x11.conf convert.lua
-PORTDOCS=	html/config_settings.html html/docs.html html/lua.html html/variables.html
+PORTDOCS=	config_settings.yaml variables.yaml lua.yaml
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	brndnmtthws
@@ -57,6 +57,7 @@ DOUBLE_BUFFER_IMPLIES=	X11
 IMLIB2_CMAKE_BOOL=	BUILD_IMLIB2
 IMLIB2_LIB_DEPENDS=	libImlib2.so:graphics/imlib2
 IMLIB2_IMPLIES=		X11
+IMLIB2_USE=		xorg=ice,sm
 
 IPV6_CMAKE_BOOL=	BUILD_IPV6
 
@@ -137,8 +138,6 @@ post-patch:
 	@${REINPLACE_CMD} -e 's,^set(INCLUDE_SEARCH_PATH \(.*\)),set(INCLUDE_SEARCH_PATH \1 ${LUA_INCDIR}),' \
 		-e 's/ -lbsd/ -lintl -linotify/' \
 		${WRKSRC}/cmake/ConkyPlatformChecks.cmake
-	@${REINPLACE_CMD} -e 's,LOCALBASE,${LOCALBASE},' \
-		${WRKSRC}/doc/docgen.sh
 .if ${LUA_DEFAULT} == 5.2
 	# Force using lua 5.2
 	@${REINPLACE_CMD} -e 's/lua.*5\.*3//' \
@@ -149,7 +148,10 @@ post-patch:
 		${WRKSRC}/cmake/ConkyPlatformChecks.cmake
 .endif
 
-post-build:
-	(cd ${WRKSRC}/doc && ${SH} docgen.sh)
+post-install-DOCS-on:
+	${MKDIR} ${STAGEDIR}${DOCSDIR}
+.for FILE in ${PORTDOCS}
+	${INSTALL_MAN} ${WRKSRC}/doc/${FILE} ${STAGEDIR}${DOCSDIR}
+.endfor
 
 .include <bsd.port.mk>
diff --git a/sysutils/conky/distinfo b/sysutils/conky/distinfo
index 032e6f51a2db..7ac4fe2c5c49 100644
--- a/sysutils/conky/distinfo
+++ b/sysutils/conky/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1663601049
-SHA256 (brndnmtthws-conky-v1.13.1_GH0.tar.gz) = f85c96250b501e937b9b5d2ff3f06176e14777c94cec81373bbfc8a619d7a05a
-SIZE (brndnmtthws-conky-v1.13.1_GH0.tar.gz) = 2443276
+TIMESTAMP = 1665603150
+SHA256 (brndnmtthws-conky-v1.14.0_GH0.tar.gz) = 36314449441eeae4d2bb1713cdd0738bfb581a9b23d5374137965684de04d964
+SIZE (brndnmtthws-conky-v1.14.0_GH0.tar.gz) = 1797564
diff --git a/sysutils/conky/files/patch-CMakeLists.txt b/sysutils/conky/files/patch-CMakeLists.txt
index 72d5a7d5b727..e8131e7911a6 100644
--- a/sysutils/conky/files/patch-CMakeLists.txt
+++ b/sysutils/conky/files/patch-CMakeLists.txt
@@ -1,6 +1,6 @@
---- CMakeLists.txt.orig	2019-06-23 14:50:35 UTC
+--- CMakeLists.txt.orig	2022-10-12 18:18:08 UTC
 +++ CMakeLists.txt
-@@ -72,9 +72,12 @@ if(BUILD_TESTS)
+@@ -73,11 +73,14 @@ if(NOT DEFINED DOC_PATH)
  endif()
  
  if(NOT DEFINED DOC_PATH)
@@ -13,18 +13,8 @@
 +endif(NOT DEFINED SAMPLE_PATH)
 +set(SAMPLE_FILES extras/convert.lua data/conky_no_x11.conf data/conky.conf)
  
- set(HTML_PATH "${DOC_PATH}/html")
- set(HTML_FILES
-@@ -83,10 +86,10 @@ set(HTML_FILES
-     doc/lua.html
-     doc/variables.html)
- 
--set(MAN_PATH "share/man/man1")
-+set(MAN_PATH "man/man1")
- set(MAN_FILES doc/conky.1)
- 
 -install(FILES ${DOC_FILES} DESTINATION ${DOC_PATH})
 +install(FILES ${SAMPLE_FILES} DESTINATION ${SAMPLE_PATH})
  
- if(BUILD_DOCS)
-   install(FILES ${HTML_FILES} DESTINATION ${HTML_PATH})
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+   install(FILES conky.desktop DESTINATION share/applications)
diff --git a/sysutils/conky/files/patch-doc_CMakeLists.txt b/sysutils/conky/files/patch-doc_CMakeLists.txt
new file mode 100644
index 000000000000..d6ef42b5aa55
--- /dev/null
+++ b/sysutils/conky/files/patch-doc_CMakeLists.txt
@@ -0,0 +1,11 @@
+--- doc/CMakeLists.txt.orig	2022-10-12 18:18:08 UTC
++++ doc/CMakeLists.txt
+@@ -32,7 +32,7 @@ if(BUILD_DOCS)
+     )
+     add_dependencies(conky.1 man.md)
+  
+-    set(MAN_PATH "share/man/man1")
++    set(MAN_PATH "man/man1")
+     set(MAN_FILES ${CMAKE_CURRENT_BINARY_DIR}/conky.1)
+ 
+     install(FILES ${DOC_FILES} DESTINATION ${DOC_PATH})
diff --git a/sysutils/conky/files/patch-doc_docgen.sh b/sysutils/conky/files/patch-doc_docgen.sh
deleted file mode 100644
index 7c85667e644b..000000000000
--- a/sysutils/conky/files/patch-doc_docgen.sh
+++ /dev/null
@@ -1,13 +0,0 @@
---- doc/docgen.sh.orig	2019-08-12 21:53:54 UTC
-+++ doc/docgen.sh
-@@ -1,6 +1,9 @@
- #!/bin/sh
- 
--xsltproc http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl docs.xml > docs.html && \
-+xsltproc LOCALBASE/share/xsl/docbook/html/docbook.xsl docs.xml > docs.html && \
-+xsltproc LOCALBASE/share/xsl/docbook/html/docbook.xsl variables.xml > variables.html && \
-+xsltproc LOCALBASE/share/xsl/docbook/html/docbook.xsl config_settings.xml > config_settings.html && \
-+xsltproc LOCALBASE/share/xsl/docbook/html/docbook.xsl lua.xml > lua.html && \
- db2x_xsltproc -s man docs.xml -o docs.mxml && \
- db2x_manxml docs.mxml && \
- { echo ".TH CONKY 1 \"August 2005\" \"conky compiled August 2005\" \"User Commands\""; sed 1d < conky.1; } > conky.2 && \
diff --git a/sysutils/conky/files/patch-src_display-console.cc b/sysutils/conky/files/patch-src_display-console.cc
deleted file mode 100644
index aad2f1f14886..000000000000
--- a/sysutils/conky/files/patch-src_display-console.cc
+++ /dev/null
@@ -1,16 +0,0 @@
---- src/display-console.cc.orig	2022-09-19 15:16:35 UTC
-+++ src/display-console.cc
-@@ -54,8 +54,11 @@ bool display_output_console::detect() {
- }
- 
- bool display_output_console::detect() {
--  if ((out_to_stdout.get(*state) || out_to_stderr.get(*state)) &&
--      !out_to_ncurses.get(*state)) {
-+  if ((out_to_stdout.get(*state) || out_to_stderr.get(*state))
-+#ifdef BUILD_NCURSES
-+      && !out_to_ncurses.get(*state)
-+#endif
-+  ) {
-     DBGP2("Display output '%s' enabled in config.", name.c_str());
-     return true;
-   }
diff --git a/sysutils/conky/files/patch-src_freebsd.cc b/sysutils/conky/files/patch-src_freebsd.cc
new file mode 100644
index 000000000000..2b9fc160c295
--- /dev/null
+++ b/sysutils/conky/files/patch-src_freebsd.cc
@@ -0,0 +1,30 @@
+--- src/freebsd.cc.orig	2022-10-12 18:18:08 UTC
++++ src/freebsd.cc
+@@ -460,6 +460,27 @@ int get_battery_perct(const char *) {
+   return batcapacity;
+ }
+ 
++void get_battery_power_draw(char *buffer, unsigned int n, const char *bat) {
++  int rate = 0;
++  double ret = 0;
++
++  /*
++   * hw.acpi.battery.rate returns battery discharge rate in mW,
++   * or -1 (according to docs, but also 0 in practice) when not discharging.
++   *
++   * ref. acpi_battery(4)
++   */
++  if (GETSYSCTL("hw.acpi.battery.rate", rate)) {
++    fprintf(stderr, "Cannot read sysctl \"hw.acpi.battery.rate\"\n");
++  }
++
++  if (rate > 0) {
++    ret = (double)rate/(double)1000;
++  }
++
++  snprintf(buffer, n, "%.1f", ret);
++}
++
+ double get_battery_perct_bar(struct text_object *obj) {
+   int batperct = get_battery_perct(obj->data.s);
+   return batperct;