# Generated by rust2rpm 22 # Also partially inspired by the Arch packaging # - git clone https://aur.archlinux.org/external-editor-revived.git %bcond_without check %global crate external-editor-revived %global thunderbird_app_id \{3550f703-e582-4d05-9a08-453d09bdfdc6\} %global extensions_dir %{_libdir}/mozilla/extensions/%{thunderbird_app_id} Name: external-editor-revived Version: 0.4.0 Release: %autorelease Summary: Thunderbird extension that allows editing emails in external editors such as Vim License: GPL-3.0-or-later URL: https://github.com/Frederick888/external-editor-revived Source: https://github.com/Frederick888/external-editor-revived/archive/refs/tags/v%{version}.tar.gz ExclusiveArch: %{rust_arches} BuildRequires: rust-packaging >= 21 BuildRequires: coreutils BuildRequires: sed BuildRequires: zip Requires: mozilla-filesystem %global _description %{expand: Edit emails in external editors such as Vim.} %description %{_description} %files %license LICENSE %doc CHANGELOG.md %doc README.md %{_bindir}/external-editor-revived %{_libdir}/mozilla/native-messaging-hosts/external_editor_revived.json %{extensions_dir}/external-editor-revived@tsundere.moe.xpi %prep %autosetup -n %{crate}-%{version_no_tilde} -p1 %cargo_prep %generate_buildrequires %cargo_generate_buildrequires %build # do the rust compilation %cargo_build # package up the extension pushd $RPM_BUILD_DIR/%{crate}-%{version}/extension zip -r -FS $RPM_BUILD_DIR/external-editor-revived@tsundere.moe.xpi * popd %install %cargo_install # Generate the native messaging json by executing the binary # and redirecting stdout to sed that updates the location of the # binary and then writing that out to the destination file mkdir -p $RPM_BUILD_ROOT%{_libdir}/mozilla/native-messaging-hosts $RPM_BUILD_ROOT%{_bindir}/external-editor-revived 2>/dev/null | \ sed 's|^ "path":.*$| "path": "%{_bindir}/external-editor-revived",|' > \ $RPM_BUILD_ROOT%{_libdir}/mozilla/native-messaging-hosts/external_editor_revived.json # copy over extension mkdir -p $RPM_BUILD_ROOT%{extensions_dir} cp $RPM_BUILD_DIR/external-editor-revived@tsundere.moe.xpi $RPM_BUILD_ROOT%{extensions_dir}/ %if %{with check} %check %cargo_test %endif %changelog %autochangelog