fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

David AdamRPM/Debian packaging: add pkg-config dependencyf84179f8f

master
3.4 KiB120 linesraw
1Summary:                Friendly interactive shell
2Name:                   fish
3
4Version:                @RPMVERSION@
5Release:                0.%{?dist}
6
7License:                GPL-2.0-only AND GPL-2.0-or-later AND BSD-2-Clause AND PSF-2.0 AND ISC AND MIT
8Group:                  System/Shells
9URL:                    https://fishshell.com/
10
11Source0:                %{name}_@VERSION@.orig.tar.xz
12Source1:                %{name}_@VERSION@.orig-cargo-vendor.tar.xz
13BuildRequires:          cargo gettext gcc xz pcre2-devel
14BuildRequires:          rust >= 1.85
15# Packaging guidelines say to use a BuildRequires: rust-packaging, but it adds no value for our package
16BuildRequires:          /usr/bin/sphinx-build
17# OBS: add eg "FileProvides: /usr/bin/sphinx-build python3-sphinx python3-Sphinx" to project config
18BuildRequires:          /usr/bin/man
19# OBS: add eg "FileProvides: /usr/bin/man man-db man" to project config
20# pkg-config is needed for the pcre2 crate to find the pcre2 system librar
21BuildRequires:          /usr/bin/pkg-config
22# OBS: add eg "FileProvides: /usr/bin/pkg-config pkgconf-pkg-config pkg-config" to project config
23BuildRequires: cmake >= 3.15
24
25# for tests
26BuildRequires:          python3 procps
27%if 0%{?fedora}
28# Need the en_US.utf-8 locale at a minimum
29BuildRequires: glibc-langpack-en
30%endif
31
32Requires:      file
33Requires:      /usr/bin/man
34Requires:      python3
35Requires:      procps
36
37# Although the build scripts mangle the version number to be RPM compatible
38# for continuous builds (transforming the output of `git describe`), Fedora 32+
39# also validates the version inside the pkgconfig file. There's no impetus for this
40# with fish.
41%define _wrong_version_format_terminate_build 0
42
43%description
44
45fish is a shell geared towards interactive use. Its features are
46focused on user friendliness and discoverability. The language syntax
47is simple but incompatible with other shell languages.
48
49%prep
50# Unpack the source tarball and overlay the vendor tarball
51%setup -q -n %{name}-@VERSION@ -a 1
52# Should use cargo_prep here, it overrides our vendor config changes though
53
54%build
55export CARGO_NET_OFFLINE=true
56# CMake macros define the wrong sysconfdir arguments
57EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DCMAKE_INSTALL_SYSCONFDIR=%{_sysconfdir} -DCMAKE_INSTALL_DOCDIR=%{_docdir}/fish"
58%cmake $EXTRA_CMAKE_FLAGS
59%if 0%{?cmake_build:1}
60%cmake_build
61%else
62make %{?_smp_mflags}
63%endif
64
65%install
66%if 0%{?cmake_install:1}
67%cmake_install
68%else
69%make_install
70%endif
71
72%check
73# OpenSUSE does out-of-tree builds and defines __builddir
74%if 0%{?__builddir:1}
75cd %__builddir
76%endif
77# Fedora uses __cmake_builddir
78%if 0%{?__cmake_builddir:1}
79cd %__cmake_builddir
80%endif
81make fish_run_tests
82
83%clean
84rm -rf $RPM_BUILD_ROOT
85
86%post
87# Add fish to the list of allowed shells in /etc/shells
88if ! grep %{_bindir}/fish %{_sysconfdir}/shells >/dev/null; then
89    echo %{_bindir}/fish >>%{_sysconfdir}/shells
90fi
91
92%postun
93# Remove fish from the list of allowed shells in /etc/shells
94if [ "$1" = 0 ]; then
95    grep -v %{_bindir}/fish %{_sysconfdir}/shells >%{_sysconfdir}/fish.tmp
96    mv %{_sysconfdir}/fish.tmp %{_sysconfdir}/shells
97fi
98
99%files
100%defattr(-,root,root,-)
101
102# The documentation directory
103%doc %{_docdir}/fish
104%doc CONTRIBUTING.rst README.rst
105
106# man files
107%{_mandir}/man1/*
108
109# The program binaries
110%attr(0755,root,root) %{_bindir}/*
111
112# Configuration files
113%dir %{_sysconfdir}/fish/
114%config(noreplace) %{_sysconfdir}/fish/config.fish
115
116# Support files
117%{_datadir}/fish/
118
119# pkgconfig
120%{_datadir}/pkgconfig/fish.pc