From e1a4779cb0ee9393af40d94efce4b4585e8e2467 Mon Sep 17 00:00:00 2001 From: Raboneko <119771935+raboneko@users.noreply.github.com> Date: Wed, 26 Jun 2024 21:10:19 -0700 Subject: [PATCH] add: zed-nightly (#1377) (#1394) * wip * remove old desktop file * remove --frozen from build * bump commit and use correct version * check Cargo.toml for version * fix spacing in anda.hcl * slow down zed build * run with 4 jobs * zed-nightly(anda): tag as large * ci: if package is labelled as large, use lg runners for x86 * don't slow down build * Update zed-nightly.spec Signed-off-by: june <159748074+june-fish@users.noreply.github.com> * Update zed-nightly.spec Signed-off-by: june <159748074+june-fish@users.noreply.github.com> * use rpm profile * use correct paths for installing zed binaries * remove unneded debug_package line * use cargo_install macro * Revert "use cargo_install macro" This reverts commit a03c3b3a69f137c6747ba9d7074bd23c6e505e95. * don't mangle sources * reorganize zed to prepare for multiple packages --------- Signed-off-by: june <159748074+june-fish@users.noreply.github.com> Co-authored-by: Cappy Ishihara Co-authored-by: lea Co-authored-by: madomado (cherry picked from commit 2291a214d93ec9f48b32c119ad4d2be20c4a82dd) Co-authored-by: june <159748074+june-fish@users.noreply.github.com> --- anda/devs/zed/nightly/anda.hcl | 9 +++ anda/devs/zed/nightly/update.rhai | 9 +++ anda/devs/zed/nightly/zed-nightly.spec | 97 ++++++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 anda/devs/zed/nightly/anda.hcl create mode 100644 anda/devs/zed/nightly/update.rhai create mode 100644 anda/devs/zed/nightly/zed-nightly.spec diff --git a/anda/devs/zed/nightly/anda.hcl b/anda/devs/zed/nightly/anda.hcl new file mode 100644 index 0000000000..e92820997f --- /dev/null +++ b/anda/devs/zed/nightly/anda.hcl @@ -0,0 +1,9 @@ +project pkg { + rpm { + spec = "zed-nightly.spec" + } + labels { + nightly = 1 + large = 1 + } +} diff --git a/anda/devs/zed/nightly/update.rhai b/anda/devs/zed/nightly/update.rhai new file mode 100644 index 0000000000..ac2e45147e --- /dev/null +++ b/anda/devs/zed/nightly/update.rhai @@ -0,0 +1,9 @@ +if filters.contains("nightly") { + rpm.global("commit", gh_commit("zed-industries/zed")); + if rpm.changed() { + let v = find("(\\d+\\.\\d+\\d+\\.\\d+)", find("\nversion = \"(\\d+\\.\\d+\\d+\\.\\d+)\"\n", gh_rawfile("zed-industries/zed", "main", "crates/zed/Cargo.toml"), 1), 1); + rpm.global("ver", v); + rpm.global("commit_date", date()); + rpm.release(); + } +} diff --git a/anda/devs/zed/nightly/zed-nightly.spec b/anda/devs/zed/nightly/zed-nightly.spec new file mode 100644 index 0000000000..594e233c84 --- /dev/null +++ b/anda/devs/zed/nightly/zed-nightly.spec @@ -0,0 +1,97 @@ +%global commit 0129d4e2506d5ec5e50ef0968382770b9abec390 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) +%global commit_date 20240619 +%global ver 0.142.0 + +%bcond_without check + +# Exclude input files from mangling +%global __brp_mangle_shebangs_exclude_from ^/usr/src/.*$ + +%global crate zed +%global app_id dev.zed.Zed-Nightly + +Name: zed-nightly +Version: %ver^%commit_date.%shortcommit +Release: 1%?dist +Summary: Zed is a high-performance, multiplayer code editor + +License: MIT +URL: https://zed.dev/ +Source0: https://github.com/zed-industries/zed/archive/%{commit}.zip + +Conflicts: zed +Provides: zed + +BuildRequires: cargo-rpm-macros >= 24 +BuildRequires: anda-srpm-macros +BuildRequires: gcc +BuildRequires: g++ +BuildRequires: clang +BuildRequires: mold +BuildRequires: alsa-lib-devel +BuildRequires: fontconfig-devel +BuildRequires: wayland-devel +BuildRequires: libxkbcommon-x11-devel +BuildRequires: openssl-devel +BuildRequires: libzstd-devel +BuildRequires: perl-FindBin +BuildRequires: perl-IPC-Cmd +BuildRequires: perl-File-Compare +BuildRequires: perl-File-Copy +BuildRequires: perl-lib +BuildRequires: vulkan-loader + +%description +Code at the speed of thought - Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter. + +%prep +%autosetup -n %{crate}-%{commit} -p1 +%cargo_prep_online + +export DO_STARTUP_NOTIFY="true" +export APP_ID="%app_id" +export APP_ICON="%app_id" +export APP_NAME="Zed Nightly" +export APP_CLI="zed" +export ZED_UPDATE_EXPLANATION="Run dnf up to update Zed Nightly from Terra." +export ZED_RELEASE_CHANNEL=nightly +export BRANDING_LIGHT="#e9aa6a" +export BRANDING_DARK="#1a5fb4" + +echo "StartupWMClass=$APP_ID" >> crates/zed/resources/zed.desktop.in +envsubst < "crates/zed/resources/zed.desktop.in" > $APP_ID.desktop # from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=zed-git#n52 + +envsubst < "crates/zed/resources/flatpak/zed.metainfo.xml.in" > $APP_ID.metainfo.xml + +%build +export ZED_UPDATE_EXPLANATION="Run dnf up to update Zed Nightly from Terra." +echo "nightly" > crates/zed/RELEASE_CHANNEL + +%cargo_build -- --package zed --package cli +script/generate-licenses + +%install +install -Dm755 target/rpm/zed %{buildroot}%{_libexecdir}/zed-editor +install -Dm755 target/rpm/cli %{buildroot}%{_bindir}/zed + +install -Dm644 %app_id.desktop %{buildroot}%{_datadir}/applications/%app_id.desktop +install -Dm644 crates/zed/resources/app-icon-nightly.png %{buildroot}%{_datadir}/pixmaps/%app_id.png + +install -Dm644 %app_id.metainfo.xml %{buildroot}%{_metainfodir}/%app_id.metainfo.xml + +%if %{with check} +%check +%cargo_test +%endif + +%files +%{_libexecdir}/zed-editor +%{_bindir}/zed +%{_datadir}/applications/%app_id.desktop +%{_datadir}/pixmaps/%app_id.png +%{_metainfodir}/%app_id.metainfo.xml +%license assets/licenses.md + +%changelog +%autochangelog