6c68fb8
%bcond test 1
6c68fb8
%bcond bundled 0
02d007b
%if 0%{?epel}
6c68fb8
%bcond bundled 1
02d007b
%endif
02d007b
%if %{with bundled}
02d007b
%global gomodulesmode GO111MODULE=on
02d007b
%endif
4841115
595d70c
%global goipath kitty
595d70c
91033f9
Name:           kitty
86491bc
Version:        0.34.1
a0f023a
Release:        %autorelease
91033f9
Summary:        Cross-platform, fast, feature full, GPU based terminal emulator
d38747d
6884d02
# GPL-3.0-only: kitty
784bdb7
# Zlib: glfw
784bdb7
# LGPL-2.1-or-later: kitty/iqsort.h
d25563e
# BSD-1-Clause: 3rdparty/uthash.h
6884d02
# MIT: docs/_static/custom.css, shell-integration/ssh/bootstrap-utils.sh
d25563e
# MIT AND CC0-1.0: simde
d25563e
# CC0-1.0: 3rdparty/ringbuf
d25563e
# BSD-2-Clause: 3rdparty/base64
02d007b
# Go dependencies:
02d007b
# github.com/alecthomas/chroma: MIT
02d007b
# github.com/ALTree/bigfloat: MIT
02d007b
# github.com/bmatcuk/doublestar: MIT
02d007b
# github.com/dlclark/regexp2: MIT
e4f01a1
# github.com/edwvee/exiffix: MIT
e4f01a1
# github.com/go-ole/go-ole: MIT
02d007b
# github.com/google/go-cmp/cmp: BSD-3-Clause
02d007b
# github.com/google/uuid: BSD-3-Clause
0195613
# github.com/klauspost/cpuid: MIT
e4f01a1
# github.com/kovidgoyal/imaging: MIT
02d007b
# github.com/lufia/plan9stats: BSD-3-Clause
02d007b
# github.com/power-devops/perfstat: MIT
02d007b
# github.com/seancfoley/bintree: Apache-2.0
02d007b
# github.com/seancfoley/ipaddress-go/ipaddr: Apache-2.0
02d007b
# github.com/shirou/gopsutil: BSD-3-Clause
02d007b
# github.com/shoenig/go-m1cpu: MPL-2.0
02d007b
# github.com/tklauser/go-sysconf: BSD-3-Clause
02d007b
# github.com/tklauser/numcpus: Apache-2.0
0195613
# github.com/zeebo/xxh3: BSD-2-Clause
02d007b
# golang.org/x/exp: BSD-3-Clause
02d007b
# golang.org/x/image: BSD-3-Clause
02d007b
# golang.org/x/sys: BSD-3-Clause
02d007b
# howett.net/plist: BSD-2-Clause AND BSD-3-Clause
e4f01a1
# github.com/rwcarlsen/goexif: BSD-2-Clause
d25563e
License:        GPL-3.0-only AND LGPL-2.1-or-later AND Zlib AND BSD-1-Clause AND (MIT AND CC0-1.0) AND BSD-2-Clause AND CC0-1.0
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
02d007b
# git clone https://github.com/kovidgoyal/kitty.git
02d007b
# cd kitty
02d007b
# git checkout v%%{version}
02d007b
# go mod vendor
02d007b
# tar czf kitty-%%{version}-vendor.tar.gz vendor
595d70c
# Source6:        kitty-%%{version}-vendor.tar.gz
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
6884d02
# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
2508075
ExcludeArch:    %{ix86}
784bdb7
6a699e4
BuildRequires:  golang >= 1.22.0
784bdb7
BuildRequires:  go-rpm-macros
11c3022
abca6ae
BuildRequires:  gnupg2
91033f9
BuildRequires:  desktop-file-utils
91033f9
BuildRequires:  gcc
e31d7d3
BuildRequires:  lcms2-devel
91033f9
BuildRequires:  libappstream-glib
5b8c44c
BuildRequires:  ncurses
806e89e
BuildRequires:  python3-devel >= 3.8
91033f9
BuildRequires:  wayland-devel
d25563e
BuildRequires:  simde-static
ef79955
91033f9
BuildRequires:  pkgconfig(dbus-1)
91033f9
BuildRequires:  pkgconfig(fontconfig)
91033f9
BuildRequires:  pkgconfig(gl)
65fd7ee
BuildRequires:  pkgconfig(harfbuzz) >= 2.2
91033f9
BuildRequires:  pkgconfig(libcanberra)
91033f9
BuildRequires:  pkgconfig(libpng)
0195613
BuildRequires:  pkgconfig(libxxhash)
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
784bdb7
%if %{with test}
d812736
# For tests:
6c68fb8
BuildRequires:  fish
6c68fb8
BuildRequires:  glibc-common
6c68fb8
BuildRequires:  openssh-clients
6c68fb8
BuildRequires:  ripgrep
6c68fb8
BuildRequires:  zsh
784bdb7
BuildRequires:  python3dist(pillow)
784bdb7
%endif
d812736
91033f9
Requires:       python3%{?_isa}
91033f9
Requires:       hicolor-icon-theme
91033f9
6884d02
Obsoletes:      %{name}-bash-integration < 0.28.1-3
6884d02
Obsoletes:      %{name}-fish-integration < 0.28.1-3
666c677
Provides:       %{name}-bash-integration = %{version}-%{release}
666c677
Provides:       %{name}-fish-integration = %{version}-%{release}
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}
9f40a27
Requires:       %{name}-shell-integration = %{version}-%{release}
4af571a
Requires:       %{name}-kitten%{?_isa} = %{version}-%{release}
91033f9
6884d02
# For the "Hyperlinked grep" feature
6884d02
Recommends:     ripgrep
c9d2efd
6c68fb8
# Very weak dependencies, these are required to enable all features of kitty's
6c68fb8
# "kittens" functions install separately
91033f9
Suggests:       ImageMagick%{?_isa}
91033f9
63ce9e9
Provides:       bundled(uthash) = 2.3.0^1.gitca98384
63ce9e9
# modified version of https://github.com/dhess/c-ringbuf
63ce9e9
Provides:       bundled(c-ringbuf)
63ce9e9
# heavily modified
63ce9e9
Provides:       bundled(glfw)
63ce9e9
# https://github.com/aklomp/base64
63ce9e9
Provides:       bundled(base64simd)
63ce9e9
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
4ecce33
# terminfo package
91033f9
%package        terminfo
91033f9
Summary:        The terminfo file for Kitty Terminal
4af571a
License:        GPL-3.0-only
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
02d007b
# shell-integration package
9f40a27
%package        shell-integration
9f40a27
Summary:        Shell integration scripts for %{name}
4af571a
License:        GPL-3.0-only AND MIT
9f40a27
BuildArch:      noarch
9f40a27
4af571a
Recommends:     %{name}-kitten
4af571a
9f40a27
%description    shell-integration
9f40a27
%{summary}.
91033f9
4af571a
# kitten package
4af571a
%package        kitten
4af571a
Summary:        The kitten executable
4af571a
License:        GPL-3.0-only AND MIT AND BSD-3-Clause AND BSD-2-Clause AND Apache-2.0 AND MPL-2.0 AND (BSD-2-Clause AND BSD-3-Clause)
4af571a
4af571a
%description    kitten
4af571a
%{summary}.
4af571a
91033f9
%package        doc
91033f9
Summary:        Documentation for %{name}
4af571a
License:        GPL-3.0-only AND MIT
784bdb7
BuildArch:      noarch
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}.
91033f9
91033f9
91033f9
%prep
abca6ae
%{gpgverify} --keyring='%{SOURCE5}' --signature='%{SOURCE4}' --data='%{SOURCE0}'
99eb880
%autosetup -p1
02d007b
%if %{with bundled}
02d007b
%autosetup -NDT -a6
02d007b
%endif
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
6c68fb8
find -type f -name "*.py" -exec sed -e 's|/usr/bin/env python3|%{python3}|g'    \
6c68fb8
                                    -e 's|/usr/bin/env python|%{python3}|g'     \
