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