Skip to content

Commit

Permalink
[WIP] crun: new package
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Stewart <christian@paral.in>
  • Loading branch information
paralin committed Aug 21, 2022
1 parent 6ebb46b commit b8fdc37
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 8 deletions.
1 change: 1 addition & 0 deletions DEVELOPERS
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ N: Christian Stewart <christian@paral.in>
F: package/batman-adv/
F: package/buildah/
F: package/containerd/
F: package/crun/
F: package/delve/
F: package/docker-cli/
F: package/docker-engine/
Expand Down
108 changes: 108 additions & 0 deletions package/crun/0001-Remove-libocispec-embedded-submodule.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
From 4e7d32835165b4c2a533dd02f4c27241cad37954 Mon Sep 17 00:00:00 2001
From: Christian Stewart <christian@paral.in>
Date: Sat, 20 Aug 2022 19:23:47 -0700
Subject: [PATCH] Remove libocispec embedded submodule

Signed-off-by: Christian Stewart <christian@paral.in>
---
Makefile.am | 31 +++++++++++--------------------
configure.ac | 1 -
2 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 2a65148..5800406 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,3 @@
-DIST_SUBDIRS = libocispec
-SUBDIRS = libocispec
ACLOCAL_AMFLAGS = -I m4

WD := $(shell pwd)
@@ -54,28 +52,25 @@ else
maybe_libyajl.la =
endif

-libocispec/libocispec.la:
- $(MAKE) $(AM_MAKEFLAGS) -C libocispec libocispec.la
-
libcrun_la_SOURCES = $(libcrun_SOURCES)
-libcrun_la_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -fvisibility=hidden
-libcrun_la_LIBADD = libocispec/libocispec.la $(FOUND_LIBS) $(maybe_libyajl.la)
+libcrun_la_CFLAGS = -fvisibility=hidden
+libcrun_la_LIBADD = $(FOUND_LIBS) $(maybe_libyajl.la)
libcrun_la_LDFLAGS = -Wl,--version-script=$(abs_top_srcdir)/libcrun.lds

# build a version with all the symbols visible for testing
libcrun_testing_a_SOURCES = $(libcrun_SOURCES)
-libcrun_testing_a_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -fvisibility=default
-libcrun_testing_a_LIBADD = libocispec/libocispec.la $(maybe_libyajl.la)
+libcrun_testing_a_CFLAGS = -fvisibility=default
+libcrun_testing_a_LIBADD = $(FOUND_LIBS) $(maybe_libyajl.la)

if PYTHON_BINDINGS
pyexec_LTLIBRARIES = python_crun.la
python_crun_la_SOURCES = python/crun_python.c
-python_crun_la_CFLAGS = -I $(abs_top_srcdir)/libocispec/src -I $(abs_top_builddir)/libocispec/src -I $(abs_top_builddir)/src $(PYTHON_CFLAGS)
+python_crun_la_CFLAGS = -I $(abs_top_builddir)/src $(PYTHON_CFLAGS)
python_crun_la_LDFLAGS = -avoid-version -module $(PYTHON_LDFLAGS)
python_crun_la_LIBADD = libcrun.la $(PYTHON_LIBS) $(FOUND_LIBS) $(maybe_libyajl.la)
endif

-crun_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -D CRUN_LIBDIR="\"$(CRUN_LIBDIR)\""
+crun_CFLAGS = -D CRUN_LIBDIR="\"$(CRUN_LIBDIR)\""
crun_SOURCES = src/crun.c src/run.c src/delete.c src/kill.c src/pause.c src/unpause.c src/spec.c \
src/exec.c src/list.c src/create.c src/start.c src/state.c src/update.c src/ps.c \
src/checkpoint.c src/restore.c
@@ -108,17 +103,17 @@ tests_init_LDADD =
tests_init_LDFLAGS = -static-libgcc -all-static
tests_init_SOURCES = tests/init.c

-tests_tests_libcrun_utils_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -I $(abs_top_builddir)/src -I $(abs_top_srcdir)/src
+tests_tests_libcrun_utils_CFLAGS = -I $(abs_top_builddir)/src -I $(abs_top_srcdir)/src
tests_tests_libcrun_utils_SOURCES = tests/tests_libcrun_utils.c
tests_tests_libcrun_utils_LDADD = $(TESTS_LDADD)
tests_tests_libcrun_utils_LDFLAGS = $(crun_LDFLAGS)