877bd27
                                    -e 's|/usr/bin/env -S kitty|/usr/bin/kitty|g' \
5f2daf8
                                    -i "{}" \;
91033f9
4af571a
mkdir src
4af571a
ln -s ../ src/kitty
91033f9
595d70c
%if %{without bundled}
595d70c
%generate_buildrequires
595d70c
export GOPATH=$(pwd):%{gopath}
595d70c
%go_generate_buildrequires
595d70c
%endif
91033f9
784bdb7
%build
4ecce33
%set_build_flags
6c68fb8
%{python3} setup.py linux-package   \
5f2daf8
    --libdir-name=%{_lib}           \
5f2daf8
    --update-check-interval=0       \
65fd7ee
    --verbose                       \
6c68fb8
    --skip-building-kitten          \
d25563e
    --ignore-compiler-warnings      \
65fd7ee
    %{nil}
8c7f2fb
02d007b
%if %{without bundled}
784bdb7
export GOPATH=$(pwd):%{gopath}
02d007b
%endif
784bdb7
unset LDFLAGS
595d70c
%gobuild -o _build/bin/kitten %{?with_bundled:./tools/cmd}%{!?with_bundled:./src/kitty/tools/cmd}
784bdb7
784bdb7
%install
784bdb7
# rpmlint fixes
6c68fb8
find linux-package -type f ! -executable -name "*.py" -exec sed -i '1{\@^#!%{python3}@d}' "{}" \;
784bdb7
find linux-package/%{_lib}/%{name}/shell-integration -type f ! -executable -exec sed -r -i '1{\@^#!/bin/(fish|zsh|sh|bash)@d}' "{}" \;
784bdb7
784bdb7
cp -r linux-package %{buildroot}%{_prefix}
784bdb7
install -m0755 -Dp _build/bin/kitten %{buildroot}%{_bindir}/kitten
784bdb7
87f8946
install -m0644 -Dp %{SOURCE1} %{buildroot}%{_metainfodir}/%{name}.appdata.xml
d812736
91033f9
# rpmlint fixes
66fa275
rm %{buildroot}%{_datadir}/doc/%{name}/html/.buildinfo \
666c677
   %{buildroot}%{_datadir}/doc/%{name}/html/.nojekyll
