commit a2db65662d9322320f7a1ac21e955af62492a9a6 Author: Sergey Zhemoytel Date: Wed Aug 21 23:01:16 2024 +0300 Imported from SRPM diff --git a/.abf.yml b/.abf.yml new file mode 100644 index 0000000..afffcae --- /dev/null +++ b/.abf.yml @@ -0,0 +1,2 @@ +sources: + zed-0.149.3.tar.gz: b716aaf594a7d9564126b51105d7a8f941bd1e06 diff --git a/zed.spec b/zed.spec new file mode 100644 index 0000000..3a0fd6e --- /dev/null +++ b/zed.spec @@ -0,0 +1,83 @@ +%define debug %nil +%define debug_package %nil +%define rustver 1.80.0 +%define llvmver llvm17 +%define _llvmdir /opt/%{llvmver} + +Name: zed +Version: 0.149.3 +Release: 1 +Summary: A high-performance, multiplayer code editor +URL: https://zed.dev +Source0: https://github.com/zed-industries/zed/archive/v%{version}/%{name}-%{version}.tar.gz +License: GPL && ASL 2.0 && AGPL +Group: Development/Other +BuildRequires: git-core +BuildRequires: curl +BuildRequires: cmake +BuildRequires: upx +%if %{mdvver} > 201610 +BuildRequires: rust +BuildRequires: cargo +%endif +BuildRequires: %{llvmver} +BuildRequires: pkgconfig(openssl3.3) +BuildRequires: pkgconfig(libzstd) +BuildRequires: pkgconfig(alsa) +BuildRequires: pkgconfig(xcb) +BuildRequires: pkgconfig(xkbcommon) +BuildRequires: pkgconfig(xkbcommon-x11) + + +%description +Code at the speed of thought – Zed is a high-performance, +multiplayer code editor from the creators of Atom and +Tree-sitter. + +%prep +%setup -q +%if %{mdvver} <= 201610 +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs |\ + sh -s -- -y --profile default --default-toolchain %{rustver} +%endif + +sed -i -e 's|clang|%{_llvmdir}/bin/clang|g' -e 's|mold|lld|' .cargo/config.toml + +%build +%if %{mdvver} <= 201610 +source "$HOME/.cargo/env" +%endif + +version_info=$(rustc --version --verbose) +host_line=$(echo "$version_info" | grep host) +target_triple=${host_line#*: } + +export LLD=%{_llvmdir}/bin/lld +export X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR=/opt/openssl3.3 + +export LDFLAGS="-lstdc++-gcc10" +export CFLAGS="-I/usr/include/libstdc++-gcc10 -I/usr/include/libstdc++-gcc10/%{_host}" +export CXXFLAGS="-I/usr/include/libstdc++-gcc10 -I/usr/include/libstdc++-gcc10/%{_host}" + +export RUSTFLAGS="-C link-args=-Wl,--disable-new-dtags" + +cargo build --release --target "${target_triple}" --package zed --package cli + +# Strip the binary of all debug symbols +# Later, we probably want to do something like this: https://github.com/GabrielMajeri/separate-symbols +strip --strip-debug "target/${target_triple}/release/zed" +strip --strip-debug "target/${target_triple}/release/cli" + +upx target/*linux*/release/* + + +%install +install -Dm0755 target/*-linux-*/release/%{name} %{buildroot}%{_bindir}/%{name} +install -Dm0755 target/*-linux-*/release/cli %{buildroot}%{_bindir}/%{name}-cli + + +%files +%doc README.md LICENSE* +%{_bindir}/%{name}* + +