Sunday, September 01, 2024

Re: Update Request for kitty Port to Version 0.36.1

Stuart Henderson wrote (2024-09-01 23:53 CEST):
> The nerd fonts distfile needs renaming to include the version number using
> the {url} syntax in DISTFILES, or maybe better write a separate port for
> that. (Ports will normally extract all distfiles under WRKDIR for you, so if
> not doing as a separate port, just move or link from the extracted dir
> rather than extracting again from DISTDIR)

Yes I know. The port was rushed and I gave up when I read openmp.

> When multiple distfiles are fetched from different sources, use the
> DISTFILES.suffix and SITE.suffix mechanism (added to ports since I wrote
> that diff)
>
> I think it would need a port of https://github.com/simd-everywhere/simde too

Attached is a devel/simde port.

Below an updated kitty diff that compiles and works.

The test target is a bit of an adventure...
test_ssh_copy (kitty_tests.ssh.SSHKitten.test_ssh_copy) ... Error: open /tmp/�j��X�UYպ�%�pt�?����N�}�ېLs.shm: invalid argument

And it fills up my /tmp with such files:
-rw------- 1 _pbuild wheel 30.8K Sep 2 07:32 x?????M??sŀ=_?d??}]yQ?F ?H'???-.shm
-rw------- 1 _pbuild wheel 30.8K Sep 2 07:31 ???%?8y??P???1?o?????p?$?k?\ ???.shm
...
I haven't looked into that yet.

Best regards,
Stefan

Index: x11/kitty/Makefile
===================================================================
RCS file: /cvs/ports/x11/kitty/Makefile,v
diff -u -p -u -p -r1.27 Makefile
--- x11/kitty/Makefile 6 May 2024 12:24:17 -0000 1.27
+++ x11/kitty/Makefile 2 Sep 2024 05:31:34 -0000
@@ -3,25 +3,29 @@ ONLY_FOR_ARCHS = aarch64 amd64 i386

COMMENT = fast, feature full, GPU-based terminal emulator

-# 0.27.1 runs the newly built kitty binary during build, but expects
-# it to be in the path (try PORTPATH=${WRKSRC}/linux-package/bin:${PATH})
-# build also fails if you have an older version of kitty installed -
-# it also wants to download go modules during build
-MODPY_EGG_VERSION = 0.26.5
+MODPY_EGG_VERSION = 0.36.1
DISTNAME = kitty-${MODPY_EGG_VERSION}
+DISTFILES = ${DISTNAME}${EXTRACT_SUFX}
+
+# the font could be a separate port
+FONT_V = 3.2.1
+DISTFILES.font = NerdFontsSymbolsOnly-${FONT_V}{NerdFontsSymbolsOnly}.tar.xz
+DISTFILES.vendor = kitty-vendor-${MODPY_EGG_VERSION}.tar.gz
CATEGORIES = x11
HOMEPAGE = https://sw.kovidgoyal.net/kitty/
-REVISION
= 1

# GPLv3+
PERMIT_PACKAGE = Yes

# canberra, fontconfig, freetype are loaded dynamically
-WANTLIB += GL X11 X11-xcb Xcursor Xinerama Xrandr c canberra crypto dbus-1
-WANTLIB += fontconfig freetype harfbuzz intl lcms2 m png pthread rsync
-WANTLIB += util xcb xkbcommon xkbcommon-x11 z ${MODPY_WANTLIB}
+WANTLIB += ${MODPY_WANTLIB} GL X11 X11-xcb Xcursor Xinerama Xrandr c
+WANTLIB += canberra crypto dbus-1 fontconfig freetype harfbuzz intl
+WANTLIB += lcms2 m png pthread rsync util xcb xkbcommon xkbcommon-x11
+WANTLIB += xxhash z

SITES = https://github.com/kovidgoyal/kitty/releases/download/v${MODPY_EGG_VERSION}/
+SITES.font = https://github.com/ryanoasis/nerd-fonts/releases/download/v$(FONT_V)/
+SITES.vendor = https://ptrace.org/
EXTRACT_SUFX = .tar.xz

# C11
@@ -30,6 +34,7 @@ COMPILER = base-clang ports-gcc
CFLAGS += "-DOPENSSL_clear_free=freezero"

MODULES = lang/python
+
MODPY_DISTUTILS_BUILD = linux-package
MODPY_SETUP_ARGS += --verbose \
--ignore-compiler-warnings \
@@ -38,6 +43,9 @@ MODPY_SETUP_ARGS += --verbose \
# this disables checking upstream for updates
MODPY_SETUP_ARGS += --update-check-interval=0

+MAKE_ARGS += NEON64_CFLAGS=" " \
+ AVX2_CFLAGS=" "
+
# optional dependencies:
# graphics/ImageMagick (to use the kitty icat tool to display images in
# the terminal)
@@ -49,26 +57,51 @@ LIB_DEPENDS = audio/libcanberra \
graphics/lcms2 \
graphics/png \
net/librsync \
+ sysutils/xxhash \
x11/dbus \
x11/xkbcommon

+BUILD_DEPENDS = devel/simde \
+ lang/go
+
TEST_ENV = CI=true \
TMPDIR=${WRKDIR}/tmp \
- KITTY_CACHE_DIRECTORY=${WRKDIR}/tmp/cache
+ KITTY_CACHE_DIRECTORY=${WRKDIR}/tmp/cache \
+ PYTHONPATH=${WRKSRC}

