git: 593b9705c8e6 - main - x11/kitty: Update to 0.29.0

From: Nicola Vitale <nivit_at_FreeBSD.org>
Date: Sat, 15 Jul 2023 14:01:01 UTC
The branch main has been updated by nivit:

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

commit 593b9705c8e6519948ee0ab17563662c06c97516
Author:     Nicola Vitale <nivit@FreeBSD.org>
AuthorDate: 2023-07-15 13:59:01 +0000
Commit:     Nicola Vitale <nivit@FreeBSD.org>
CommitDate: 2023-07-15 14:00:53 +0000

    x11/kitty: Update to 0.29.0
    
    - Remove patches merged by upstream
    - Update lib dependencies
    - Pet portfmt/portclippy/portlint
    - Add option DOCS
    - Don't install all files in $PREFIX/lib/kitty, but in the canonical
      directories DATADIR, DESKTOPDIR, etc.
    - Add a couple of patch to fix some links in the documentation.
      Error shown:
    
    fatal: ambiguous argument '8dea5b3': unknown revision or path not in the working tree.
    Use '--' to separate paths from revisions, like this:
    'git <command> [<revision>...] -- [<file>...]'
    fatal: ambiguous argument 'ad1109b': unknown revision or path not in the working tree.
    Use '--' to separate paths from revisions, like this:
    'git <command> [<revision>...] -- [<file>...]'
    fatal: ambiguous argument '889ca77': unknown revision or path not in the working tree.
    Use '--' to separate paths from revisions, like this:
    'git <command> [<revision>...] -- [<file>...]'
    reading sources... [100%] protocol-extensions .. unscroll
    /usr/local/poudriere/ports/default/x11/kitty/work/github.com/kovidgoyal/kitty@v0.29.0/docs/changelog.rst:2940: ERROR: GitHub commit id "8dea5b3" not recognized.
    /usr/local/poudriere/ports/default/x11/kitty/work/github.com/kovidgoyal/kitty@v0.29.0/docs/changelog.rst:3055: ERROR: GitHub commit id "ad1109b" not recognized.
    /usr/local/poudriere/ports/default/x11/kitty/work/github.com/kovidgoyal/kitty@v0.29.0/docs/changelog.rst:3067: ERROR: GitHub commit id "889ca77" not recognized.
    
    Release changes: https://sw.kovidgoyal.net/kitty/changelog/#id1
---
 x11/kitty/Makefile                       | 55 ++++++++++++++++++++++----------
 x11/kitty/distinfo                       | 14 +++-----
 x11/kitty/files/patch-docs_changelog.rst | 29 +++++++++++++++++
 x11/kitty/files/patch-docs_conf.py       | 23 +++++++++++++
 x11/kitty/files/patch-setup.py           | 26 +++++++++++----
 5 files changed, 114 insertions(+), 33 deletions(-)

diff --git a/x11/kitty/Makefile b/x11/kitty/Makefile
index 906878a357ae..1476dc9a9e19 100644
--- a/x11/kitty/Makefile
+++ b/x11/kitty/Makefile
@@ -1,13 +1,9 @@
 PORTNAME=	kitty
 DISTVERSIONPREFIX=	v
-DISTVERSION=	0.28.1
-PORTREVISION=	1
+DISTVERSION=	0.29.0
+PORTREVISION=	0
 CATEGORIES=	x11 wayland
 
-PATCH_SITES=	https://github.com/kovidgoyal/${PORTNAME}/commit/
-PATCHFILES+=	95d15648fa37.patch:-p1 # https://github.com/kovidgoyal/kitty/issues/6422
-PATCHFILES+=	7d2dc252f149.patch:-p1 # https://github.com/kovidgoyal/kitty/issues/6422
-
 MAINTAINER=	nivit@FreeBSD.org
 COMMENT=	Cross-platform, fast, featureful, GPU-based terminal emulator
 WWW=		https://sw.kovidgoyal.net/kitty/
@@ -22,7 +18,8 @@ BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}furo>0:textproc/py-furo@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}sphinxext-opengraph>0:textproc/py-sphinxext-opengraph@${PY_FLAVOR} \
 		sphinx-build:textproc/py-sphinx@${PY_FLAVOR} \
 		wayland-protocols>=0:graphics/wayland-protocols
-LIB_DEPENDS=	libdbus-1.so:devel/dbus \
+LIB_DEPENDS=	libcanberra.so:audio/libcanberra \
+		libdbus-1.so:devel/dbus \
 		libepoll-shim-interpose.so:devel/libepoll-shim \
 		libfontconfig.so:x11-fonts/fontconfig \
 		libfreetype.so:print/freetype2 \
