fish-shell/fish.spec.in

134 lines
3.2 KiB
RPMSpec
Raw Normal View History

Summary: Friendly interactive shell
Name: fish
Version: @RPMVERSION@
Release: 0.%{?dist}
License: GPL-2.0-only AND GPL-2.0-or-later AND BSD-2-Clause AND PSF-2.0 AND ISC AND MIT
Group: System/Shells
URL: https://fishshell.com/
Source0: %{name}_@VERSION@.orig.tar.xz
# Corrosion requires git, and it's not always preinstalled
BuildRequires: cargo gettext gcc-c++ xz pcre2-devel git
2023-04-07 04:22:34 +00:00
BuildRequires: rust >= 1.67
%if 0%{?rhel} && 0%{?rhel} < 8
2018-05-29 05:46:14 +00:00
BuildRequires: cmake3
%else
BuildRequires: cmake
2018-05-29 05:46:14 +00:00
%endif
%if 0%{?suse_version}
BuildRequires: update-desktop-files
%endif
2019-01-05 09:28:37 +00:00
# for tests
%if 0%{?fedora} || ( 0%{?rhel} && 0%{?rhel} > 7 )
2019-01-05 09:28:37 +00:00
# Need the en_US.utf-8 locale at a minimum
BuildRequires: glibc-langpack-en
%endif
BuildRequires: python3 procps
2019-01-05 09:28:37 +00:00
%if 0%{?rhel} && 0%{?rhel} < 8
2023-04-07 04:22:34 +00:00
Requires: python
%else
2023-04-07 04:22:34 +00:00
Requires: python3
%endif
2023-04-07 04:22:34 +00:00
Requires: man
# Although the build scripts mangle the version number to be RPM compatible
# for continuous builds (transforming the output of `git describe`), Fedora 32+
# also validates the version inside the pkgconfig file. There's no impetus for this
# with fish.
%define _wrong_version_format_terminate_build 0
%description
fish is a shell geared towards interactive use. Its features are
focused on user friendliness and discoverability. The language syntax
is simple but incompatible with other shell languages.
%prep
%setup -q -n %{name}-@VERSION@
%build
# CMake macros define the wrong sysconfdir arguments
EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DCMAKE_INSTALL_SYSCONFDIR=%{_sysconfdir} -DCMAKE_INSTALL_DOCDIR=%{_docdir}/fish"
%if 0%{?rhel} && 0%{?rhel} < 8
%cmake3 $EXTRA_CMAKE_FLAGS
%else
%cmake $EXTRA_CMAKE_FLAGS
%endif
%if 0%{?cmake_build:1}
%cmake_build
2018-05-29 05:46:14 +00:00
%else
make %{?_smp_mflags}
2018-05-29 05:46:14 +00:00
%endif
%install
2018-05-29 05:46:14 +00:00
%if 0%{?cmake_install:1}
%cmake_install
%else
%make_install
%endif
%find_lang %{name}
# OpenSUSE has strong opinions about categories which do not apply to other systems
%if 0%{?suse_version}
%suse_update_desktop_file fish "System;TerminalEmulator"
%endif
2019-01-05 09:28:37 +00:00
%check
# OpenSUSE does out-of-tree builds and defines __builddir
%if 0%{?__builddir:1}
cd %__builddir
%endif
# Fedora uses __cmake_builddir
%if 0%{?__cmake_builddir:1}
cd %__cmake_builddir
%endif
make fish_run_tests
2019-01-05 09:28:37 +00:00
%clean
rm -rf $RPM_BUILD_ROOT
%post
# Add fish to the list of allowed shells in /etc/shells
if ! grep %{_bindir}/fish %{_sysconfdir}/shells >/dev/null; then
2023-04-07 04:22:34 +00:00
echo %{_bindir}/fish >>%{_sysconfdir}/shells
fi
%postun
# Remove fish from the list of allowed shells in /etc/shells
if [ "$1" = 0 ]; then
2023-04-07 04:22:34 +00:00
grep -v %{_bindir}/fish %{_sysconfdir}/shells >%{_sysconfdir}/fish.tmp
mv %{_sysconfdir}/fish.tmp %{_sysconfdir}/shells
fi
%files -f %{name}.lang
%defattr(-,root,root,-)
# The documentation directory
%doc %{_docdir}/fish
%doc CONTRIBUTING.rst README.rst
# man files
%{_mandir}/man1/*
# The program binaries
%attr(0755,root,root) %{_bindir}/*
# Configuration files
%dir %{_sysconfdir}/fish/
%config(noreplace) %{_sysconfdir}/fish/config.fish
# Support files
%{_datadir}/fish/
# pkgconfig
%{_datadir}/pkgconfig/fish.pc
# FreeDesktop entry
%{_datadir}/applications/fish.desktop
%{_datadir}/pixmaps/fish.png