From 572aece1694145ef897b19368c9a23d9db4a5077 Mon Sep 17 00:00:00 2001 From: David Adam Date: Sat, 27 Apr 2024 18:05:16 +0800 Subject: [PATCH] RPM/Debian packaging: Rust build support --- debian/control | 5 +++-- debian/rules | 9 ++++++++- fish.spec.in | 17 +++++++++++------ 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/debian/control b/debian/control index e5289c1b6..abecffba8 100644 --- a/debian/control +++ b/debian/control @@ -4,9 +4,10 @@ Priority: optional Maintainer: ridiculous_fish Uploaders: David Adam # 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 diff --git a/debian/rules b/debian/rules index 9202f6ac8..c7e78706a 100755 --- a/debian/rules +++ b/debian/rules @@ -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) diff --git a/fish.spec.in b/fish.spec.in index 774f7b7ce..cd05cb4ae 100644 --- a/fish.spec.in +++ b/fish.spec.in @@ -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