c466d3f
%global optflags %{optflags} -Wno-array-bounds
c466d3f
ef79955
%bcond_without test
4841115
%bcond_without doc
4841115
91033f9
Name:           kitty
6a2cdf6
Version:        0.26.5
a0f023a
Release:        %autorelease
91033f9
Summary:        Cross-platform, fast, feature full, GPU based terminal emulator
d38747d
91033f9
# BSD:          docs/_templates/searchbox.html
66fa275
# zlib:         glfw/
91033f9
License:        GPLv3 and zlib and BSD
91033f9
URL:            https://sw.kovidgoyal.net/kitty
e5fac45
Source0:        https://github.com/kovidgoyal/kitty/releases/download/v%{version}/%{name}-%{version}.tar.xz
abca6ae
Source4:        https://github.com/kovidgoyal/kitty/releases/download/v%{version}/%{name}-%{version}.tar.xz.sig
abca6ae
Source5:        https://calibre-ebook.com/signatures/kovid.gpg
1c6d656
5f2daf8
# Add AppData manifest file
5f2daf8
# * https://github.com/kovidgoyal/kitty/pull/2088
91033f9
Source1:        https://raw.githubusercontent.com/kovidgoyal/kitty/46c0951751444e4f4994008f0d2dcb41e49389f4/kitty/data/%{name}.appdata.xml
91033f9
8f19957
Source2:        kitty.sh
8f19957
Source3:        kitty.fish
8f19957
11c3022
## upstream patches
ec93fc4
# https://github.com/kovidgoyal/kitty/commit/51bba9110e9920afbefeb981e43d0c1728051b5e
ec93fc4
Patch1:         kitty-fix-clone-in-kitty.patch
2d0c1e1
# https://github.com/kovidgoyal/kitty/commit/a6a3e5e67def9388724252e1c2ed850f8e127014
2d0c1e1
# https://github.com/kovidgoyal/kitty/commit/60a7a53ccdac88dc728ac4f9e9295d64990e868c
2d0c1e1
Patch2:         kitty-fix-cve.patch
ec93fc4
ec93fc4
# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
ec93fc4
ExcludeArch:    %{ix86}
11c3022
abca6ae
BuildRequires:  gnupg2
91033f9
BuildRequires:  desktop-file-utils
91033f9
BuildRequires:  gcc
ec93fc4
%if 0%{?el8}
ec93fc4
BuildRequires:  python38-devel
ec93fc4
BuildRequires:  python38-setuptools
ec93fc4
%else
ec93fc4
BuildRequires:  python3-devel
ec93fc4
BuildRequires:  python3-setuptools
ec93fc4
%endif
e31d7d3
BuildRequires:  lcms2-devel
91033f9
BuildRequires:  libappstream-glib
65fd7ee
BuildRequires:  librsync-devel
5b8c44c
BuildRequires:  ncurses
91033f9
BuildRequires:  wayland-devel
91033f9
BuildRequires:  pkgconfig(dbus-1)
91033f9
BuildRequires:  pkgconfig(fontconfig)
91033f9
BuildRequires:  pkgconfig(gl)
ec93fc4
BuildRequires:  pkgconfig(harfbuzz)
91033f9
BuildRequires:  pkgconfig(libcanberra)
91033f9
BuildRequires:  pkgconfig(libpng)
65fd7ee
BuildRequires:  pkgconfig(wayland-protocols)
91033f9
BuildRequires:  pkgconfig(xcursor)
91033f9
BuildRequires:  pkgconfig(xi)
91033f9
BuildRequires:  pkgconfig(xinerama)
91033f9
BuildRequires:  pkgconfig(xkbcommon-x11)
91033f9
BuildRequires:  pkgconfig(xrandr)
91033f9
BuildRequires:  pkgconfig(zlib)
617544d
BuildRequires:  pkgconfig(libcrypto)
98de06c
d812736
# For tests:
d812736
BuildRequires:  /usr/bin/ssh
d812736
BuildRequires:  /usr/bin/getent
ec93fc4
%if 0%{?el8}
ec93fc4
Requires:       python38%{?_isa}
ec93fc4
%else
91033f9
Requires:       python3%{?_isa}
ec93fc4
%endif
91033f9
Requires:       hicolor-icon-theme
91033f9
bbe6285
Suggests:       %{name}-bash-integration
bbe6285
Suggests:       %{name}-fish-integration
bbe6285
5f2daf8
# Terminfo file has been split from the main program and is required for use
5f2daf8
# without errors. It has been separated to support SSH into remote machines using
5f2daf8
# kitty as per the maintainers suggestion. Install the terminfo file on the remote
5f2daf8
# machine.
91033f9
Requires:       %{name}-terminfo = %{version}-%{release}
91033f9
5f2daf8
# Very weak dependencies, these are required to enable all features of kitty's
5f2daf8
# "kittens" functions install separately
91033f9
Recommends:     python3-pygments
c9d2efd
91033f9
Suggests:       ImageMagick%{?_isa}
91033f9
91033f9
%description
91033f9
- Offloads rendering to the GPU for lower system load and buttery smooth
91033f9
  scrolling. Uses threaded rendering to minimize input latency.
