Blame fish.spec

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