File skim.spec of Package skim

#
# spec file for package skim
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2025 Boian Berberov
#
# 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/
#

Name:           skim
Version:        0.20.5
Release:        0%{?dist}
Summary:        A fuzzy finder for the command line in Rust
License:        MIT
URL:            https://github.com/skim-rs/skim

Source0:        %{url}/archive/refs/tags/v%{version}.tar.gz
Source1:        vendor.tar.zst

# Rust 2024 for e2e, hard requirement
BuildRequires:  cargo >= 1.85.0

%if 0%{?suse_version}
BuildRequires:  cargo-packaging
%endif

%if 0%{?fedora} || 0%{?mageia}
BuildRequires:  cargo-rpm-macros >= 24
%endif

%if 0%{?rhel}
BuildRequires:  rust-toolset
%endif

%description
Half of our life is spent on navigation: files, lines, commands… You need skim!
It's a general fuzzy finder that saves you time.

%package        bash-completion
Summary:        Bash Completion for %{name}
Group:          System/Shells
BuildRequires:  pkgconfig(bash-completion)
Requires:       bash-completion
Supplements:    (%{name} and bash)
BuildArch:      noarch

%description bash-completion
The official bash completion script for %{name}.

%package        fish-completion
Summary:        Fish Completion for %{name}
Group:          System/Shells
Supplements:    (%{name} and fish)
BuildArch:      noarch

%description fish-completion
The official fish completion script for %{name}.

%package        zsh-completion
Summary:        ZSH Completion for %{name}
Group:          System/Shells
Supplements:    (%{name} and zsh)
BuildArch:      noarch

%description zsh-completion
The official zsh completion script for %{name}.

%package        bash-integration
Summary:        Bash Completion for %{name}
Group:          System/Shells
Supplements:    (%{name} and bash)
BuildArch:      noarch

%description bash-integration
The official bash integration script for %{name}.

%package        fish-integration
Summary:        Fish integration for %{name}
Group:          System/Shells
Supplements:    (%{name} and fish)
BuildArch:      noarch

%description fish-integration
The official fish integration script for %{name}.

%package        zsh-integration
Summary:        Fish integration for %{name}
Group:          System/Shells
Supplements:    (%{name} and zsh)
BuildArch:      noarch

%description zsh-integration
The official zsh integration script for %{name}.



%prep
# Run before setup so it does not clobber the vendor tarball
%if 0%{?fedora} || 0%{?rhel} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?mageia}
%cargo_prep
%endif

%setup -q -a 1



%build
%cargo_build



# %%check
# %%cargo_test



%install
%if 0%{?suse_version}
%cargo_install -p %{name}
%else
%{__cargo} install \
	%{__cargo_common_opts} \
	--profile rpm \
	--no-track \
	--path %{name}
%endif

%__install -D -m 0644 bin/sk-tmux             %{buildroot}%{_bindir}/sk-tmux
%__install -D -m 0644 man/man1/sk.1           %{buildroot}%{_mandir}/man1/sk.1
%__install -D -m 0644 man/man1/sk-tmux.1      %{buildroot}%{_mandir}/man1/sk-tmux.1

%__install -D -m 0644 shell/completion.bash   %{buildroot}%{_datadir}/bash-completion/completions/sk
%__install -D -m 0644 shell/completion.fish   %{buildroot}%{_datadir}/fish/vendor_completions.d/sk.fish
%__install -D -m 0644 shell/completion.zsh    %{buildroot}%{_datadir}/zsh/site-functions/_sk-completion

%__install -D -m 0644 shell/key-bindings.bash %{buildroot}%{_sysconfdir}/profile.d/%{name}-bash-integration.sh
%__install -D -m 0644 shell/key-bindings.fish %{buildroot}%{_datadir}/fish/vendor_functions.d/sk.fish
%__install -D -m 0644 shell/key-bindings.zsh  %{buildroot}%{_datadir}/zsh/site-functions/_sk-integration



%files
%license        LICENSE
%doc            CHANGELOG.md README.md
%{_bindir}/sk
%{_bindir}/sk-tmux
%{_mandir}/man1/sk.1*
%{_mandir}/man1/sk-tmux.1*

%files bash-completion
%license        LICENSE
%{_datadir}/bash-completion/completions/sk

%files fish-completion
%license        LICENSE
%dir            %{_datadir}/fish
%dir            %{_datadir}/fish/vendor_completions.d
%{_datadir}/fish/vendor_completions.d/sk.fish

%files zsh-completion
%license        LICENSE
%dir            %{_datadir}/zsh
%dir            %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/_sk-completion

%files bash-integration
%license        LICENSE
%config %{_sysconfdir}/profile.d/%{name}-bash-integration.sh

%files fish-integration
%license        LICENSE
%dir            %{_datadir}/fish
%dir            %{_datadir}/fish/vendor_functions.d
%{_datadir}/fish/vendor_functions.d/sk.fish

%files zsh-integration
%license        LICENSE
%dir            %{_datadir}/zsh
%dir            %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/_sk-integration



%changelog

* Tue Jul 15 2025 Boian Berberov
- Added changelog for openSUSE Leap 16
openSUSE Build Service is sponsored by