-# needed for 'make test'
+# runs newly-built binary during build
+PORTPATH = ${WRKSRC}/linux-package/bin:${PATH}
+PORTHOME = ${WRKDIR}
+
+# needed for 'make test'; lots of failures though
USE_GMAKE = Yes

pre-test:
mkdir -p ${WRKDIR}/tmp/cache
+ cp ${WRKSRC}/linux-package/bin/kitty ${WRKSRC}/kitty/launcher/
+
+pre-build:
+ mkdir -p $(WRKSRC)/fonts/
+ cp ${WRKDIR}/{SymbolsNerdFontMono-Regular.ttf,LICENSE} $(WRKSRC)/fonts/

do-install:
${INSTALL_PROGRAM} \
- ${WRKSRC}/linux-package/bin/kitty ${PREFIX}/bin/
+ ${WRKSRC}/linux-package/bin/{kitty,kitten} ${PREFIX}/bin/
${INSTALL_DATA_DIR} ${PREFIX}/lib/kitty
${INSTALL_MAN} ${WRKSRC}/linux-package/man/man1/kitty.1 \
${PREFIX}/man/man1/
@cp -R ${WRKSRC}/linux-package/lib/kitty/* ${PREFIX}/lib/kitty/
@cp -R ${WRKSRC}/linux-package/share/* ${PREFIX}/share/
+
+vendor: patch
+ cd ${WRKSRC}; \
+ ${_PBUILD} chmod -R ug=rwX,o=rX .; \
+ go mod tidy; \
+ go mod vendor; \
+ chmod -R ug=rwX,o=rX vendor; \
+ cd ..; \
+ ${_PBUILD} tar czf kitty-vendor-${MODPY_EGG_VERSION}.tar.gz \
+ kitty-${MODPY_EGG_VERSION}/vendor; \
+ readlink -f kitty-vendor-${MODPY_EGG_VERSION}.tar.gz

.include <bsd.port.mk>
Index: x11/kitty/distinfo
===================================================================
RCS file: /cvs/ports/x11/kitty/distinfo,v
diff -u -p -u -p -r1.9 distinfo
--- x11/kitty/distinfo 13 Mar 2023 12:55:18 -0000 1.9
+++ x11/kitty/distinfo 2 Sep 2024 05:31:34 -0000
@@ -1,2 +1,6 @@
-SHA256 (kitty-0.26.5.tar.xz) = VUSlgDFP7HcRGHzigWKQm17P9ngAcURP6W+5f4vlya0=
-SIZE (kitty-0.26.5.tar.xz) = 4749988
+SHA256 (NerdFontsSymbolsOnly-3.2.1.tar.xz) = t6Pu4k0rCRDzoHcF8eBTIh0lNfB8WhNhTE3q0mIOmXg=
+SHA256 (kitty-0.36.1.tar.xz) = SAgenYwxEKlh3eJwEq45kqRPfvCy/oYpXUWyS9dy2RE=
+SHA256 (kitty-vendor-0.36.1.tar.gz) = mgj5KuF4PKyexfW038v8ys6gW9GGoT9EGI2aI1GmYwA=
+SIZE (NerdFontsSymbolsOnly-3.2.1.tar.xz) = 1752504
+SIZE (kitty-0.36.1.tar.xz) = 8850472
+SIZE (kitty-vendor-0.36.1.tar.gz) = 2920432
Index: x11/kitty/patches/patch-glfw_backend_utils_c
===================================================================
RCS file: /cvs/ports/x11/kitty/patches/patch-glfw_backend_utils_c,v
diff -u -p -u -p -r1.2 patch-glfw_backend_utils_c
--- x11/kitty/patches/patch-glfw_backend_utils_c 11 Mar 2022 20:16:34 -0000 1.2
+++ x11/kitty/patches/patch-glfw_backend_utils_c 2 Sep 2024 05:31:34 -0000
@@ -3,7 +3,7 @@ We don't have posix_fallocate.
Index: glfw/backend_utils.c
--- glfw/backend_utils.c.orig
+++ glfw/backend_utils.c
-@@ -373,7 +373,7 @@ GLFWAPI char* utf_8_strndup(const char* source, size_t
+@@ -372,7 +372,7 @@ GLFWAPI char* utf_8_strndup(const char* source, size_t
* receive SIGBUS on accessing mmap()'ed file contents instead.
*/
int createAnonymousFile(off_t size) {
@@ -12,7 +12,7 @@ Index: glfw/backend_utils.c
#ifdef HAS_MEMFD_CREATE
fd = glfw_memfd_create("glfw-shared", MFD_CLOEXEC | MFD_ALLOW_SEALING);
if (fd < 0) return -1;
-@@ -383,10 +383,6 @@ int createAnonymousFile(off_t size) {
+@@ -382,10 +382,6 @@ int createAnonymousFile(off_t size) {
// There is also no need to check for the return value, we couldn't do
// anything with it anyway.
fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL);
@@ -23,7 +23,7 @@ Index: glfw/backend_utils.c
#else
static const char template[] = "/glfw-shared-XXXXXX";
const char* path;
-@@ -410,8 +406,7 @@ int createAnonymousFile(off_t size) {
+@@ -409,8 +405,7 @@ int createAnonymousFile(off_t size) {
if (fd < 0)
return -1;

No comments:

Post a Comment