91033f9
91033f9
- Supports all modern terminal features: graphics (images), unicode, true-color,
91033f9
  OpenType ligatures, mouse protocol, focus tracking, bracketed paste and
91033f9
  several new terminal protocol extensions.
91033f9
91033f9
- Supports tiling multiple terminal windows side by side in different layouts
91033f9
  without needing to use an extra program like tmux.
91033f9
91033f9
- Can be controlled from scripts or the shell prompt, even over SSH.
91033f9
91033f9
- Has a framework for Kittens, small terminal programs that can be used to
91033f9
  extend kitty's functionality. For example, they are used for Unicode input,
91033f9
  Hints and Side-by-side diff.
91033f9
91033f9
- Supports startup sessions which allow you to specify the window/tab layout,
91033f9
  working directories and programs to run on startup.
91033f9
91033f9
- Cross-platform: kitty works on Linux and macOS, but because it uses only
91033f9
  OpenGL for rendering, it should be trivial to port to other Unix-like
91033f9
  platforms.
91033f9
91033f9
- Allows you to open the scrollback buffer in a separate window using arbitrary
91033f9
  programs of your choice. This is useful for browsing the history comfortably
91033f9
  in a pager or editor.
91033f9
91033f9
- Has multiple copy/paste buffers, like vim.
91033f9
91033f9
bbe6285
# bash integration package
bbe6285
%package        bash-integration
bbe6285
Summary:        Automatic Bash integration for Kitty Terminal
bbe6285
BuildArch:      noarch
bbe6285
bbe6285
%description    bash-integration
bbe6285
Cross-platform, fast, feature full, GPU based terminal emulator.
bbe6285
bbe6285
Bash integration for Kitty Terminal.
bbe6285
bbe6285
bbe6285
# fish integration package
bbe6285
%package        fish-integration
bbe6285
Summary:        Automatic Fish integration for Kitty Terminal
bbe6285
BuildArch:      noarch
bbe6285
bbe6285
%description    fish-integration
bbe6285
Cross-platform, fast, feature full, GPU based terminal emulator.
bbe6285
bbe6285
Fish integration for Kitty Terminal.
bbe6285
bbe6285
4ecce33
# terminfo package
91033f9
%package        terminfo
91033f9
Summary:        The terminfo file for Kitty Terminal
91033f9
BuildArch:      noarch
91033f9
91033f9
Requires:       ncurses-base
91033f9
91033f9
%description    terminfo
91033f9
Cross-platform, fast, feature full, GPU based terminal emulator.
91033f9
91033f9
The terminfo file for Kitty Terminal.
91033f9
91033f9
4ecce33
# doc package
4841115
%if %{with doc}
91033f9
%package        doc
91033f9
Summary:        Documentation for %{name}
91033f9
67e501a
BuildRequires:  python3dist(sphinx)
67e501a
%if ! 0%{?epel}
65fd7ee
BuildRequires:  python3dist(sphinx-copybutton)
65fd7ee
BuildRequires:  python3dist(sphinx-inline-tabs)
65fd7ee
BuildRequires:  python3dist(sphinxext-opengraph)
67e501a
%endif
91033f9
91033f9
%description    doc
91033f9
This package contains the documentation for %{name}.
4841115
%endif
91033f9
91033f9
91033f9
%prep
abca6ae
%{gpgverify} --keyring='%{SOURCE5}' --signature='%{SOURCE4}' --data='%{SOURCE0}'
99eb880
%autosetup -p1
ec35ed4
65fd7ee
# Changing sphinx theme to classic
65fd7ee
sed "s/html_theme = 'furo'/html_theme = 'classic'/" -i docs/conf.py
65fd7ee
91033f9
# Replace python shebangs to make them compatible with fedora
877bd27
find -type f -name "*.py" -exec sed -e 's|/usr/bin/env python3|%{__python3}|g'    \
877bd27
                                    -e 's|/usr/bin/env python|%{__python3}|g'     \
877bd27
                                    -e 's|/usr/bin/env -S kitty|/usr/bin/kitty|g' \
5f2daf8
                                    -i "{}" \;