-tests_tests_libcrun_fuzzer_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -I $(abs_top_builddir)/src -I $(abs_top_srcdir)/src
+tests_tests_libcrun_fuzzer_CFLAGS = -I $(abs_top_builddir)/src -I $(abs_top_srcdir)/src
tests_tests_libcrun_fuzzer_SOURCES = tests/tests_libcrun_fuzzer.c
-tests_tests_libcrun_fuzzer_LDADD = $(TESTS_LDADD) libocispec/libocispec.la $(maybe_libyajl.la)
+tests_tests_libcrun_fuzzer_LDADD = $(TESTS_LDADD) $(FOUND_LIBS) $(maybe_libyajl.la)
tests_tests_libcrun_fuzzer_LDFLAGS = $(crun_LDFLAGS)

-tests_tests_libcrun_errors_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -I $(abs_top_builddir)/src -I $(abs_top_srcdir)/src
+tests_tests_libcrun_errors_CFLAGS = -I $(abs_top_builddir)/src -I $(abs_top_srcdir)/src
tests_tests_libcrun_errors_SOURCES = tests/tests_libcrun_errors.c
tests_tests_libcrun_errors_LDADD = $(TESTS_LDADD)
tests_tests_libcrun_errors_LDFLAGS = $(crun_LDFLAGS)
@@ -180,15 +175,11 @@ endif HAVE_MD2MAN

generate-man: crun.1

-sync:
- (cd libocispec; git pull https://github.com/containers/libocispec main)
-
coverity:
- $(MAKE) $(AM_MAKEFLAGS) -C libocispec
$(MAKE) $(AM_MAKEFLAGS) crun

libcrun.rs: src/libcrun/container.h
- bindgen src/libcrun/container.h -- -I$(abs_builddir) -I$(abs_builddir)/libocispec/src > $@
+ bindgen src/libcrun/container.h -- -I$(abs_builddir) > $@

generate-rust-bindings: libcrun.rs

diff --git a/configure.ac b/configure.ac
index fc669a9..0a4e6c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -213,5 +213,4 @@ AM_CONDITIONAL([CRIU_SUPPORT], [test "x$have_criu" = "xyes"])

AC_CONFIG_FILES([Makefile rpm/crun.spec])

-AC_CONFIG_SUBDIRS([libocispec])
AC_OUTPUT
--
2.37.2

3 changes: 2 additions & 1 deletion package/crun/Config.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
config BR2_PACKAGE_CRUN
bool "crun"
select BR2_PACKAGE_YAJL
select BR2_PACKAGE_LIBOCISPEC
select BR2_PACKAGE_YAJL # libocispec
help
crun is a fast and low-memory OCI Container Runtime in C.

Expand Down
2 changes: 1 addition & 1 deletion package/crun/crun.hash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Locally computed
sha256 bf9f6fef3fe287ef4d84e89b95cd5064a59ecd753c6a54e0968a0f7c2cda1fe9 crun-1.2.tar.gz
sha256 c10499b873044a7160880adc1123ee4ed22f37dd68d587e0a239f78e7ffe7376 crun-1.5.tar.gz
sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 COPYING
sha256 dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551 COPYING.libcrun
15 changes: 9 additions & 6 deletions package/crun/crun.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@
#
################################################################################

# TODO:
# - .version file needs to be created in advance
# - libocispec: needs separate package probably

CRUN_VERSION = 1.2
CRUN_VERSION = 1.5
CRUN_SITE = $(call github,containers,crun,$(CRUN_VERSION))
CRUN_DEPENDENCIES = host-pkgconf yajl
CRUN_DEPENDENCIES = host-pkgconf libocispec yajl
CRUN_LICENSE = GPL-2.0+ (crun binary), LGPL-2.1+ (libcrun)
CRUN_LICENSE_FILES = COPYING COPYING.libcrun

Expand All @@ -22,4 +18,11 @@ else
CRUN_CONF_OPTS += --disable-seccomp
endif

CRUN_CONF_OPTS += --enable-embedded-yajl=no

define CRUN_GEN_VERSION
echo "$(CRUN_VERSION)" > $(@D)/.version
endef
CRUN_PRE_BUILD_HOOKS += CRUN_GEN_VERSION

$(eval $(autotools-package))

0 comments on commit b8fdc37

Please sign in to comment.