|
| 1 | +From 5edb3adc3a5d64113d056da46db634ecc2871e75 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Michal Pogoda < [email protected]> |
| 3 | +Date: Tue, 17 Mar 2020 16:55:20 +0100 |
| 4 | +Subject: [PATCH 1/2] Preparing for library build |
| 5 | + |
| 6 | +--- |
| 7 | + Makefile.am | 19 +++++++++++++++++++ |
| 8 | + configure.ac | 5 ++++- |
| 9 | + libcrun.pc.in | 11 +++++++++++ |
| 10 | + libocispec/Makefile.am | 13 +++---------- |
| 11 | + src/libcrun/container.c | 2 +- |
| 12 | + src/libcrun/error.c | 2 +- |
| 13 | + 6 files changed, 39 insertions(+), 13 deletions(-) |
| 14 | + create mode 100644 libcrun.pc.in |
| 15 | + |
| 16 | +diff --git a/Makefile.am b/Makefile.am |
| 17 | +index 8f96a4f..5e86199 100644 |
| 18 | +--- a/Makefile.am |
| 19 | ++++ b/Makefile.am |
| 20 | +@@ -38,6 +38,25 @@ libcrun_la_SOURCES = src/libcrun/utils.c \ |
| 21 | + libcrun_la_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src |
| 22 | + libcrun_la_LIBADD = libocispec/libocispec.la |
| 23 | + |
| 24 | ++pkginclude_HEADERS = src/libcrun/container.h \ |
| 25 | ++ config.h \ |
| 26 | ++ src/libcrun/error.h \ |
| 27 | ++ src/libcrun/status.h \ |
| 28 | ++ src/libcrun/utils.h \ |
| 29 | ++ libocispec/src/runtime_spec_schema_config_schema.h \ |
| 30 | ++ libocispec/src/runtime_spec_schema_config_linux.h \ |
| 31 | ++ libocispec/src/runtime_spec_schema_config_solaris.h \ |
| 32 | ++ libocispec/src/runtime_spec_schema_config_windows.h \ |
| 33 | ++ libocispec/src/runtime_spec_schema_config_vm.h \ |
| 34 | ++ libocispec/src/runtime_spec_schema_defs.h \ |
| 35 | ++ libocispec/src/runtime_spec_schema_defs_linux.h \ |
| 36 | ++ libocispec/src/runtime_spec_schema_defs_windows.h \ |
| 37 | ++ libocispec/src/runtime_spec_schema_defs_vm.h \ |
| 38 | ++ libocispec/src/json_common.h |
| 39 | ++ |
| 40 | ++pkgconfigdir = @pkgconfigdir@ |
| 41 | ++pkgconfig_DATA = libcrun.pc |
| 42 | ++ |
| 43 | + if PYTHON_BINDINGS |
| 44 | + pyexec_LTLIBRARIES = python_crun.la |
| 45 | + python_crun_la_SOURCES = python/crun_python.c |
| 46 | +diff --git a/configure.ac b/configure.ac |
| 47 | +index ea6ed11..cab11ec 100644 |
| 48 | +--- a/configure.ac |
| 49 | ++++ b/configure.ac |
| 50 | +@@ -123,7 +123,10 @@ AC_SEARCH_LIBS([argp_parse], [argp], [], [AC_MSG_ERROR([*** argp functions not f |
| 51 | + AM_CONDITIONAL([PYTHON_BINDINGS], [test "x$with_python_bindings" = "xyes"]) |
| 52 | + AM_CONDITIONAL([CRIU_SUPPORT], [test "x$have_criu" = "xyes"]) |
| 53 | + |
| 54 | +-AC_CONFIG_FILES([Makefile rpm/crun.spec]) |
| 55 | ++PKG_INSTALLDIR |
| 56 | ++AC_SUBST(pkgconfigdir) |
| 57 | ++ |
| 58 | ++AC_CONFIG_FILES([Makefile rpm/crun.spec libcrun.pc]) |
| 59 | + |
| 60 | + AC_CONFIG_SUBDIRS([libocispec]) |
| 61 | + AC_OUTPUT |
| 62 | +diff --git a/libcrun.pc.in b/libcrun.pc.in |
| 63 | +new file mode 100644 |
| 64 | +index 0000000..54ee2eb |
| 65 | +--- /dev/null |
| 66 | ++++ b/libcrun.pc.in |
| 67 | +@@ -0,0 +1,11 @@ |
| 68 | ++prefix=@prefix@ |
| 69 | ++exec_prefix=@exec_prefix@ |
| 70 | ++libdir=@libdir@ |
| 71 | ++includedir=@includedir@ |
| 72 | ++ |
| 73 | ++Name: LibCRun |
| 74 | ++Description: Library for running the OCI containers |
| 75 | ++Version: 0.1.13 |
| 76 | ++Requires: libseccomp libcap yajl |
| 77 | ++Cflags: -I${includedir}/crun -I${includedir} |
| 78 | ++Libs: -L${libdir} -lseccomp -lcap -lyajl -lcrun |
| 79 | +\ No newline at end of file |
| 80 | +diff --git a/libocispec/Makefile.am b/libocispec/Makefile.am |
| 81 | +index 65bed45..53a8b32 100644 |
| 82 | +--- a/libocispec/Makefile.am |
| 83 | ++++ b/libocispec/Makefile.am |
| 84 | +@@ -4,8 +4,7 @@ AM_CFLAGS = $(WARN_CFLAGS) -I$(top_srcdir)/src -I$(top_builddir)/src |
| 85 | + |
| 86 | + GITIGNOREFILES = build-aux/ gtk-doc.make config.h.in aclocal.m4 |
| 87 | + |
| 88 | +-noinst_LTLIBRARIES = libocispec.la |
| 89 | +-noinst_LIBRARIES = libocispec.a |
| 90 | ++lib_LTLIBRARIES = libocispec.la |
| 91 | + |
| 92 | + SOURCE_FILES = src/json_common.c \ |
| 93 | + src/image_spec_schema_config_schema.c \ |
| 94 | +@@ -25,9 +24,8 @@ SOURCE_FILES = src/json_common.c \ |
| 95 | + src/runtime_spec_schema_defs_vm.c \ |
| 96 | + src/runtime_spec_schema_defs_windows.c \ |
| 97 | + src/runtime_spec_schema_state_schema.c \ |
| 98 | +- src/image_manifest_items_image_manifest_items_schema.c \ |
| 99 | +- src/json_common.c |
| 100 | +- |
| 101 | ++ src/image_manifest_items_image_manifest_items_schema.c |
| 102 | ++ |
| 103 | + HEADER_FILES = $(SOURCE_FILES:.c=.h) |
| 104 | + |
| 105 | + src/json_common.h src/json_common.c: |
| 106 | +@@ -61,15 +59,10 @@ BUILT_SOURCES = $(HEADER_FILES) $(SOURCE_FILES) |
| 107 | + libocispec_la_SOURCES = $(SOURCE_FILES) \ |
| 108 | + src/read-file.c |
| 109 | + |
| 110 | +-libocispec_a_SOURCES = |
| 111 | +- |
| 112 | + CLEANFILES += $(HEADER_FILES) $(SOURCE_FILES) |
| 113 | + |
| 114 | + TESTS_LDADD = libocispec.la $(SELINUX_LIBS) $(YAJL_LIBS) |
| 115 | + |
| 116 | +-libocispec.a: libocispec.la |
| 117 | +- $(LIBTOOL) --mode=link $(GCC) libocispec.la -o libocispec.a |
| 118 | +- |
| 119 | + tests_test_1_SOURCES = tests/test-1.c |
| 120 | + tests_test_1_LDADD = $(TESTS_LDADD) |
| 121 | + |
| 122 | +diff --git a/src/libcrun/container.c b/src/libcrun/container.c |
| 123 | +index 22cb41f..7f7dafc 100644 |
| 124 | +--- a/src/libcrun/container.c |
| 125 | ++++ b/src/libcrun/container.c |
| 126 | +@@ -1778,7 +1778,7 @@ libcrun_container_run (libcrun_context_t *context, libcrun_container_t *containe |
| 127 | + crun_set_output_handler (log_write_to_stderr, NULL, false); |
| 128 | + libcrun_fail_with_error ((*err)->status, "%s", (*err)->msg); |
| 129 | + } |
| 130 | +- exit (ret); |
| 131 | ++ _exit (ret); |
| 132 | + } |
| 133 | + |
| 134 | + int |
| 135 | +diff --git a/src/libcrun/error.c b/src/libcrun/error.c |
| 136 | +index cb49b0d..56ea309 100644 |
| 137 | +--- a/src/libcrun/error.c |
| 138 | ++++ b/src/libcrun/error.c |
| 139 | +@@ -386,7 +386,7 @@ libcrun_fail_with_error (int errno_, const char *msg, ...) |
| 140 | + va_start (args_list, msg); |
| 141 | + write_log (errno_, false, msg, args_list); |
| 142 | + va_end (args_list); |
| 143 | +- exit (EXIT_FAILURE); |
| 144 | ++ _exit (EXIT_FAILURE); |
| 145 | + } |
| 146 | + |
| 147 | + int |
| 148 | +-- |
| 149 | +2.20.1 |
| 150 | + |
0 commit comments