msedit.spec
· 3.5 KiB · RPMSpec
原始文件
# Partially generated by rust2rpm 27
%bcond check 1
# prevent library files from being installed
%global cargo_install_lib 0
# Temporarily use a Git revision until next stable release
%global commit e16b4abffc5e23d20e49de5f1461aebfc692268d
%global shortcommit %{sub %{commit} 1 7}
%global commitdate 20250710
# icu soversion
%global icu_sover %(icu-config --version | cut -d. -f1)
%global libicuuc libicuuc.so.%{icu_sover}
%global libicui18n libicui18n.so.%{icu_sover}
%if %[ %{?__isa_bits} != 32 ]
%global lib_suffix ()(%{__isa_bits}bit)
%endif
Name: msedit
Version: 1.2.0^1.%{shortcommit}
Release: %autorelease
Summary: Simple editor inspired by the MS-DOS Editor
SourceLicense: MIT
# MIT OR Apache-2.0: libc v0.2.172
# MIT: edit v1.2.0
License: MIT AND (MIT OR Apache-2.0)
URL: https://github.com/microsoft/edit
Source: %{url}/archive/%{shortcommit}.tar.gz
Patch: edit-fix-metadata.diff
BuildRequires: cargo-rpm-macros >= 26
BuildRequires: desktop-file-utils
BuildRequires: libicu-devel
# For dlopen() libicu
Recommends: %{libicuuc}%{?lib_suffix}
Recommends: %{libicui18n}%{?lib_suffix}
%global _description %{expand:
%{summary}
A text editor that pays homage to the classic MS-DOS Editor, but with a modern
interface and input controls similar to VS Code. The goal is to provide an
accessible editor that even users largely unfamiliar with terminals can easily
use.
}
%description %{_description}
%prep
%autosetup -n edit-%{commit} -p1
%cargo_prep
%generate_buildrequires
%cargo_generate_buildrequires
%build
# Set environment variables for ICU libraries
export EDIT_CFG_ICUUC_SONAME=%{libicuuc}
export EDIT_CFG_ICUI18N_SONAME=%{libicui18n}
export EDIT_CFG_ICU_RENAMING_VERSION=%{icu_sover}
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%install
# Set environment variables for ICU libraries
export EDIT_CFG_ICUUC_SONAME=%{libicuuc}
export EDIT_CFG_ICUI18N_SONAME=%{libicui18n}
export EDIT_CFG_ICU_RENAMING_VERSION=%{icu_sover}
%cargo_install
# de-conflict with vim
mv %{buildroot}%{_bindir}/edit %{buildroot}%{_bindir}/%{name}
# Change binary and icon in .desktop file then install it
sed -i \
-e "s|Icon=edit|Icon=%{_datadir}/pixmaps/%{name}.ico|g" \
-e "s|Exec=edit %%F|Exec=%{name} %%F|g" assets/com.microsoft.edit.desktop
desktop-file-install --dir=%{buildroot}%{_datadir}/applications assets/com.microsoft.edit.desktop
# Install icon
install -Dpm 0644 assets/edit.ico %{buildroot}%{_datadir}/pixmaps/%{name}.ico
install -Dpm 0644 assets/edit.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
# Change manpage to match binary name and install it
sed -i \
-e "s|edit |msedit |g" \
-e "s|EDIT 1|MSEDIT 1|g" \
-e "s|fBedit|fBmsedit|g" assets/manpage/edit.1
install -Dpm0644 -t %{buildroot}%{_mandir}/man1 assets/manpage/*.1
mv %{buildroot}%{_mandir}/man1/edit.1 %{buildroot}%{_mandir}/man1/%{name}.1
%if %{with check}
%check
# Set environment variables for ICU libraries
export EDIT_CFG_ICUUC_SONAME=%{libicuuc}
export EDIT_CFG_ICUI18N_SONAME=%{libicui18n}
export EDIT_CFG_ICU_RENAMING_VERSION=%{icu_sover}
%cargo_test
%endif
%files
%license LICENSE
%license LICENSE.dependencies
%doc CODE_OF_CONDUCT.md
%doc CONTRIBUTING.md
%doc README.md
%doc SECURITY.md
%{_bindir}/%{name}
%{_datadir}/applications/com.microsoft.edit.desktop
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/pixmaps/%{name}.ico
%{_mandir}/man1/%{name}.1*
%changelog
%autochangelog
| 1 | # Partially generated by rust2rpm 27 |
| 2 | %bcond check 1 |
| 3 | |
| 4 | # prevent library files from being installed |
| 5 | %global cargo_install_lib 0 |
| 6 | |
| 7 | # Temporarily use a Git revision until next stable release |
| 8 | %global commit e16b4abffc5e23d20e49de5f1461aebfc692268d |
| 9 | %global shortcommit %{sub %{commit} 1 7} |
| 10 | %global commitdate 20250710 |
| 11 | |
| 12 | # icu soversion |
| 13 | %global icu_sover %(icu-config --version | cut -d. -f1) |
| 14 | %global libicuuc libicuuc.so.%{icu_sover} |
| 15 | %global libicui18n libicui18n.so.%{icu_sover} |
| 16 | |
| 17 | %if %[ %{?__isa_bits} != 32 ] |
| 18 | %global lib_suffix ()(%{__isa_bits}bit) |
| 19 | %endif |
| 20 | |
| 21 | Name: msedit |
| 22 | Version: 1.2.0^1.%{shortcommit} |
| 23 | Release: %autorelease |
| 24 | Summary: Simple editor inspired by the MS-DOS Editor |
| 25 | SourceLicense: MIT |
| 26 | # MIT OR Apache-2.0: libc v0.2.172 |
| 27 | # MIT: edit v1.2.0 |
| 28 | License: MIT AND (MIT OR Apache-2.0) |
| 29 | |
| 30 | URL: https://github.com/microsoft/edit |
| 31 | Source: %{url}/archive/%{shortcommit}.tar.gz |
| 32 | Patch: edit-fix-metadata.diff |
| 33 | |
| 34 | BuildRequires: cargo-rpm-macros >= 26 |
| 35 | BuildRequires: desktop-file-utils |
| 36 | BuildRequires: libicu-devel |
| 37 | |
| 38 | # For dlopen() libicu |
| 39 | Recommends: %{libicuuc}%{?lib_suffix} |
| 40 | Recommends: %{libicui18n}%{?lib_suffix} |
| 41 | |
| 42 | %global _description %{expand: |
| 43 | %{summary} |
| 44 | |
| 45 | A text editor that pays homage to the classic MS-DOS Editor, but with a modern |
| 46 | interface and input controls similar to VS Code. The goal is to provide an |
| 47 | accessible editor that even users largely unfamiliar with terminals can easily |
| 48 | use. |
| 49 | } |
| 50 | |
| 51 | %description %{_description} |
| 52 | |
| 53 | %prep |
| 54 | %autosetup -n edit-%{commit} -p1 |
| 55 | %cargo_prep |
| 56 | |
| 57 | %generate_buildrequires |
| 58 | %cargo_generate_buildrequires |
| 59 | |
| 60 | %build |
| 61 | # Set environment variables for ICU libraries |
| 62 | export EDIT_CFG_ICUUC_SONAME=%{libicuuc} |
| 63 | export EDIT_CFG_ICUI18N_SONAME=%{libicui18n} |
| 64 | export EDIT_CFG_ICU_RENAMING_VERSION=%{icu_sover} |
| 65 | |
| 66 | %cargo_build |
| 67 | %{cargo_license_summary} |
| 68 | %{cargo_license} > LICENSE.dependencies |
| 69 | |
| 70 | %install |
| 71 | # Set environment variables for ICU libraries |
| 72 | export EDIT_CFG_ICUUC_SONAME=%{libicuuc} |
| 73 | export EDIT_CFG_ICUI18N_SONAME=%{libicui18n} |
| 74 | export EDIT_CFG_ICU_RENAMING_VERSION=%{icu_sover} |
| 75 | |
| 76 | %cargo_install |
| 77 | |
| 78 | # de-conflict with vim |
| 79 | mv %{buildroot}%{_bindir}/edit %{buildroot}%{_bindir}/%{name} |
| 80 | |
| 81 | # Change binary and icon in .desktop file then install it |
| 82 | sed -i \ |
| 83 | -e "s|Icon=edit|Icon=%{_datadir}/pixmaps/%{name}.ico|g" \ |
| 84 | -e "s|Exec=edit %%F|Exec=%{name} %%F|g" assets/com.microsoft.edit.desktop |
| 85 | desktop-file-install --dir=%{buildroot}%{_datadir}/applications assets/com.microsoft.edit.desktop |
| 86 | |
| 87 | # Install icon |
| 88 | install -Dpm 0644 assets/edit.ico %{buildroot}%{_datadir}/pixmaps/%{name}.ico |
| 89 | install -Dpm 0644 assets/edit.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg |
| 90 | |
| 91 | # Change manpage to match binary name and install it |
| 92 | sed -i \ |
| 93 | -e "s|edit |msedit |g" \ |
| 94 | -e "s|EDIT 1|MSEDIT 1|g" \ |
| 95 | -e "s|fBedit|fBmsedit|g" assets/manpage/edit.1 |
| 96 | install -Dpm0644 -t %{buildroot}%{_mandir}/man1 assets/manpage/*.1 |
| 97 | mv %{buildroot}%{_mandir}/man1/edit.1 %{buildroot}%{_mandir}/man1/%{name}.1 |
| 98 | |
| 99 | %if %{with check} |
| 100 | %check |
| 101 | # Set environment variables for ICU libraries |
| 102 | export EDIT_CFG_ICUUC_SONAME=%{libicuuc} |
| 103 | export EDIT_CFG_ICUI18N_SONAME=%{libicui18n} |
| 104 | export EDIT_CFG_ICU_RENAMING_VERSION=%{icu_sover} |
| 105 | |
| 106 | %cargo_test |
| 107 | %endif |
| 108 | |
| 109 | %files |
| 110 | %license LICENSE |
| 111 | %license LICENSE.dependencies |
| 112 | %doc CODE_OF_CONDUCT.md |
| 113 | %doc CONTRIBUTING.md |
| 114 | %doc README.md |
| 115 | %doc SECURITY.md |
| 116 | %{_bindir}/%{name} |
| 117 | %{_datadir}/applications/com.microsoft.edit.desktop |
| 118 | %{_datadir}/icons/hicolor/scalable/apps/%{name}.svg |
| 119 | %{_datadir}/pixmaps/%{name}.ico |
| 120 | %{_mandir}/man1/%{name}.1* |
| 121 | |
| 122 | %changelog |
| 123 | %autochangelog |
| 124 |