mirror of
https://abf.rosa.ru/djam/zed.git
synced 2025-02-22 15:42:48 +00:00
84 lines
2.3 KiB
RPMSpec
84 lines
2.3 KiB
RPMSpec
%define debug %nil
|
||
%define debug_package %nil
|
||
%define rustver 1.83.0
|
||
%define llvmver llvm17
|
||
%define _llvmdir /opt/%{llvmver}
|
||
|
||
Name: zed
|
||
Version: 0.174.6
|
||
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/zed
|
||
upx target/*linux*/release/cli
|
||
|
||
|
||
%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}*
|
||
|
||
|