Skip to content

Commit

Permalink
Merge pull request #146 from xw19/switch-to-jansson-SM
Browse files Browse the repository at this point in the history
Switch to jansson sm Remove YAJL and Jansson
  • Loading branch information
saschagrunert authored Nov 27, 2024
2 parents 7b3498e + 7c67879 commit 19192a0
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 90 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,14 @@ jobs:
install: |
apt-get update -q -y
apt-get install -q -y python3 automake libtool autotools-dev git make cmake pkg-config gcc wget xz-utils
apt-get install -q -y python3 automake libtool autotools-dev git make cmake pkg-config gcc wget xz-utils libjansson-dev
run: |
# Install jansson
cd jansson;
autoreconf -fi;
./configure;
make;
make install;
cd ..
# Configure and Run libocispec
export JANSSON_CFLAGS=-I/usr/local/include;
export JANSSON_LIBS=/usr/local/lib/libjansson.so
find $(pwd) -name '.git' -exec bash -c 'git config --global --add safe.directory ${0%/.git}' {} \;
./autogen.sh --enable-embedded-yajl
./configure --enable-embedded-yajl CFLAGS='-Wall -Wextra -Werror'
make -j $(nproc) distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-embedded-yajl" AM_DISTCHECK_DVI_TARGET="" TESTS=""
./autogen.sh
./configure CFLAGS='-Wall -Wextra -Werror'
make -j $(nproc) distcheck AM_DISTCHECK_DVI_TARGET="" TESTS=""
# check that the working dir is clean
git describe --broken --dirty --all | grep -qv dirty
make clean
Expand Down
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,3 @@
[submodule "image-spec"]
path = image-spec
url = https://github.com/opencontainers/image-spec
[submodule "yajl"]
path = yajl
url = https://github.com/containers/yajl.git
[submodule "jansson"]
path = jansson
url = https://github.com/akheron/jansson
13 changes: 5 additions & 8 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:22.04
FROM ubuntu:24.04

RUN apt-get update && \
apt-get install -y \
Expand All @@ -7,17 +7,14 @@ RUN apt-get update && \
git \
libtool \
pkg-config \
python3
python3 \
libjansson-dev


COPY . libocispec

RUN cd libocispec/jansson && autoreconf -fi && ./configure && make && make install

RUN cd libocispec && \
export JANSSON_CFLAGS=-I/usr/local/include && \
export JANSSON_LIBS=/usr/local/lib/libjansson.so && \
./autogen.sh --enable-embedded-yajl && \
./configure --enable-embedded-yajl CFLAGS='-Wall -Wextra -Werror' && \
./autogen.sh && \
./configure CFLAGS='-Wall -Wextra -Werror' && \
make -j $(nproc) distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-embedded-yajl" AM_DISTCHECK_DVI_TARGET="" TESTS="" && \
make clean
28 changes: 1 addition & 27 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
DIST_SUBDIRS = yajl jansson
SUBDIRS = yajl jansson

AM_CFLAGS = $(WARN_CFLAGS) -I$(top_srcdir)/src -I$(top_builddir)/src

if HAVE_EMBEDDED_YAJL
AM_CFLAGS += -I$(top_srcdir)/yajl/src/headers
endif HAVE_EMBEDDED_YAJL

if HAVE_EMBEDDED_JANSSON
AM_CFLAGS += -I$(top_srcdir)/jansson/src
endif HAVE_EMBEDDED_JANSSON

CLEANFILES = $(man_MANS) src/runtime_spec_stamp src/image_spec_stamp src/image_manifest_stamp src/basic-test_stamp

GITIGNOREFILES = build-aux/ gtk-doc.make config.h.in aclocal.m4
Expand Down Expand Up @@ -159,18 +148,6 @@ CLEANFILES += $(HEADER_FILES) $(SOURCE_FILES) $(TMP_H_FILES) $(TMP_C_FILES)

TESTS_LDADD = libocispec.la $(SELINUX_LIBS)

if HAVE_EMBEDDED_YAJL
TESTS_LDADD += yajl/libyajl.la
else
TESTS_LDADD += $(YAJL_LIBS)
endif

