link crun with embedded yajl statically in RHEL10

Resolves: RHEL-35583

Signed-off-by: Jindrich Novy <jnovy@redhat.com>
This commit is contained in:
Jindrich Novy 2024-05-09 13:57:57 +02:00
parent 496724d7cd
commit 1d9c886738
3 changed files with 91 additions and 2 deletions

28
134.patch Normal file
View File

@ -0,0 +1,28 @@
diff -up crun-1.15/libocispec/configure.ac.orig crun-1.15/libocispec/configure.ac
--- crun-1.15/libocispec/configure.ac.orig 2022-11-07 11:11:00.000000000 +0100
+++ crun-1.15/libocispec/configure.ac 2024-05-09 10:41:12.308679633 +0200
@@ -25,7 +25,10 @@ case "${enableval}" in
esac],[embedded_yajl=false])
AM_CONDITIONAL([HAVE_EMBEDDED_YAJL], [test x"$embedded_yajl" = xtrue])
-AM_COND_IF([HAVE_EMBEDDED_YAJL], [], [PKG_CHECK_MODULES([YAJL], [yajl >= 2.1.0])])
+AM_COND_IF([HAVE_EMBEDDED_YAJL], [], [
+AC_SEARCH_LIBS(yajl_tree_get, [yajl], [AC_DEFINE([HAVE_YAJL], 1, [Define if libyajl is available])], [AC_MSG_ERROR([*** libyajl headers not found])])
+PKG_CHECK_MODULES([YAJL], [yajl >= 2.0.0])
+])
# Optionally install the library.
AC_ARG_ENABLE(libocispec-install,
diff -up crun-1.15/libocispec/Makefile.am.orig crun-1.15/libocispec/Makefile.am
--- crun-1.15/libocispec/Makefile.am.orig 2023-04-13 21:08:30.000000000 +0200
+++ crun-1.15/libocispec/Makefile.am 2024-05-09 10:41:12.308679633 +0200
@@ -256,7 +256,8 @@ EXTRA_DIST = autogen.sh \
runtime-spec \
image-spec \
src/ocispec/json_common.h \
- src/ocispec/json_common.c
+ src/ocispec/json_common.c \
+ yajl/src
sync:
(cd image-spec; git pull https://github.com/opencontainers/image-spec)

58
1465.patch Normal file
View File

@ -0,0 +1,58 @@
From 8c80ab9b1562dfaa0bebcc8fa1414ec2637704de Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <gscrivan@redhat.com>
Date: Tue, 7 May 2024 17:37:58 +0200
Subject: [PATCH 1/4] utils: initialize fd
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
---
src/libcrun/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libcrun/utils.c b/src/libcrun/utils.c
index 884f71e61..2b27b078c 100644
--- a/src/libcrun/utils.c
+++ b/src/libcrun/utils.c
@@ -1037,7 +1037,7 @@ read_all_fd_with_size_hint (int fd, const char *description, char **out, size_t
int
read_all_file_at (int dirfd, const char *path, char **out, size_t *len, libcrun_error_t *err)
{
- cleanup_close int fd;
+ cleanup_close int fd = -1;
fd = TEMP_FAILURE_RETRY (openat (dirfd, path, O_RDONLY | O_CLOEXEC));
if (UNLIKELY (fd < 0))
From dd9428b2106bd192659f3d0a3d2c8a7087a5d8f2 Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <gscrivan@redhat.com>
Date: Tue, 7 May 2024 17:40:26 +0200
Subject: [PATCH 2/4] blake3: initialize chunks_array
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
---
src/libcrun/blake3/blake3.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libcrun/blake3/blake3.c b/src/libcrun/blake3/blake3.c
index 692f4b021..74fb485ec 100644
--- a/src/libcrun/blake3/blake3.c
+++ b/src/libcrun/blake3/blake3.c
@@ -174,7 +174,7 @@ INLINE size_t compress_chunks_parallel(const uint8_t *input, size_t input_len,
assert(input_len <= MAX_SIMD_DEGREE * BLAKE3_CHUNK_LEN);
#endif
- const uint8_t *chunks_array[MAX_SIMD_DEGREE];
+ const uint8_t *chunks_array[MAX_SIMD_DEGREE] = {0, };
size_t input_position = 0;
size_t chunks_array_len = 0;
while (input_len - input_position >= BLAKE3_CHUNK_LEN) {
From f00fa22789b722ebe3aa663e69bed6f359f05feb Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <gscrivan@redhat.com>
Date: Tue, 7 May 2024 15:18:40 +0200
Subject: [PATCH 3/4] libocispec: sync from upstream
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
---
libocispec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

View File

@ -44,6 +44,8 @@ Version: 1.15
Release: %autorelease
URL: https://github.com/containers/%{name}
Source0: %{url}/releases/download/%{version}/%{name}-%{version}.tar.zst
Patch0: https://patch-diff.githubusercontent.com/raw/containers/crun/pull/1465.patch
Patch1: https://patch-diff.githubusercontent.com/raw/containers/libocispec/pull/134.patch
License: GPL-2.0-only
%if %{defined golang_arches_future}
ExclusiveArch: %{golang_arches_future}
@ -60,7 +62,6 @@ BuildRequires: libcap-devel
BuildRequires: libkrun-devel
%endif
BuildRequires: systemd-devel
BuildRequires: yajl-devel
BuildRequires: libseccomp-devel
BuildRequires: python3-libmount
BuildRequires: libtool
@ -110,10 +111,12 @@ Recommends: wasmedge
%prep
%autosetup -Sgit -n %{name}-%{version}
cd libocispec/src/
ln -s ../yajl/src/api/ yajl
%build
./autogen.sh
./configure --disable-silent-rules %{krun_opts} %{wasmedge_opts} %{wasmtime_opts}
./configure --disable-silent-rules --enable-embedded-yajl %{krun_opts} %{wasmedge_opts} %{wasmtime_opts}
%make_build
%install