diff --git a/kitty.be0 b/kitty.be0 new file mode 100755 index 000000000..79fdfb999 --- /dev/null +++ b/kitty.be0 @@ -0,0 +1,129 @@ +#!/usr/bin/env beesh + +# BEE_VERSION kitty-0.48.2-0 + +# kitty, a GPU-accelerated terminal emulator (https://sw.kovidgoyal.net/kitty/). +# +# Built the same way distros package it: `setup.py linux-package`, which +# compiles the C extensions and the Go-based kitten launcher/helpers, then +# assembles a full /usr tree directly at the given --prefix. +# +# NOTE: unlike current git HEAD, v0.48.2 ships its GPU shaders as plain +# .glsl files compiled at runtime by OpenGL itself (kitty/*.glsl, loaded via +# read_kitty_resource() in kitty/shaders.py) -- it does not use the Slang +# shading language / slangc at all, so shader-slang.be0 is NOT a dependency +# of this package (that only becomes true for a future kitty version built +# past the commit that introduces kitty/shaders/slang.py). +# +# kitty's freetype.c unconditionally uses FT_Get_Color_Glyph_Paint/COLRv1, +# added in FreeType 2.13; the system freetype.be0 here predates that. Rather +# than bump a foundational package shared by cairo/fontconfig/the whole X11 +# stack just for kitty, build a private, static-only, PIC FreeType under +# ${B} (see mee_build) and link it straight into fast_data_types.so -- +# same self-contained, no-added-runtime-dependency approach as simde above, +# just needing an actual compile step since FreeType isn't header-only. +# +# Build-time deps beyond the usual toolchain (gcc/clang, pkg-config, go, python3): +# harfbuzz, libcanberra, xxhash, lcms2, pixman, cairo, fontconfig, openssl, +# zlib, libpng16, libX11, libXcursor, libXext, libXfixes, libXi, +# libXinerama, libXrandr, libXrender, libxkbcommon, dbus, systemd +#SRCURL[0]="https://github.com/kovidgoyal/kitty/archive/v${PKGVERSION}/kitty-${PKGVERSION}.tar.gz" +SRCURL[0]="https://beehive.molgen.mpg.de/09d47f66904d7d54c9c1ff42b20082f1/kitty-0.48.2.tar.gz" + +# kitty's build requires the Symbols NERD Font Mono either installed +# system-wide or placed at fonts/SymbolsNerdFontMono-Regular.ttf (used to +# bake in fallback glyph coverage); no system package for it exists here, +# so fetch upstream's symbols-only release bundle and take just that one +# file (see mee_extract below). This release tarball has no wrapping +# top-level directory, unlike SRCURL[0], and kitty's own top-level LICENSE +# file would collide with the bundle's own LICENSE if both were extracted +# into ${S} the normal way -- so pull only the one member we need straight +# into fonts/ instead of extracting the whole tarball into ${S}. +#SRCURL[1]="https://github.com/ryanoasis/nerd-fonts/releases/download/v3.5.1/NerdFontsSymbolsOnly.tar.xz" +SRCURL[1]="https://beehive.molgen.mpg.de/dba0eb44655774e667d17cb3f7a265e7/NerdFontsSymbolsOnly.tar.xz" + +# simde (SIMD Everywhere): header-only, no runtime dependency at all -- it's +# pure headers consumed only while compiling kitty/simd-string-impl.h +# (#include and friends). No need for a full system +# package: fetch it, drop the headers under ${B}, and point the compiler at +# them via setup.py's --extra-include-dirs for this build only. +#SRCURL[2]="https://github.com/simd-everywhere/simde/archive/v0.8.2/simde-0.8.2.tar.gz" +SRCURL[2]="https://beehive.molgen.mpg.de/14323994d1f791e985c59ddf0b559e35/simde-0.8.2.tar.gz" + +# FreeType 2.14.3, built privately and statically -- see mee_build. +#SRCURL[3]="https://download.savannah.gnu.org/releases/freetype/freetype-2.14.3.tar.xz" +SRCURL[3]="https://beehive.molgen.mpg.de/5e78e6fdce5a61d3075e4c25e9852f84/freetype-2.14.3.tar.xz" + +# PATCHURL+=() + +build_in_sourcedir + +# sourcesubdir_append src + +mee_extract() { + bee_extract "${1}" + mkdir -p "${S}/fonts" + bee_extract_do_tar "${2}" "${S}/fonts" SymbolsNerdFontMono-Regular.ttf + mkdir -p "${B}/simde-src" + bee_extract_do_tar "${3}" "${B}/simde-src" --strip-components 1 + mkdir -p "${B}/freetype-src" + bee_extract_do_tar "${4}" "${B}/freetype-src" --strip-components 1 +} + +#mee_patch() { +# bee_patch "${@}" +#} + +mee_patch_post() { + # Building the man pages / HTML docs requires Sphinx (plus furo, + # sphinx-copybutton, sphinxext-opengraph, sphinx-design, sphinx-autobuild) + # and matplotlib with its own dependency tree (numpy, Pillow, fonttools, + # ...) -- none of which are packaged here. None of that is needed for a + # working terminal, so skip generating and bundling docs. + sed -i \ + -e "s/^ skip_docs = False$/ skip_docs = True/" \ + -e "s/^ if not os.path.exists('docs\/_build\/html'):$/ if False:/" \ + ${S}/setup.py +} + +# not needed: kitty itself is built by setup.py in one shot, and FreeType +# is configured as part of mee_build below. +mee_configure() { + : +} + +mee_build() { + # Static-only (no libfreetype.so at all -- the linker then has no + # choice but to pull in the .a) and PIC (required to link a static lib + # into fast_data_types.so, a shared object). Drop the optional + # harfbuzz/bzip2/png/brotli integrations: kitty links harfbuzz directly + # itself for text shaping, and none of this is needed just to satisfy + # kitty's freetype.c. + ( + cd ${B}/freetype-src + start_cmd ./configure \ + --prefix=${B}/local \ + --disable-shared --enable-static --with-pic \ + --with-harfbuzz=no --with-bzip2=no --with-png=no --with-brotli=no --with-zlib=yes + start_cmd make -j"$(nproc)" + start_cmd make install + ) +} + +mee_install() { + export GOPATH=${B}/bee_go + export GOCACHE=${B}/.cache + export GOENV=${B}/.env + # Go's module cache is read-only by default (0444/0555), which makes a + # later `bee -c` rebuild's cleanup of this build dir fail with EPERM. + export GOFLAGS=-modcacherw + # kitty gets freetype2's cflags/libs transitively, via cairo-fc's + # pkg-config Requires. Putting our private, static FreeType first on + # PKG_CONFIG_PATH makes that resolve to it instead of the system's + # (older, shared) one -- and since no libfreetype.so exists here at + # all, the linker has nothing to pick but our static libfreetype.a. + export PKG_CONFIG_PATH="${B}/local/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}" + python3 setup.py linux-package \ + --extra-include-dirs=${B}/simde-src \ + --prefix=${D}${PREFIX} +}