Blob Blame History Raw
%if 0%{?fedora} >= 36
# Rawhide builds is broken,
#    see: https://bugzilla.redhat.com/show_bug.cgi?id=2043178,
#         https://bugzilla.redhat.com/show_bug.cgi?id=2048952
%undefine _package_note_file
%endif

%global optflags %{optflags} -Wno-array-bounds

%bcond_without test
%bcond_without doc

Name:           kitty
Version:        0.24.2
Release:        8%{?dist}
Summary:        Cross-platform, fast, feature full, GPU based terminal emulator

# BSD:          docs/_templates/searchbox.html
# zlib:         glfw/
License:        GPLv3 and zlib and BSD
URL:            https://sw.kovidgoyal.net/kitty
Source0:        https://github.com/kovidgoyal/kitty/releases/download/v%{version}/%{name}-%{version}.tar.xz

# Add AppData manifest file
# * https://github.com/kovidgoyal/kitty/pull/2088
Source1:        https://raw.githubusercontent.com/kovidgoyal/kitty/46c0951751444e4f4994008f0d2dcb41e49389f4/kitty/data/%{name}.appdata.xml

Source2:        kitty.sh
Source3:        kitty.fish

BuildRequires:  desktop-file-utils
BuildRequires:  gcc
BuildRequires:  lcms2-devel
BuildRequires:  libappstream-glib
BuildRequires:  librsync-devel
BuildRequires:  ncurses
BuildRequires:  python3-devel >= 3.7
BuildRequires:  wayland-devel

BuildRequires:  python3dist(setuptools)

BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(fontconfig)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(harfbuzz) >= 2.2
BuildRequires:  pkgconfig(libcanberra)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(wayland-protocols)
BuildRequires:  pkgconfig(xcursor)
BuildRequires:  pkgconfig(xi)
BuildRequires:  pkgconfig(xinerama)
BuildRequires:  pkgconfig(xkbcommon-x11)
BuildRequires:  pkgconfig(xrandr)
BuildRequires:  pkgconfig(zlib)

Requires:       python3%{?_isa}
Requires:       hicolor-icon-theme

# Terminfo file has been split from the main program and is required for use
# without errors. It has been separated to support SSH into remote machines using
# kitty as per the maintainers suggestion. Install the terminfo file on the remote
# machine.
Requires:       %{name}-terminfo = %{version}-%{release}

# Very weak dependencies, these are required to enable all features of kitty's
# "kittens" functions install separately
Recommends:     python3-pygments

Suggests:       ImageMagick%{?_isa}

%description
- Offloads rendering to the GPU for lower system load and buttery smooth
  scrolling. Uses threaded rendering to minimize input latency.

- Supports all modern terminal features: graphics (images), unicode, true-color,
  OpenType ligatures, mouse protocol, focus tracking, bracketed paste and
  several new terminal protocol extensions.

- Supports tiling multiple terminal windows side by side in different layouts
  without needing to use an extra program like tmux.

- Can be controlled from scripts or the shell prompt, even over SSH.

- Has a framework for Kittens, small terminal programs that can be used to
  extend kitty's functionality. For example, they are used for Unicode input,
  Hints and Side-by-side diff.

- Supports startup sessions which allow you to specify the window/tab layout,
  working directories and programs to run on startup.

- Cross-platform: kitty works on Linux and macOS, but because it uses only
  OpenGL for rendering, it should be trivial to port to other Unix-like
  platforms.

- Allows you to open the scrollback buffer in a separate window using arbitrary
  programs of your choice. This is useful for browsing the history comfortably
  in a pager or editor.

- Has multiple copy/paste buffers, like vim.


# terminfo package
%package        terminfo
Summary:        The terminfo file for Kitty Terminal
BuildArch:      noarch

Requires:       ncurses-base

%description    terminfo
Cross-platform, fast, feature full, GPU based terminal emulator.

The terminfo file for Kitty Terminal.


# doc package
%if %{with doc}
%package        doc
Summary:        Documentation for %{name}

BuildRequires:  python3dist(sphinx-copybutton)
BuildRequires:  python3dist(sphinx-inline-tabs)
BuildRequires:  python3dist(sphinx)
BuildRequires:  python3dist(sphinxext-opengraph)

%description    doc
This package contains the documentation for %{name}.
%endif


%prep
%autosetup -p1