91033f9
91033f9
91033f9
%check
ef79955
%if %{with test}
410a76c
sed '/def test_ssh_shell_integration/a \
02d007b
\        self.skipTest("Skipping a flaky test")' -i kitty_tests/ssh.py
02d007b
%if 0%{?epel}
02d007b
sed '/def test_ssh_leading_data/a \
02d007b
\        self.skipTest("Skipping a failing test")' -i kitty_tests/ssh.py
02d007b
%endif
0195613
%ifarch ppc64le
0195613
for test in test_transfer_receive test_transfer_send; do
0195613
sed "/def $test/a \
0195613
\        self.skipTest(\"Skipping a failing test\")" -i kitty_tests/file_transmission.py
0195613
done
0195613
%endif
d25563e
%ifarch s390x
d25563e
sed '/def test_xor_data/a \
d25563e
\        self.skipTest("Skipping a failing test")' -i kitty_tests/graphics.py
d25563e
%endif
784bdb7
export %{gomodulesmode}
02d007b
%if %{without bundled}
784bdb7
export GOPATH=$(pwd):%{gopath}
02d007b
%endif
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
784bdb7
export PYTHONPATH=$(pwd)
6c68fb8
%{python3} setup.py test          \
6884d02
    --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
91033f9
%{_bindir}/%{name}
91033f9
%{_datadir}/applications/*.desktop
65fd7ee
%{_datadir}/icons/hicolor/*/*/*.{png,svg}
ec35ed4
%{_libdir}/%{name}/
9f40a27
%exclude %{_libdir}/%{name}/shell-integration
1c6d656
%{_mandir}/man{1,5}/*.{1,5}*
91033f9
%{_metainfodir}/*.xml
bbe6285
4af571a
%files kitten
595d70c
%if %{with bundled}
595d70c
# Go bundled provides generator
595d70c
%license vendor/modules.txt
595d70c
%endif
4af571a
%license LICENSE
4af571a
%{_bindir}/kitten
4af571a
91033f9
%files terminfo
91033f9
%license LICENSE
91033f9
%{_datadir}/terminfo/x/xterm-%{name}
91033f9
9f40a27
%files shell-integration
9f40a27
%license LICENSE
9f40a27
%{_libdir}/%{name}/shell-integration/
9f40a27
91033f9
%files doc
91033f9
%license LICENSE
91033f9
%doc CONTRIBUTING.md CHANGELOG.rst INSTALL.md
6c68fb8
%{_docdir}/%{name}/html/
65fd7ee
%dir %{_docdir}/%{name}
91033f9
91033f9
91033f9
%changelog
a0f023a
%autochangelog