@@ -35,8 +32,8 @@ LIB_DEPENDS=	libdbus-1.so:devel/dbus \
 		libxkbcommon.so:x11/libxkbcommon
 
 USES=		compiler:c11 cpe desktop-file-utils gettext-runtime gl gmake \
-		go:modules pkgconfig python shebangfix ssl tar:xz terminfo \
-		xorg
+		go:modules magick pkgconfig python shebangfix ssl tar:xz \
+		terminfo xorg
 CPE_VENDOR=	kitty_project
 GH_TUPLE=	ALTree:bigfloat:38c8b72a9924:altree_bigfloat/vendor/github.com/ALTree/bigfloat \
 		disintegration:imaging:v1.6.2:disintegration_imaging/vendor/github.com/disintegration/imaging \
@@ -66,17 +63,22 @@ LDFLAGS+=	`pkg-config --libs epoll-shim-interpose`
 
 BINARY_ALIAS=	python3=${PYTHON_CMD} python=${PYTHON_CMD}
 
+BUILD_DIR=	${WRKSRC}/${OPSYS:tl}-package
+
 INSTALL_WRKSRC=	${WRKSRC}/linux-package
 
-_STRIP_TARGETS=	lib/kitty/kitty/fast_data_types.so lib/kitty/kitty/glfw-x11.so \
-		lib/kitty/kitty/glfw-wayland.so bin/kitten bin/kitty \
-		lib/kitty/kittens/transfer/rsync.so
+_STRIP_TARGETS=	kitty/fast_data_types.so kitty/glfw-x11.so \
+		kitty/glfw-wayland.so kittens/transfer/rsync.so
 
 _EMPTY_DIRS=	kittens/choose kittens/diff kittens/unicode_input kittens kitty
 
+OPTIONS_DEFINE=	DOCS
+DOCS_MAKE_ENV=	BUILD_DOCS=yes
+
 .include <bsd.port.options.mk>
 
-.if ${OPSYS} == FreeBSD && ( ${OSVERSION} >= 1400079 || ( ${OSVERSION} >= 1302505 && ${OSVERSION} < 1400000 ))
+.if ${OPSYS} == FreeBSD && (${OSVERSION} >= 1400079 || (${OSVERSION} >= 1302505 && \
+	${OSVERSION} < 1400000))
 CFLAGS+=	-Wno-error=invalid-utf8 -Winvalid-utf8
 .endif
 
@@ -96,16 +98,35 @@ USES+=		ncurses
 EXTRA_PATCHES=	${PATCHDIR}/extra-patch-kitty_data-types.h
 .endif
 
+post-patch:                                                                     
+    ${REINPLACE_CMD} -i.bak -e "s:'go':'${GO_CMD:T}':1" ${WRKSRC}/setup.py
+
 # For librsync, we need to set header and library path
 do-build:
 	(cd ${WRKSRC} && \
-	        ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} setup.py linux-package --update-check-interval 0 --extra-include-dirs ${LOCALBASE}/include/ --extra-library-dirs ${LOCALBASE}/lib)
-	${FIND} ${INSTALL_WRKSRC} -name __pycache__ -type d -exec ${RM} -r -- {} +
+	        ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} setup.py \
+			--extra-include-dirs ${LOCALBASE}/include \
+			--extra-library-dirs ${LOCALBASE}/lib \
+			--libdir-name share \
+			--prefix ${BUILD_DIR:T} \
+			--update-check-interval 0 \
+			linux-package)
 
 do-install:
