summaryrefslogtreecommitdiff
path: root/fish.spec
blob: 570a7f58a77ebb974a7a428205b28f24a9db4068 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
Name:           fish
Version:        3.6.0
Release:        1
Summary:        Friendly interactive shell
License:        GPLv2 and BSD and ISC and LGPLv2+ and MIT
URL:            https://fishshell.com
Source0:        https://github.com/fish-shell/fish-shell/releases/download/%{version}/%{name}-%{version}.tar.xz

BuildRequires:  cmake >= 3.2
BuildRequires:  ninja-build
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  gettext
BuildRequires:  ncurses-devel
BuildRequires:  pcre2-devel
BuildRequires:  gnupg2
BuildRequires:  python3-devel
%global __python %{__python3}
BuildRequires:  /usr/bin/desktop-file-validate

# tab completion wants man-db
Recommends:     man-db
Recommends:     man-pages
Recommends:     groff-base

Provides:       bundled(js-angular) = 1.0.8
Provides:       bundled(js-jquery) = 3.3.1
Provides:       bundled(js-underscore) = 1.9.1

%description
fish is a fully-equipped command line shell (like bash or zsh) that is
smart and user-friendly. fish supports powerful features like syntax
highlighting, autosuggestions, and tab completions that just work, with
nothing to learn or configure.

%prep
%autosetup -p1
rm -vrf pcre2-*

# Change the bundled scripts to invoke the python binary directly.
for f in $(find share/tools -type f -name '*.py'); do
    sed -i -e '1{s@^#!.*@#!%{__python3}@}' "$f"
done

%build
%cmake . -B%{_vpath_builddir} -GNinja \
    -DCMAKE_INSTALL_SYSCONFDIR=%{_sysconfdir} \
    -Dextra_completionsdir=%{_datadir}/%{name}/vendor_completions.d \
    -Dextra_functionsdir=%{_datadir}/%{name}/vendor_functions.d \
    -Dextra_confdir=%{_datadir}/%{name}/vendor_conf.d

%ninja_build -C %{_vpath_builddir} %{_smp_mflags} all fish_tests

sed -i 's^/usr/local/^/usr/^g' %{_vpath_builddir}/*.pc

%install
%ninja_install -C %{_vpath_builddir}

%py_byte_compile %{__python3} %{buildroot}%{_datadir}/%{name}/tools/

# Install docs from tarball root
cp -a README.rst %{buildroot}%{_pkgdocdir}
cp -a CONTRIBUTING.rst %{buildroot}%{_pkgdocdir}

%find_lang %{name}

%check
%{_vpath_builddir}/fish_tests
desktop-file-validate %{buildroot}%{_datadir}/applications/fish.desktop

%post
if [ "$1" = 1 ]; then
  if [ ! -f %{_sysconfdir}/shells ] ; then
    echo "%{_bindir}/fish" > %{_sysconfdir}/shells
    echo "/bin/fish" >> %{_sysconfdir}/shells
  else
    grep -q "^%{_bindir}/fish$" %{_sysconfdir}/shells || echo "%{_bindir}/fish" >> %{_sysconfdir}/shells
    grep -q "^/bin/fish$" %{_sysconfdir}/shells || echo "/bin/fish" >> %{_sysconfdir}/shells
  fi
fi

%postun
if [ "$1" = 0 ] && [ -f %{_sysconfdir}/shells ] ; then
  sed -i '\!^%{_bindir}/fish$!d' %{_sysconfdir}/shells
  sed -i '\!^/bin/fish$!d' %{_sysconfdir}/shells
fi

%files -f %{name}.lang
%license COPYING
%{_mandir}/man1/fish*.1*
%{_bindir}/fish*
%config(noreplace) %{_sysconfdir}/fish/
%{_datadir}/fish/
%{_datadir}/pkgconfig/fish.pc
%{_pkgdocdir}
%{_datadir}/applications/fish.desktop
%{_datadir}/pixmaps/fish.png

%changelog
* Sun Feb 26 2023 lichaoran <pkwarcraft@hotmail.com> - 3.6.0-1
- Upgrade to 3.6.0

* Mon May 16 2022 yaoxin <yaoxin30@h-partners.com> - 3.3.1-3
- Fix CVE-2022-20001

* Mon May 09 2022 wangkai <wangkai385@huawei.com> - 3.3.1-2
- Fix test failure

* Mon Jul 12 2021 wulei <wulei80@huawei.com> - 3.3.1-1
- Package init