From f0e158812d12f51b877fffde769b6ab893d2054c Mon Sep 17 00:00:00 2001 From: Lokesh Mandvekar Date: Thu, 3 Nov 2022 17:43:59 +0530 Subject: [PATCH] enable wasm support Currently, wasmedge is the only wasm provider in Fedora. That may change with time. All wasm providers will include a `Provides: wasm-library` which will be a hard dependency for crun along with a weak dependency that the user can change per need. Signed-off-by: Lokesh Mandvekar --- crun.spec | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/crun.spec b/crun.spec index 2b53582..31abf21 100644 --- a/crun.spec +++ b/crun.spec @@ -7,6 +7,14 @@ %endif %endif +# wasmedge built only for aarch64 and x86_64 +%if 0%{?fedora} >= 36 +%ifarch aarch64 || x86_64 +%global wasm_support enabled +%global wasm_opts --with-wasmedge +%endif +%endif + %global built_tag 1.6 %global gen_version %(b=%{built_tag}; echo ${b/-/"~"}) @@ -32,6 +40,9 @@ BuildRequires: yajl-devel %if "%{krun_support}" == "enabled" BuildRequires: libkrun-devel %endif +%if "%{wasm_support}" == "enabled" +BuildRequires: wasmedge-devel +%endif BuildRequires: libseccomp-devel BuildRequires: libselinux-devel BuildRequires: python3-libmount @@ -52,7 +63,7 @@ Provides: oci-runtime %build ./autogen.sh -%configure --disable-silent-rules %{krun_opts} +%configure --disable-silent-rules %{krun_opts} %{wasm_opts} %make_build %install @@ -62,6 +73,10 @@ rm -rf %{buildroot}%{_prefix}/lib* ln -s ../bin/%{name} %{buildroot}%{_bindir}/krun %endif +%if "%{wasm_support}" == "enabled" +ln -s ../bin/%{name} %{buildroot}%{_bindir}/%{name}-wasm +%endif + %files %license COPYING %{_bindir}/%{name} @@ -71,6 +86,7 @@ ln -s ../bin/%{name} %{buildroot}%{_bindir}/krun %package krun Summary: OCI Runtime providing Virtualization-based process isolation capabilities. Provides: krun +Requires: %{name} = %{version}-%{release} Requires: libkrun %description krun @@ -78,7 +94,20 @@ Requires: libkrun %files krun %{_bindir}/krun +%endif +%if "%{wasm_support}" == "enabled" +%package wasm +Summary: wasm support for %{name} +Requires: wasm-library +Recommends: wasmedge +Requires: %{name} = %{version}-%{release} + +%description wasm +%{name}-wasm provides %{name} built with wasm support + +%files wasm +%{_bindir}/%{name}-wasm %endif %changelog