RPM/Debian packaging: Rust build support

This commit is contained in:
David Adam 2024-04-27 18:05:16 +08:00
parent e05bbe06ca
commit 572aece169
3 changed files with 22 additions and 9 deletions

5
debian/control vendored
View file

@ -4,9 +4,10 @@ Priority: optional
Maintainer: ridiculous_fish <corydoras@ridiculousfish.com>
Uploaders: David Adam <zanchey@ucc.gu.uwa.edu.au>
# Debhelper should be bumped to >= 10 once Ubuntu Xenial is no longer supported
Build-Depends: debhelper (>= 9.20160115), cmake (>= 3.5.0), gettext, libpcre2-dev,
Build-Depends: debhelper (>= 9.20160115), cmake (>= 3.19.0) | cmake-mozilla (>= 3.19.0), gettext,
rustc (>= 1.70), cargo (>= 0.66) | cargo-mozilla (>= 0.66), libpcre2-dev,
# Test dependencies
locales-all, python3, rustc (>= 1.70) | rustc-mozilla (>= 1.70), cargo
locales-all, python3
Standards-Version: 4.1.5
Homepage: https://fishshell.com/
Vcs-Git: https://github.com/fish-shell/fish-shell.git

9
debian/rules vendored
View file

@ -9,7 +9,14 @@ export DH_VERBOSE=1
# Setting the build system is still required, because otherwise the GNUmakefile gets picked up
override_dh_auto_configure:
dh_auto_configure --buildsystem=cmake
ln -s cargo-vendor/vendor vendor
ln -s cargo-vendor/.cargo .cargo
dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=RelWithDebInfo
override_dh_clean:
dh_clean
-unlink .cargo
-unlink vendor
# On CMake 3.5 (and possibly 3.6), the test target does not pick up its dependencies properly
# Build tests_buildroot_target by hand (remove this once Ubuntu Xenial is out of support)

View file

@ -9,17 +9,19 @@ Group: System/Shells
URL: https://fishshell.com/
Source0: %{name}_@VERSION@.orig.tar.xz
Source1: %{name}_@VERSION@.orig-cargo-vendor.tar.xz
BuildRequires: cargo gettext gcc-c++ xz pcre2-devel
BuildRequires: rust >= 1.70
# Packaging guidelines say to use a BuildRequires: rust-packaging, but it adds no value for our package
%if 0%{?rhel} && 0%{?rhel} < 8
BuildRequires: cmake3
%else
BuildRequires: cmake
%endif
BuildRequires: cmake >= 3.19
%if 0%{?suse_version}
BuildRequires: update-desktop-files
# for tests
BuildRequires: groff
%else
BuildRequires: groff-base
%endif
# for tests
@ -49,9 +51,12 @@ focused on user friendliness and discoverability. The language syntax
is simple but incompatible with other shell languages.
%prep
%setup -q -n %{name}-@VERSION@
# Unpack the source tarball and overlay the vendor tarball
%setup -q -n %{name}-@VERSION@ -a 1
# Should use cargo_prep here, it overrides our vendor config changes though
%build
export CARGO_NET_OFFLINE=true
# 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