91033f9
91033f9
# non-executable-script
91033f9
sed -e "s/f.endswith('\.so')/f.endswith('\.so') or f.endswith('\.py')/g" -i setup.py
91033f9
91033f9
# script-without-shebang '__init__.py'
3221c11
find -type f -name "*.py*" -exec chmod -x "{}"  \;
91033f9
91033f9
ec93fc4
%build
4ecce33
%set_build_flags
ec35ed4
%{__python3} setup.py linux-package \
5f2daf8
    --libdir-name=%{_lib}           \
5f2daf8
    --update-check-interval=0       \
65fd7ee
    --verbose                       \
ec93fc4
%if 0%{?el8}
ec93fc4
    --ignore-compiler-warnings      \
ec93fc4
%endif
0c18157
    --shell-integration "disabled"  \
65fd7ee
    %{nil}
8c7f2fb
ec93fc4
%install
ec93fc4
cp -r linux-package %{buildroot}%{_prefix}
87f8946
install -m0644 -Dp %{SOURCE1} %{buildroot}%{_metainfodir}/%{name}.appdata.xml
d812736
8c7f2fb
install -m0644 -Dp %{SOURCE2} %{buildroot}%{_sysconfdir}/profile.d/%{name}.sh
8c7f2fb
install -m0644 -Dp %{SOURCE3} %{buildroot}%{_sysconfdir}/fish/conf.d/%{name}.fish
8c7f2fb
160f7fa
sed 's|KITTY_INSTALLATION_DIR=.*|KITTY_INSTALLATION_DIR="%{_libdir}/%{name}"|' \
160f7fa
 -i %{buildroot}%{_sysconfdir}/profile.d/%{name}.sh
160f7fa
sed 's|set -l KITTY_INSTALLATION_DIR .*|set -l KITTY_INSTALLATION_DIR "%{_libdir}/%{name}"|' \
160f7fa
 -i %{buildroot}%{_sysconfdir}/fish/conf.d/%{name}.fish
91033f9
91033f9
# script-without-shebang '__init__.py'
45de9c9
find %{buildroot} -type f -name "*.py*" ! -name askpass.py -exec chmod -x "{}"  \;
91033f9
4841115
%if %{with doc}
91033f9
# rpmlint fixes
66fa275
rm %{buildroot}%{_datadir}/doc/%{name}/html/.buildinfo \
66fa275
   %{buildroot}%{_datadir}/doc/%{name}/html/.nojekyll
4841115
%endif
91033f9
cc819bf
mv %{buildroot}%{_datadir}/applications/kitty-open.desktop kitty-open.desktop.example
cc819bf
sed -i '1i# This desktop file can execute any script (even if not marked as executable) with a shebang without '\
cc819bf
'asking for permission\n# See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1034875' kitty-open.desktop.example
91033f9
91033f9
%check
ef79955
%if %{with test}
87f8946
# Some tests ignores PATH env...
87f8946
mkdir -p kitty/launcher
87f8946
ln -s %{buildroot}%{_bindir}/%{name} kitty/launcher/
01ad92e
export PATH=%{buildroot}%{_bindir}:$PATH
ec93fc4
export PYTHONPATH=$(pwd)
ec93fc4
export TERM=xterm-kitty
65fd7ee
%{__python3} setup.py test          \
ec93fc4
    --prefix=%{buildroot}%{_prefix}
ef79955
%endif
8f872ca
baca20f
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.xml
91033f9
desktop-file-validate %{buildroot}/%{_datadir}/applications/*.desktop
91033f9
91033f9
91033f9
%files
91033f9
%license LICENSE
cc819bf
%doc kitty-open.desktop.example
91033f9
%{_bindir}/%{name}
91033f9
%{_datadir}/applications/*.desktop
65fd7ee
%{_datadir}/icons/hicolor/*/*/*.{png,svg}
ec35ed4
%{_libdir}/%{name}/
4841115
%if %{with doc}
1c6d656
%{_mandir}/man{1,5}/*.{1,5}*
4841115
%endif
91033f9
%{_metainfodir}/*.xml
bbe6285
bbe6285
%files bash-integration
8f19957
%{_sysconfdir}/profile.d/%{name}.sh
bbe6285
bbe6285
%files fish-integration
8f19957
%dir %{_sysconfdir}/fish
8f19957
%dir %{_sysconfdir}/fish/conf.d
8f19957
%{_sysconfdir}/fish/conf.d/%{name}.fish
91033f9
91033f9
%files terminfo
91033f9
%license LICENSE
91033f9
%{_datadir}/terminfo/x/xterm-%{name}
91033f9
4841115
%if %{with doc}
91033f9
%files doc
91033f9
%license LICENSE
91033f9
%doc CONTRIBUTING.md CHANGELOG.rst INSTALL.md
65fd7ee
%{_docdir}/%{name}/html
65fd7ee
%dir %{_docdir}/%{name}
4841115
%endif
91033f9
91033f9
91033f9
%changelog
a0f023a
%autochangelog