Accepting request 992542 from home:MSirringhaus:branches:utilities

With rust1.62, we got the ability to compile WASM-files. So we can now compile the plugins from source too, and not use the pre-built binaries.

OBS-URL: https://build.opensuse.org/request/show/992542
OBS-URL: https://build.opensuse.org/package/show/utilities/zellij?expand=0&rev=7
This commit is contained in:
Soc Virnyl Estela 2022-08-03 10:11:22 +00:00 committed by Git OBS Bridge
parent d007fe7850
commit ecda691393

View File

@ -27,8 +27,8 @@ Source0: https://github.com/zellij-org/zellij/archive/refs/tags/v%{versio
Source1: vendor.tar.gz Source1: vendor.tar.gz
Source2: cargo_config Source2: cargo_config
Source3: README.suse-maint.md Source3: README.suse-maint.md
BuildRequires: rust+cargo >= 1.62
BuildRequires: cargo-packaging BuildRequires: cargo-packaging
BuildRequires: rust >= 1.60
ExclusiveArch: %{rust_tier1_arches} ExclusiveArch: %{rust_tier1_arches}
%if %{with test} %if %{with test}
BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(openssl)
@ -46,8 +46,25 @@ language that compiles to WebAssembly.
%autosetup -a1 %autosetup -a1
mkdir -p .cargo mkdir -p .cargo
cp %{SOURCE2} .cargo/config cp %{SOURCE2} .cargo/config
# Remove prebuilt binaries
rm assets/plugins/*
%build %build
# First rebuilt plugins we just deleted
# Note: RUSTFLAGS break linking with WASM-files, so we don't use the cargo_build-macro here
pushd default-plugins/status-bar
cargo --offline build --release --target=wasm32-wasi
popd
pushd default-plugins/tab-bar
cargo --offline build --release --target=wasm32-wasi
popd
pushd default-plugins/strider
cargo --offline build --release --target=wasm32-wasi
popd
# Move the results to the place they are expected
mv target/wasm32-wasi/release/*.wasm assets/plugins/
# Build zellij proper
%{cargo_build} --all-features %{cargo_build} --all-features
%install %install