# Changing sphinx theme to classic
sed "s/html_theme = 'furo'/html_theme = 'classic'/" -i docs/conf.py

# Replace python shebangs to make them compatible with fedora
find -type f -name "*.py" -exec sed -e 's|/usr/bin/env python3|%{__python3}|g'  \
                                    -e 's|/usr/bin/env python|%{__python3}|g'   \
                                    -i "{}" \;

# non-executable-script
sed -e "s/f.endswith('\.so')/f.endswith('\.so') or f.endswith('\.py')/g" -i setup.py

# script-without-shebang '__init__.py'
find -type f -name "*.py*" -exec chmod -x "{}"  \;


%install
%set_build_flags
%{__python3} setup.py linux-package \
    --libdir-name=%{_lib}           \
    --prefix=%{buildroot}%{_prefix} \
    --update-check-interval=0       \
    --verbose                       \
    --debug                         \
    --shell-integration "disabled"  \
    %{nil}
install -m0644 -Dp %{SOURCE1} %{buildroot}%{_metainfodir}/%{name}.appdata.xml

install -m0644 -Dp %{SOURCE2} %{buildroot}%{_sysconfdir}/profile.d/%{name}.sh
install -m0644 -Dp %{SOURCE3} %{buildroot}%{_sysconfdir}/fish/conf.d/%{name}.fish

sed "s|/usr/lib64/kitty|%{_libdir}/%{name}|" -i %{buildroot}%{_sysconfdir}/profile.d/%{name}.sh
sed "s|/usr/lib64/kitty|%{_libdir}/%{name}|" -i %{buildroot}%{_sysconfdir}/fish/conf.d/%{name}.fish

# script-without-shebang '__init__.py'
find %{buildroot} -type f -name "*.py*" -exec chmod -x "{}"  \;

%if %{with doc}
# rpmlint fixes
rm %{buildroot}%{_datadir}/doc/%{name}/html/.buildinfo \
   %{buildroot}%{_datadir}/doc/%{name}/html/.nojekyll
%endif


%check
%if %{with test}
export PATH=%{buildroot}%{_bindir}:$PATH
%{__python3} setup.py test          \
    --prefix=%{buildroot}%{_prefix} \
    %{nil}
%endif

appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.xml
desktop-file-validate %{buildroot}/%{_datadir}/applications/*.desktop


%files
%license LICENSE
%{_bindir}/%{name}
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/*/*/*.{png,svg}
%{_libdir}/%{name}/
%if %{with doc}
%{_mandir}/man{1,5}/*.{1,5}*
%endif
%{_metainfodir}/*.xml
%{_sysconfdir}/profile.d/%{name}.sh
%dir %{_sysconfdir}/fish
%dir %{_sysconfdir}/fish/conf.d
%{_sysconfdir}/fish/conf.d/%{name}.fish

%files terminfo
%license LICENSE
%{_datadir}/terminfo/x/xterm-%{name}

%if %{with doc}
%files doc
%license LICENSE
%doc CONTRIBUTING.md CHANGELOG.rst INSTALL.md
%{_docdir}/%{name}/html
%dir %{_docdir}/%{name}
%endif


%changelog
* Thu Feb 10 2022 Yaroslav Sidlovsky <zawertun@gmail.com> - 0.24.2-8
- Enable "_package_note_file" hack for Fedora >= 36

* Thu Feb 10 2022 Yaroslav Sidlovsky <zawertun@gmail.com> - 0.24.2-7
- Enable kitty shell integration only if env KITTY_PID is defined

* Tue Feb 08 2022 Yaroslav Sidlovsky <zawertun@gmail.com> - 0.24.2-6
- Disable shell integration by default

* Tue Feb 08 2022 Yaroslav Sidlovsky <zawertun@gmail.com> - 0.24.2-5
- Zsh integration can break zsh startup, disabled for now

* Mon Feb 07 2022 Yaroslav Sidlovsky <zawertun@gmail.com> - 0.24.2-4
- kitty.sh, kitty.fish - replace hardcoded path with %%{_libdir}/%%{name}

* Mon Feb 07 2022 Yaroslav Sidlovsky <zawertun@gmail.com> - 0.24.2-3
- Use --shell-integration param instead of modification of setup.py

* Mon Feb 07 2022 Yaroslav Sidlovsky <zawertun@gmail.com> - 0.24.2-2
- Disable user shell configuration files modification (RHBZ#2051454)

* Sat Feb 05 2022 Yaroslav Sidlovsky <zawertun@gmail.com> - 0.24.2-1
- build(update): 0.24.2

* Wed Feb 02 2022 Artem Polishchuk <ego.cordatus@gmail.com> - 0.24.1-1
- chore(update): 0.24.1 | feat @zawertun

* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.21.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.21.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Tue Jun 29 2021 Artem Polishchuk <ego.cordatus@gmail.com> - 0.21.2-1
- build(update): 0.21.2

* Mon Jun 14 2021 Miro Hrončok <mhroncok@redhat.com> - 0.21.1-2
- Run tests in %%check with currently-built kitty
- Fixes rhbz#1971563

* Mon Jun 14 2021 Artem Polishchuk <ego.cordatus@gmail.com> - 0.21.1-1
- build(update): 0.21.1

* Sat Jun 12 2021 Artem Polishchuk <ego.cordatus@gmail.com> - 0.21.0-1
- build(update): 0.21.0

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 0.20.3-2
- Rebuilt for Python 3.10

* Thu May 06 2021 Artem Polishchuk <ego.cordatus@gmail.com> - 0.20.3-1
- build(update): 0.20.3

* Wed Apr 28 2021 Artem Polishchuk <ego.cordatus@gmail.com> - 0.20.2-1
- build(update): 0.20.2

* Mon Apr 19 2021 Artem Polishchuk <ego.cordatus@gmail.com> - 0.20.1-1
- build(update): 0.20.1

* Mon Apr 19 2021 Artem Polishchuk <ego.cordatus@gmail.com> - 0.20.0-1
- build(update): 0.20.0

* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.19.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Sat Dec 19 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.19.3-1
- build(update): 0.19.3

* Fri Nov 13 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.19.2-1
- build(update): 0.19.2

* Tue Oct  6 16:34:51 EEST 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.19.1-1
- build(update): 0.19.1

* Sun Oct  4 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.19.0-1
- Update to 0.19.0
- build: add BR: lcms2-devel

* Fri Aug 28 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.18.3-3
- Enable building on s390x

* Mon Aug 24 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 0.18.3-2
- Support building on EPEL8

* Tue Aug 11 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.18.3-1
- Update to 0.18.3

* Tue Jul 28 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.18.2-1
- Update to 0.18.2

* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.18.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Fri Jul 24 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.18.1-2
- Add 'ncurses' BR explicitly to fix FTBFS for F33

* Tue Jun 23 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.18.1-1
- Update to 0.18.1

* Sat Jun 20 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.18.0-1
- Update to 0.18.0
- Disable LTO

* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 0.17.4-2
- Rebuilt for Python 3.9

* Sat May 09 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.17.4-1
- Update to 0.17.4

* Thu Apr 23 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.17.3-1
- Update to 0.17.3

* Sun Mar 29 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.17.2-1
- Update to 0.17.2

* Tue Mar 24 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.17.1-2
- Drop sedding build flags. Not needed anymore.
- Fix build step as upstream recommended
- Do not exclude ppc64le arch anymore

* Tue Mar 24 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.17.1-1
- Update to 0.17.1

* Tue Mar 24 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.17.0-1
- Update to 0.17.0
- Exclude arch ppc64le

* Mon Mar 09 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.16.0-3
- Fix AppData description - #1811657

* Thu Mar 05 2020 Than Ngo <than@redhat.com> - 0.16.0-2
- Fixed #1792789 - kitty fails to build

* Tue Jan 28 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.16.0-1
- Update to 0.16.0

* Thu Jan 02 2020 Artem Polishchuk <ego.cordatus@gmail.com> - 0.15.1-1
- Update to 0.15.1

* Wed Nov 27 2019 Artem Polishchuk <ego.cordatus@gmail.com> - 0.15.0-1
- Update to 0.15.0

* Sun Oct 20 2019 Artem Polishchuk <ego.cordatus@gmail.com> - 0.14.6-12
- Update to 0.14.6
- Spec file fixes
- Thanks to Vitaly Zaitsev <vitaly@easycoding.org>

* Fri Jul 12 2019 eskse <eskse@users.noreply.github.com> 0.14.2-1
- Initial version of file