if HAVE_EMBEDDED_JANSSON
TESTS_LDADD += jansson/src/.libs/libjansson.la
else
TESTS_LDADD += $(JANSSON_LIBS)
endif

libocispec_a_SOURCES =

libocispec.a: libocispec.la $(BUILT_SOURCES) src/runtime_spec_stamp src/image_spec_stamp src/image_manifest_stamp src/basic-test_stamp
Expand Down Expand Up @@ -266,14 +243,11 @@ EXTRA_DIST = autogen.sh \
runtime-spec \
image-spec \
src/ocispec/json_common.h \
src/ocispec/json_common.c \
src/yajl
src/ocispec/json_common.c

sync:
(cd image-spec; git pull https://github.com/opencontainers/image-spec)
(cd runtime-spec; git pull https://github.com/opencontainers/runtime-spec)
(cd yajl; git pull https://github.com/containers/yajl main)
(cd jansson; git pull https://github.com/akheron/jansson master)


generate: src/runtime_spec_stamp src/image_spec_stamp src/image_manifest_stamp src/basic-test_stamp
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ from C, and generate json string from corresponding struct.
The parser is generated directly from the JSON schema in the source repository.

## Installation
Expects [yajl](https://github.com/containers/yajl) and [jansson](https://github.com/akheron/jansson) to be installed and linkable.
Expects [jansson](https://github.com/akheron/jansson) to be installed and linkable.
```sh
$ ./autogen.sh
$ ./configure
Expand Down
4 changes: 0 additions & 4 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh

(cd yajl; ./autogen.sh)

git submodule update --init --recursive

test -n "$srcdir" || srcdir=`dirname "$0"`
Expand All @@ -15,8 +13,6 @@ if ! (autoreconf --version >/dev/null 2>&1); then
exit 1
fi

(cd ./jansson; autoreconf -i)

mkdir -p m4

autoreconf --force --install --verbose
Expand Down
29 changes: 1 addition & 28 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AC_PREREQ([2.63])
AC_INIT([libocispec], [0.3], [[email protected]])
AC_INIT([libocispec], [0.4], [[email protected]])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
Expand All @@ -12,33 +12,6 @@ AM_INIT_AUTOMAKE([1.11 -Wno-portability foreign tar-ustar no-dist-gzip dist-xz s
AM_MAINTAINER_MODE([enable])
AM_SILENT_RULES([yes])

AM_EXTRA_RECURSIVE_TARGETS([yajl jansson])
AC_CONFIG_SUBDIRS([yajl jansson])

AC_ARG_ENABLE(embedded-yajl,
AS_HELP_STRING([--enable-embedded-yajl], [Statically link a modified yajl version]),
[
case "${enableval}" in
yes) embedded_yajl=true ;;
no) embedded_yajl=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-embedded-yajl) ;;
esac],[embedded_yajl=false])

AM_CONDITIONAL([HAVE_EMBEDDED_YAJL], [test x"$embedded_yajl" = xtrue])
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])
])

AC_ARG_ENABLE(embedded-jansson,
AS_HELP_STRING([--enable-embedded-jansson], [Statically link a jansson version]),
[
case "${enableval}" in
yes) embedded_jansson=true ;;
no) embedded_jansson=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-embedded-jansson) ;;
esac],[embedded_jansson=false])

AM_CONDITIONAL([HAVE_EMBEDDED_JANSSON], [test x"$embedded_jansson" = xtrue])
AM_COND_IF([HAVE_EMBEDDED_JANSSON], [], [
AC_SEARCH_LIBS(json_object, [jansson], [AC_DEFINE([HAVE_JANSSON], 1, [Define if libjansson is available])], [AC_MSG_ERROR([*** libjansson headers not found])])
Expand Down
1 change: 0 additions & 1 deletion jansson
Submodule jansson deleted from 684e18
1 change: 0 additions & 1 deletion yajl
Submodule yajl deleted from 6bc521

0 comments on commit 19192a0

Please sign in to comment.