-	${CP} -a ${INSTALL_WRKSRC}/ ${STAGEDIR}${PREFIX}
-	${STRIP_CMD} ${_STRIP_TARGETS:S|^|${STAGEDIR}${PREFIX}/|}
+	cd ${BUILD_DIR} && \
+		${INSTALL_PROGRAM} bin/kitty bin/kitten ${STAGEDIR}${PREFIX}/bin && \
+		${INSTALL_DATA} share/applications/* ${STAGEDIR}${DESKTOPDIR} && \
+		${INSTALL_DATA} -d share/icons/hicolor ${STAGEDIR}${PREFIX}/share/icons/highcolor
+	cd ${BUILD_DIR}/share/kitty && \
+	       	${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR}
 	${INSTALL_DATA} ${WRKSRC}/terminfo/kitty.terminfo \
 		${STAGEDIR}${PREFIX}/share/misc/
+	${INSTALL_MAN} ${BUILD_DIR}/share/man/man1/kitty.1 ${STAGEDIR}${MANPREFIX}/share/man/man1
+	${INSTALL_MAN} ${BUILD_DIR}/share/man/man5/kitty.conf.5 ${STAGEDIR}${MANPREFIX}/share/man/man5
+	${STRIP_CMD} ${_STRIP_TARGETS:S|^|${STAGEDIR}${DATADIR}/|}
+
+do-install-DOCS-on:
+	cd ${BUILD_DIR}/share/doc/kitty/html && \
+		${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR}
 
 .include <bsd.port.mk>
diff --git a/x11/kitty/distinfo b/x11/kitty/distinfo
index 32502263ccd8..ba38bdfb1b17 100644
--- a/x11/kitty/distinfo
+++ b/x11/kitty/distinfo
@@ -1,9 +1,5 @@
-TIMESTAMP = 1683875864
-SHA256 (go/x11_kitty/kitty-v0.28.1/v0.28.1.mod) = 0b13cb16daa2d5096cf82ccb083e36999a0f14ef24442946376b8622cf59dd12
-SIZE (go/x11_kitty/kitty-v0.28.1/v0.28.1.mod) = 1048
-SHA256 (go/x11_kitty/kitty-v0.28.1/v0.28.1.zip) = 9557eca1fe041935f6f7b7fa08c5b81a89c85f53fed7fd3c31f4c90823fcfd77
-SIZE (go/x11_kitty/kitty-v0.28.1/v0.28.1.zip) = 8285949
-SHA256 (go/x11_kitty/kitty-v0.28.1/95d15648fa37.patch) = c51a27a65e9fa6e481ce7da48bd722d4d75bf863c4ba770fa5ae852aa321f27c
-SIZE (go/x11_kitty/kitty-v0.28.1/95d15648fa37.patch) = 1189
-SHA256 (go/x11_kitty/kitty-v0.28.1/7d2dc252f149.patch) = 9d5d3274945d6eb589ab3e4118df8bf8585acac65f3fcfd06873337f56546125
-SIZE (go/x11_kitty/kitty-v0.28.1/7d2dc252f149.patch) = 737
+TIMESTAMP = 1689257329
+SHA256 (go/x11_kitty/kitty-v0.29.0/v0.29.0.mod) = 824f1a4725be13881152b849609fb73128c19513c25ec3e8495a298e627c3c02
+SIZE (go/x11_kitty/kitty-v0.29.0/v0.29.0.mod) = 1063
+SHA256 (go/x11_kitty/kitty-v0.29.0/v0.29.0.zip) = 8fa1e10b12c9af8c5e911a85baf6a1d6839d4e8c13bcb6465a94344708223470
+SIZE (go/x11_kitty/kitty-v0.29.0/v0.29.0.zip) = 8320600
diff --git a/x11/kitty/files/patch-docs_changelog.rst b/x11/kitty/files/patch-docs_changelog.rst
new file mode 100644
index 000000000000..da82a8ac5fda
--- /dev/null
+++ b/x11/kitty/files/patch-docs_changelog.rst
@@ -0,0 +1,29 @@
+--- docs/changelog.rst.orig	1979-11-29 23:00:00 UTC
++++ docs/changelog.rst
+@@ -2937,7 +2937,7 @@ Detailed list of changes
+ - A :doc:`new kitten <kittens/panel>` to create dock panels on X11 desktops
+   showing the output from arbitrary terminal programs.
+ 
+-- Reduce data sent to the GPU per render by 30% (:commit:`8dea5b3`)
++- Reduce data sent to the GPU per render by 30% (:commit:`8dea5b3e3ec1db8597f3a3649b5cefd52f41e409`)
+ 
+ - Implement changing the font size for individual top level (OS) windows
+   (:iss:`408`)
+@@ -3052,7 +3052,7 @@ Detailed list of changes
+ - Implement support for the SGR *faint* escape code to make text blend
+   into the background (:iss:`446`).
+ 
+-- Make the hints kitten a little smarter (:commit:`ad1109b`)
++- Make the hints kitten a little smarter (:commit:`ad1109b6fe0a6802ca4f77182a7a0b36086b3e9f`)
+   so that URLs that stretch over multiple lines are detected. Also improve
+   detection of surrounding brackets/quotes.
+ 
+@@ -3064,7 +3064,7 @@ Detailed list of changes
+ 
+ - Expand environment variables in config file include directives
+ 
+-- Allow programs running in kitty to read/write from the clipboard (:commit:`889ca77`).
++- Allow programs running in kitty to read/write from the clipboard (:commit:`889ca7791244253cb08fbc3eca8883a87fb943a7`).
+   By default only writing is allowed. This feature is supported in many
+   terminals, search for `OSC 52 clipboard` to find out more about using it.
+ 
diff --git a/x11/kitty/files/patch-docs_conf.py b/x11/kitty/files/patch-docs_conf.py
new file mode 100644
index 000000000000..a9775ffc7d43
--- /dev/null
+++ b/x11/kitty/files/patch-docs_conf.py
@@ -0,0 +1,23 @@
+--- docs/conf.py.orig	2023-05-12 12:26:28 UTC
++++ docs/conf.py
+@@ -207,18 +207,10 @@ def commit_role(
+     name: str, rawtext: str, text: str, lineno: int, inliner: Any, options: Any = {}, content: Any = []
+ ) -> Tuple[List[nodes.reference], List[nodes.problematic]]:
+     ' Link to a github commit '
+-    try:
+-        commit_id = subprocess.check_output(
+-            f'git rev-list --max-count=1 --skip=# {text}'.split()).decode('utf-8').strip()
+-    except Exception:
+-        msg = inliner.reporter.error(
+-            f'GitHub commit id "{text}" not recognized.', line=lineno)
+-        prb = inliner.problematic(rawtext, rawtext, msg)
+-        return [prb], [msg]
++    commit_id = text
+     url = f'https://github.com/kovidgoyal/kitty/commit/{commit_id}'
+     set_classes(options)
+-    short_id = subprocess.check_output(
+-        f'git rev-list --max-count=1 --abbrev-commit --skip=# {commit_id}'.split()).decode('utf-8').strip()
++    short_id = text[:9]
+     node = nodes.reference(rawtext, f'commit: {short_id}', refuri=url, **options)
+     return [node], []
+ # }}}
diff --git a/x11/kitty/files/patch-setup.py b/x11/kitty/files/patch-setup.py
index 8e2753461889..9a63378dbe51 100644
--- a/x11/kitty/files/patch-setup.py
+++ b/x11/kitty/files/patch-setup.py
@@ -1,11 +1,14 @@
---- setup.py.orig	2023-04-08 12:02:15 UTC
+--- setup.py.orig	2023-07-13 16:10:52 UTC
 +++ setup.py
-@@ -126,25 +126,9 @@ def libcrypto_flags() -> Tuple[List[str], List[str]]:
+@@ -130,27 +130,11 @@ def libcrypto_flags() -> Tuple[List[str], List[str]]:
      # Apple use their special snowflake TLS libraries and additionally
      # have an ancient broken system OpenSSL, so we need to check for one
      # installed by all the various macOS package managers.
 -    extra_pc_dir = ''
--
++    cflags = [f"-I{sys.prefix}/include"]
++    libs = [f"-L{sys.prefix}/lib", "-lcrypto"]
++    return cflags, libs
+ 
 -    try:
 -        cflags = pkg_config('libcrypto', '--cflags-only-I', fatal=False)
 -    except subprocess.CalledProcessError:
@@ -23,9 +26,18 @@
 -            extra_pc_dir = os.pathsep.join(openssl_dirs)
 -        cflags = pkg_config('libcrypto', '--cflags-only-I', extra_pc_dir=extra_pc_dir)
 -    return cflags, pkg_config('libcrypto', '--libs', extra_pc_dir=extra_pc_dir)
-+    cflags = [f"-I{sys.prefix}/include"]
-+    libs = [f"-L{sys.prefix}/lib", "-lcrypto"]
-+    return cflags, libs
- 
  
+-
  def at_least_version(package: str, major: int, minor: int = 0) -> None:
+     q = f'{major}.{minor}'
+     if subprocess.run([PKGCONFIG, package, f'--atleast-version={q}']
+@@ -1163,7 +1147,8 @@ def create_linux_bundle_gunk(ddir: str, libdir_name: s
+         make = 'gmake' if is_freebsd else 'make'
+         run_tool([make, 'docs'])
+     copy_man_pages(ddir)
+-    copy_html_docs(ddir)
++    if os.getenv('BUILD_DOCS') == 'yes':
++        copy_html_docs(ddir)
+     for (icdir, ext) in {'256x256': 'png', 'scalable': 'svg'}.items():
+         icdir = os.path.join(ddir, 'share', 'icons', 'hicolor', icdir, 'apps')
+         safe_makedirs(icdir)