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 <lsm5@fedoraproject.org>
This commit is contained in:
Lokesh Mandvekar 2022-11-03 17:43:59 +05:30
parent db6cce4e02
commit f0e158812d

View File

@ -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