Blame SPECS/fish.spec

73b42e
%global version_base 3.7.1
73b42e
%dnl %global gitnum 120
73b42e
%dnl %global githash 1a0b1ae238e1deb132a0ae4a8d0c589d583cc5b0
73b42e
%dnl %global githashshort %{lua:print(string.sub(rpm.expand('%{githash}'), 1, 11))}
73b42e
73b42e
Name:           fish
73b42e
Version:        %{version_base}%{?gitnum:^%{gitnum}g%{githashshort}}
73b42e
Release:        %autorelease
73b42e
Summary:        Friendly interactive shell
73b42e
# see also doc_src/license.rst
73b42e
# GPLv2
73b42e
#   - src/fish.cpp
73b42e
#   and rest…
73b42e
# GPLv2+
73b42e
#   - src/builtins/printf.cpp
73b42e
# BSD
73b42e
#   - src/fallback.cpp
73b42e
#   - share/tools/create_manpage_completions.py
73b42e
# ISC
73b42e
#   - src/env.cpp
73b42e
#   - src/utf8.cpp
73b42e
#   - src/utf8.h
73b42e
# LGPLv2+
73b42e
#   - src/wgetopt.cpp
73b42e
#   - src/wgetopt.h
73b42e
# MIT
73b42e
#   - share/completions/grunt.fish
73b42e
#   - share/tools/web_config/js/angular-route.js
73b42e
#   - share/tools/web_config/js/angular-sanitize.js
73b42e
#   - share/tools/web_config/js/angular.js
73b42e
# PSF-2.0
73b42e
#   - doc_src/python_docs_theme/,
73b42e
License:        GPL-2.0-only AND BSD-3-Clause AND ISC AND LGPL-2.0-or-later AND MIT AND PSF-2.0
73b42e
URL:            https://fishshell.com
73b42e
%if %{undefined gitnum}
73b42e
Source0:        https://github.com/fish-shell/fish-shell/releases/download/%{version}/%{name}-%{version}.tar.xz
73b42e
Source1:        https://github.com/fish-shell/fish-shell/releases/download/%{version}/%{name}-%{version}.tar.xz.asc
73b42e
Source2:        gpgkey-003837986104878835FA516D7A67D962D88A709A.gpg
73b42e
%else
73b42e
Source0:        https://github.com/fish-shell/fish-shell/archive/%{githash}/%{name}-%{githash}.tar.gz
73b42e
%endif
73b42e
73b42e
BuildRequires:  cmake >= 3.5
73b42e
BuildRequires:  ninja-build
73b42e
BuildRequires:  gcc
73b42e
BuildRequires:  gcc-c++
73b42e
BuildRequires:  gettext
73b42e
BuildRequires:  ncurses-devel
73b42e
BuildRequires:  pcre2-devel
73b42e
BuildRequires:  gnupg2
73b42e
BuildRequires:  python3-devel
73b42e
BuildRequires:  python3-pexpect
73b42e
BuildRequires:  procps-ng
73b42e
BuildRequires:  glibc-langpack-en
73b42e
%global __python %{__python3}
73b42e
BuildRequires:  /usr/bin/sphinx-build
73b42e
BuildRequires:  /usr/bin/desktop-file-validate
73b42e
73b42e
# tab completion wants man-db
73b42e
Recommends:     man-db
73b42e
Recommends:     man-pages
73b42e
Recommends:     groff-base
73b42e
73b42e
Provides:       bundled(js-angular) = 1.8.2
73b42e
73b42e
%description
73b42e
fish is a fully-equipped command line shell (like bash or zsh) that is
73b42e
smart and user-friendly. fish supports powerful features like syntax
73b42e
highlighting, autosuggestions, and tab completions that just work, with
73b42e
nothing to learn or configure.
73b42e
73b42e
%prep
73b42e
%if %{undefined gitnum}
73b42e
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
73b42e
%endif
73b42e
%autosetup -p1 %{?gitnum:-n fish-shell-%{githash}}
73b42e
%if %{defined gitnum}
73b42e
echo "%{version_base}-%{gitnum}g%{githashshort}" > version
73b42e
%endif
73b42e
73b42e
# Change the bundled scripts to invoke the python binary directly.
73b42e
for f in $(find share/tools -type f -name '*.py'); do
73b42e
    sed -i -e '1{s@^#!.*@#!%{__python3}@}' "$f"
73b42e
done
73b42e
73b42e
%build
73b42e
%cmake -GNinja \
73b42e
    -DBUILD_DOCS=ON \
73b42e
    -DCMAKE_INSTALL_SYSCONFDIR=%{_sysconfdir} \
73b42e
    -Dextra_completionsdir=%{_datadir}/%{name}/vendor_completions.d \
73b42e
    -Dextra_functionsdir=%{_datadir}/%{name}/vendor_functions.d \
73b42e
    -Dextra_confdir=%{_datadir}/%{name}/vendor_conf.d
73b42e
73b42e
%cmake_build -t all doc fish_tests
73b42e
73b42e
# We still need to slightly manually adapt the pkgconfig file and remove
73b42e
# some /usr/local/ references (RHBZ#1869376)
73b42e
sed -i 's^/usr/local/^/usr/^g' %{_vpath_builddir}/*.pc
73b42e
73b42e
%install
73b42e
%cmake_install
73b42e
73b42e
# No more automagic Python bytecompilation phase 3
73b42e
# * https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_3
73b42e
%py_byte_compile %{python3} %{buildroot}%{_datadir}/%{name}/tools/
73b42e
73b42e
# Install docs from tarball root
73b42e
cp -a README.rst %{buildroot}%{_pkgdocdir}
73b42e
cp -a CONTRIBUTING.rst %{buildroot}%{_pkgdocdir}
73b42e
73b42e
%find_lang %{name}
73b42e
73b42e
%check
73b42e
# Sadly, ctest is broken
73b42e
%ninja_build -C %{_vpath_builddir} test
73b42e
desktop-file-validate %{buildroot}%{_datadir}/applications/fish.desktop
73b42e
73b42e
%post
73b42e
if [ "$1" = 1 ]; then
73b42e
  if [ ! -f %{_sysconfdir}/shells ] ; then
73b42e
    echo "%{_bindir}/fish" > %{_sysconfdir}/shells
73b42e
    echo "/bin/fish" >> %{_sysconfdir}/shells
73b42e
  else
73b42e
    grep -q "^%{_bindir}/fish$" %{_sysconfdir}/shells || echo "%{_bindir}/fish" >> %{_sysconfdir}/shells
73b42e
    grep -q "^/bin/fish$" %{_sysconfdir}/shells || echo "/bin/fish" >> %{_sysconfdir}/shells
73b42e
  fi
73b42e
fi
73b42e
73b42e
%postun
73b42e
if [ "$1" = 0 ] && [ -f %{_sysconfdir}/shells ] ; then
73b42e
  sed -i '\!^%{_bindir}/fish$!d' %{_sysconfdir}/shells
73b42e
  sed -i '\!^/bin/fish$!d' %{_sysconfdir}/shells
73b42e
fi
73b42e
73b42e
%files -f %{name}.lang
73b42e
%license COPYING
73b42e
%{_mandir}/man1/fish*.1*
73b42e
%{_bindir}/fish*
73b42e
%config(noreplace) %{_sysconfdir}/fish/
73b42e
%{_datadir}/fish/
73b42e
%{_datadir}/pkgconfig/fish.pc
73b42e
%{_pkgdocdir}
73b42e
%{_datadir}/applications/fish.desktop
73b42e
%{_datadir}/pixmaps/fish.png
73b42e
73b42e
%changelog
73b42e
%autochangelog