Sunday, September 01, 2024

Re: Update Request for kitty Port to Version 0.36.1

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)

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

-- 
  Sent from a phone, apologies for poor formatting.


On 1 September 2024 22:02:38 Stefan Hagen <sh+openbsd-ports@codevoid.de> wrote:

Aditya Mukherjee wrote (2024-09-01 20:01 CEST):
Hello everyone, I am looking to contribute to OpenBSD.

I am currently using OpenBSD 7.5 and I extensively use the kitty terminal.
However, in the ports tree the package is out of date
<https://openports.pl/path/x11/kitty>. I would like to help bring this
package up to date with upstream which is currently v0.36.1
<https://github.com/kovidgoyal/kitty/releases/tag/v0.36.1>.

I have read the porting FAQ and the porting guide.

According to the porting guide, I should get in touch with the port
maintainer which according to the makefile, is ports@openbsd.org.

How can I help to bring the port up to the latest version?

Thank you for your time and for maintaining the ports collection.

Based on sthens previous attempt to update kitty to 0.27.1, I updated 
the vendor file, adapted the exiting patches and added a pre-build hook
that downloads a missing font, which is required to build.

It starts to build now, and stops at:

In file included from kitty/simd-string-128.c:9:
kitty/simd-string-impl.h:36:10: fatal error: 'simde/x86/avx2.h' file not found
#include <simde/x86/avx2.h>
         ^~~~~~~~~~~~~~~~~~
1 error generated.

My knowledge stops here. This seems to be the simd implementation from
openmp, which we don't have.

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 1 Sep 2024 19:54:32 -0000
@@ -3,15 +3,13 @@ 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} \
+ NerdFontsSymbolsOnly.tar.xz \
+ kitty-vendor-${MODPY_EGG_VERSION}.tar.gz
 CATEGORIES = x11
 HOMEPAGE = https://sw.kovidgoyal.net/kitty/
-REVISION = 1
 
 # GPLv3+
 PERMIT_PACKAGE = Yes
@@ -21,7 +19,9 @@ WANTLIB += GL X11 X11-xcb Xcursor Xinera
 WANTLIB += fontconfig freetype harfbuzz intl lcms2 m png pthread rsync
 WANTLIB += util xcb xkbcommon xkbcommon-x11 z ${MODPY_WANTLIB}
 
-SITES = https://github.com/kovidgoyal/kitty/releases/download/v${MODPY_EGG_VERSION}/
+SITES = https://github.com/kovidgoyal/kitty/releases/download/v${MODPY_EGG_VERSION}/ \
+ https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/ \
+ https://ptrace.org/
 EXTRACT_SUFX = .tar.xz
 
 # C11
@@ -30,6 +30,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 \
@@ -51,24 +52,46 @@ LIB_DEPENDS = audio/libcanberra \
  net/librsync \
  x11/dbus \
  x11/xkbcommon
+BUILD_DEPENDS = lang/go
 
 TEST_ENV = CI=true \
  TMPDIR=${WRKDIR}/tmp \
- KITTY_CACHE_DIRECTORY=${WRKDIR}/tmp/cache
+ KITTY_CACHE_DIRECTORY=${WRKDIR}/tmp/cache \
+ PYTHONPATH=${WRKSRC}
+
+# runs newly-built binary during build
+PORTPATH = ${WRKSRC}/linux-package/bin:${PATH}
+PORTHOME = ${WRKDIR}
 
-# needed for 'make test'
+# 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
+ cd $(WRKSRC)/fonts && xz -d -c $(DISTDIR)/NerdFontsSymbolsOnly.tar.xz | tar xvf -
 
 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 1 Sep 2024 19:54:32 -0000
@@ -1,2 +1,6 @@
-SHA256 (kitty-0.26.5.tar.xz) = VUSlgDFP7HcRGHzigWKQm17P9ngAcURP6W+5f4vlya0=
-SIZE (kitty-0.26.5.tar.xz) = 4749988
+SHA256 (NerdFontsSymbolsOnly.tar.xz) = t6Pu4k0rCRDzoHcF8eBTIh0lNfB8WhNhTE3q0mIOmXg=
+SHA256 (kitty-0.36.1.tar.xz) = SAgenYwxEKlh3eJwEq45kqRPfvCy/oYpXUWyS9dy2RE=
+SHA256 (kitty-vendor-0.36.1.tar.gz) = mgj5KuF4PKyexfW038v8ys6gW9GGoT9EGI2aI1GmYwA=
+SIZE (NerdFontsSymbolsOnly.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 1 Sep 2024 19:54:32 -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