File kitty.spec of Package kitty
#
# spec file for package kitty
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
#%%define furo_tag 2023.09.10
#%%define furo_version 2023.9.10
Name: kitty
Version: 0.36.2+git20240906.b47908961
Release: 0
Summary: A GPU-based terminal emulator
License: GPL-3.0-only
Group: System/X11/Terminals
URL: https://github.com/kovidgoyal/%{name}
### osc service manualrun (mr)
Source0: %{name}-%{version}.tar.gz
#####
### Using 'furo' wheel since builing furo relies on
# nodeenv access to https://www.npmjs.com/
### Swapping over to alabaster for documentation as pep-0668 doesn't
# [easily] allow for 'pip install furo.whl' - 20230814
# * https://peps.python.org/pep-0668/
### osc service runall download_files
#Source1: https://github.com/pradyunsg/furo/releases/download/%%{furo_tag}/furo-%%{furo_version}-py3-none-any.whl#/furo-%%{furo_version}-py3-none-any.whl
#####
Source2: vendor.tar.gz
Patch0: go-buildmode-pie.diff
Patch1: swapin-alabaster-for-furo.diff
BuildRequires: ImageMagick-devel
BuildRequires: Mesa-libGL-devel
BuildRequires: ca-certificates
BuildRequires: dejavu-fonts
BuildRequires: fdupes
BuildRequires: fontconfig-devel
BuildRequires: freetype2-devel
### Temporarily disabled until go1.23 is default
#BuildRequires: golang-packaging
BuildRequires: go >= 1.23
#####
BuildRequires: harfbuzz-devel >= 1.5.0
BuildRequires: libXcursor-devel
BuildRequires: libXi-devel
BuildRequires: libXinerama-devel
BuildRequires: libXrandr-devel
BuildRequires: libcanberra-devel
BuildRequires: liblcms2-devel
BuildRequires: libpng16-compat-devel
BuildRequires: librsync-devel
BuildRequires: libwayland-egl-devel
BuildRequires: ncurses-devel
BuildRequires: pkgconfig
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(libcrypto)
BuildRequires: pkgconfig(simde)
BuildRequires: pkgconfig(xkbcommon)
BuildRequires: pkgconfig(xkbcommon-x11)
BuildRequires: python3
BuildRequires: python3-Babel
BuildRequires: python3-Jinja2
BuildRequires: python3-MarkupSafe
BuildRequires: python3-Pygments
BuildRequires: python3-Sphinx
BuildRequires: python3-alabaster
BuildRequires: python3-beautifulsoup4
BuildRequires: python3-certifi
BuildRequires: python3-charset-normalizer
BuildRequires: python3-devel
BuildRequires: python3-docutils
BuildRequires: python3-idna
BuildRequires: python3-imagesize
BuildRequires: python3-packaging
### Need 'pip' to install 'furo' wheel.
#BuildRequires: python3-pip
#####
BuildRequires: python3-pyparsing
BuildRequires: python3-pytz
BuildRequires: python3-requests
BuildRequires: python3-setuptools
BuildRequires: python3-snowballstemmer
BuildRequires: python3-soupsieve
BuildRequires: python3-sphinx-inline-tabs
BuildRequires: python3-sphinx_basic_ng
BuildRequires: python3-sphinxcontrib-applehelp
BuildRequires: python3-sphinxcontrib-copybutton
BuildRequires: python3-sphinxcontrib-devhelp
BuildRequires: python3-sphinxcontrib-htmlhelp
BuildRequires: python3-sphinxcontrib-jsmath
BuildRequires: python3-sphinxcontrib-qthelp
BuildRequires: python3-sphinxcontrib-serializinghtml
BuildRequires: python3-sphinxext-opengraph
BuildRequires: python3-urllib3
BuildRequires: symbols-only-nerd-fonts
BuildRequires: terminfo
BuildRequires: wayland-devel
BuildRequires: wayland-protocols-devel
BuildRequires: xxhash-devel
BuildRequires: zlib-devel
### Without this, there's some weird readline error that references 'python39'
# specifically even though it's being run by python310 in TW.
# 'python310-base' was already installed
Requires: python3
#####
###
# The Conflicts here (meaning kitty-terminfo isn't installed when kitty is)
# stops 'sudo vim /path/to/some/file' from working w/o issue on a host that
# only has kitty + kitty-shell-integration installed.
# You can run 'kitten ssh <some host>' if kitty-terminfo isn't installed on a host
# that also has kitty + kitty-shell-integration installed to get a ~/.terminfo
# directory and a $TERMINFO env var; but that REFUSES to work w/ root and:
# Defaults env_keep += "TERMINFO"
#Conflicts: %%{name}-terminfo
#####
Recommends: %{name}-terminfo
Recommends: %{name}-shell-integration
Recommends: python3-importlib-resources
%description
A terminal emulator that uses OpenGL for rendering.
Supports terminal features like: graphics, Unicode,
true-color, OpenType ligatures, mouse protocol, focus tracking,
bracketed paste and so on, and which can be controlled by scripts.
%package terminfo
Summary: The terminfo file for the Kitty terminal
BuildArch: noarch
#Conflicts: kitty
%description terminfo
Provides 'xterm-kitty' terminfo file(s) for the Kitty terminal; this package can be installed on its own to provide file(s) instead of the full kitty package on remote systems.
%package shell-integration
Summary: The shell-integation file(s) for the Kitty terminal
# This breaks shell-integration when "--libdir-name %%{_lib}"
#BuildArch: noarch
%description shell-integration
shell-integration [bash,fish,zsh] file(s) for the Kitty terminal; this package can be installed on its own to provide file(s) instead of the full kitty package on remote systems.
%prep
### Switching the setup macro so vendor.tar.gz is put in place
#%%setup -q
%setup -q -a 2
#####
%patch -P 0
%patch -P 1
### Install furo wheel via pip
#pip install --user --no-index %%{SOURCE1}
#####
find . -type f -exec sed -i 's@#!%{_bindir}/env python3$@#!%{_bindir}/python3@' {} +
find . -type f -exec sed -i 's@#!%{_bindir}/env python$@#!%{_bindir}/python@' {} +
%build
%debug_package
%install
### This may NOT be required once gh#kovidgoyal/kitty#6422 is sorted out
# Set -Wno-error=switch flag to prevent compiler crashes
#export CFLAGS="${CFLAGS:-%%optflags} -Wno-error=switch"
#export CXXFLAGS="${CXXFLAGS:-%%optflags} -Wno-error=switch"
#####
python3 setup.py \
--verbose \
linux-package \
--prefix %{buildroot}%{_prefix} \
--libdir-name %{_lib} \
--extra-include-dirs %{_prefix}/include/libxkbcommon
# 20240622
# kitty/keys.c uses "#include <xkbcommon/xkbcommon.h>", but libxkbcommon-devel
# provides /usr/include/libxkbcommon/xkbcommon/xkbcommon.h, etc ...
# use _datadir/doc/packages/kitty vs. doc/kitty ...
mv %{buildroot}%{_datadir}/doc/kitty _doc
# This breaks shell-integration when "--libdir-name %%{_lib}"
#mkdir -p %%{buildroot}%%{_datadir}/%%{name}
#mv %%{buildroot}%%{_libdir}/%%{name}/shell-integration %%{buildroot}%%{_datadir}/%%{name}/shell-integration
%fdupes %{buildroot}%{_libdir}
%files
%license LICENSE
%doc CHANGELOG.rst README.asciidoc
%doc _doc/*
%{_bindir}/kitten
%{_bindir}/%{name}
%{_libdir}/%{name}
%exclude %{_libdir}/%{name}/shell-integration
%{_datadir}/applications/%{name}.desktop
%{_datadir}/applications/%{name}-open.desktop
%dir %{_datadir}/icons/hicolor/
%dir %{_datadir}/icons/hicolor/256x256/
%{_datadir}/icons/hicolor/256x256/apps/
%dir %{_datadir}/icons/hicolor/scalable/
%{_datadir}/icons/hicolor/scalable/apps/
%{_mandir}/man1/%{name}.1%{?ext_man}
%{_mandir}/man1/kitten*.1%{?ext_man}
%{_mandir}/man5/kitty.conf.5%{?ext_man}
%files terminfo
%license LICENSE
%doc CHANGELOG.rst README.asciidoc
%{_datadir}/terminfo/x/xterm-%{name}
%files shell-integration
%license LICENSE
%doc CHANGELOG.rst README.asciidoc
%{_libdir}/%{name}/shell-integration
# This breaks shell-integration when "--libdir-name %%{_lib}"
#%%dir %%{_datadir}/%%{name}
#%%{_datadir}/%%{name}/shell-integration
%changelog