Skip to content

Commit

Permalink
libcbor: vendor update to 0.11.0
Browse files Browse the repository at this point in the history
Sponsored by:	The FreeBSD Foundation
  • Loading branch information
emaste committed May 3, 2024
2 parents 4510f2c + 5f50d6b commit 2693a26
Show file tree
Hide file tree
Showing 44 changed files with 746 additions and 213 deletions.
30 changes: 16 additions & 14 deletions contrib/libcbor/.circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ commands:
linux-setup:
steps:
- run: sudo apt-get update
- run: sudo apt-get install -y cmake ${TOOLCHAIN_PACKAGES}
- run: sudo apt install libcmocka-dev
# NEEDRESTART_MODE prevents automatic restarts which seem to hang.
- run: sudo NEEDRESTART_MODE=l apt-get install -y cmake ${TOOLCHAIN_PACKAGES}
- run: sudo NEEDRESTART_MODE=l apt-get install -y libcmocka-dev libcjson-dev
build:
steps:
- run: >
cmake -DWITH_TESTS=ON \
-DWITH_EXAMPLES=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DSANITIZE=OFF \
-DCOVERAGE="${CMAKE_COVERAGE:='OFF'}" \
Expand All @@ -31,14 +33,14 @@ orbs:

jobs:
static-test:
machine:
image: ubuntu-2204:2022.10.2
machine: &default-machine
image: ubuntu-2204:2023.07.2
environment:
TOOLCHAIN_PACKAGES: g++
steps:
- checkout
- linux-setup
- run: sudo apt-get install -y clang-format doxygen cppcheck
- run: sudo NEEDRESTART_MODE=l apt-get install -y clang-format doxygen cppcheck
- run: cppcheck --inline-suppr --error-exitcode=1 .
- run: bash clang-format.sh --verbose
- run: >
Expand All @@ -60,14 +62,14 @@ jobs:
build-and-test:
machine:
image: ubuntu-2204:2022.10.2
<<: *default-machine
environment:
TOOLCHAIN_PACKAGES: g++
CMAKE_COVERAGE: ON
steps:
- checkout
- linux-setup
- run: sudo apt-get install -y valgrind
- run: sudo NEEDRESTART_MODE=l apt-get install -y valgrind
- build
- test
- run: ctest -T Coverage
Expand All @@ -81,7 +83,7 @@ jobs:
build-and-test-clang:
machine:
image: ubuntu-2204:2022.10.2
<<: *default-machine
environment:
TOOLCHAIN_PACKAGES: clang
CC: clang
Expand All @@ -94,11 +96,11 @@ jobs:

build-and-test-32b:
machine:
image: ubuntu-2204:2022.10.2
<<: *default-machine
steps:
- checkout
- run: sudo apt-get update
- run: sudo apt-get install -y cmake gcc-multilib g++-multilib libc6-dev-i386
- run: sudo NEEDRESTART_MODE=l apt-get install -y cmake gcc-multilib g++-multilib libc6-dev-i386
# Make cmocka from source w/ 32b setup
- run: git clone https://git.cryptomilk.org/projects/cmocka.git ~/cmocka
- run: >
Expand All @@ -117,7 +119,7 @@ jobs:

build-and-test-release-clang:
machine:
image: ubuntu-2204:2022.10.2
<<: *default-machine
environment:
TOOLCHAIN_PACKAGES: clang
CC: clang
Expand All @@ -130,7 +132,7 @@ jobs:

llvm-coverage:
machine:
image: ubuntu-2204:2022.10.2
<<: *default-machine
environment:
TOOLCHAIN_PACKAGES: clang
CC: clang
Expand All @@ -145,7 +147,7 @@ jobs:

build-and-test-arm:
machine:
image: ubuntu-2204:2022.10.2
<<: *default-machine
environment:
TOOLCHAIN_PACKAGES: g++
resource_class: arm.medium
Expand All @@ -157,7 +159,7 @@ jobs:

build-bazel:
machine:
image: ubuntu-2204:2022.10.2
image: ubuntu-2204:2023.07.2
environment:
TOOLCHAIN_PACKAGES: g++
steps:
Expand Down
26 changes: 26 additions & 0 deletions contrib/libcbor/.cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
freebsd_task:
install_script:
- ASSUME_ALWAYS_YES=yes pkg bootstrap -f && pkg install -y cmocka cmake ninja
build_script:
- mkdir build
- cd build
- cmake -GNinja -DWITH_TESTS=ON
-DCBOR_CUSTOM_ALLOC=ON
-DCMAKE_BUILD_TYPE=Debug
-DSANITIZE=OFF
..
- ninja -j $(sysctl -n hw.ncpu)
test_script:
- cd build
- ctest -VV
matrix:
# From gcloud compute images list --project freebsd-org-cloud-dev --no-standard-images
- name: freebsd-13-2
freebsd_instance:
image_family: freebsd-13-2
- name: freebsd-14-0
freebsd_instance:
image_family: freebsd-14-0
- name: freebsd-15-0-snap
freebsd_instance:
image_family: freebsd-15-0-snap
21 changes: 21 additions & 0 deletions contrib/libcbor/.readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"

sphinx:
configuration: doc/source/conf.py

# We recommend specifying your dependencies to enable reproducible builds:
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: doc/source/requirements.txt
15 changes: 14 additions & 1 deletion contrib/libcbor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ Template:
Next
---------------------

0.11.0 (2024-02-04)
---------------------
- [Updated documentation to refer to RFC 8949](https://github.com/PJK/libcbor/issues/269)
- Improvements to `cbor_describe`
- [Bytestring data will now be printed as well](https://github.com/PJK/libcbor/pull/281) by [akallabeth](https://github.com/akallabeth)
- [Formatting consistency and clarity improvements](https://github.com/PJK/libcbor/pull/285)
- [Fix `cbor_string_set_handle` not setting the codepoint count](https://github.com/PJK/libcbor/pull/286)
- BREAKING: [`cbor_load` will no longer fail on input strings that are well-formed but not valid UTF-8](https://github.com/PJK/libcbor/pull/286)
- If you were relying on the validation, please check the result using `cbor_string_codepoint_count` instead
- BREAKING: [All decoders like `cbor_load` and `cbor_stream_decode` will accept all well-formed tag values](https://github.com/PJK/libcbor/pull/308) (bug discovered by [dskern-github](https://github.com/dskern-github))
- Previously, decoding of certain values would fail with `CBOR_ERR_MALFORMATED` or `CBOR_DECODER_ERROR`
- This also makes decoding symmetrical with serialization, which already accepts all values

0.10.2 (2023-01-31)
---------------------
- [Fixed minor test bug causing failures for x86 Linux](https://github.com/PJK/libcbor/pull/266) (discovered by [trofi](https://github.com/PJK/libcbor/issues/263))
Expand Down Expand Up @@ -117,7 +130,7 @@ Next
Breaks build & header compatibility due to:

- Improved build configuration and feature check macros
- Endianess configuration fixes (by Erwin Kroon and David Grigsby)
- Endianness configuration fixes (by Erwin Kroon and David Grigsby)
- pkg-config compatibility (by Vincent Bernat)
- enable use of versioned SONAME (by Vincent Bernat)
- better fuzzer (wasn't random until now, ooops)
Expand Down
18 changes: 10 additions & 8 deletions contrib/libcbor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
cmake_minimum_required(VERSION 3.0)

project(libcbor)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/")
include(CTest)
include(GNUInstallDirs) # Provides CMAKE_INSTALL_ variables

SET(CBOR_VERSION_MAJOR "0")
SET(CBOR_VERSION_MINOR "10")
SET(CBOR_VERSION_PATCH "2")
SET(CBOR_VERSION_MINOR "11")
SET(CBOR_VERSION_PATCH "0")
SET(CBOR_VERSION ${CBOR_VERSION_MAJOR}.${CBOR_VERSION_MINOR}.${CBOR_VERSION_PATCH})

set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)
option(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY "cmake --build --target install does not depend on cmake --build" true)
option(BUILD_SHARED_LIBS "Build as a shared library" false)

include(CheckIncludeFiles)

include(TestBigEndian)
Expand All @@ -19,10 +23,10 @@ endif()

option(CBOR_CUSTOM_ALLOC "Custom, dynamically defined allocator support" OFF)
if(CBOR_CUSTOM_ALLOC)
message(WARNING
message(WARNING
"CBOR_CUSTOM_ALLOC has been deprecated. Custom allocators are now enabled by default."
"The flag is a no-op and will be removed in the next version. "
"Please remove CBOR_CUSTOM_ALLOC from your build configuation.")
"Please remove CBOR_CUSTOM_ALLOC from your build configuration.")
endif(CBOR_CUSTOM_ALLOC)

option(CBOR_PRETTY_PRINTER "Include a pretty-printing routine" ON)
Expand Down Expand Up @@ -138,12 +142,10 @@ if (COVERAGE)
endif()
endif (COVERAGE)


# We want to generate configuration.h from the template and make it so that it is accessible using the same
# path during both library build and installed header use, without littering the source dir.
# Using cbor/configuration.h in the build dir works b/c headers will be installed to <prefix>/cbor
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/cbor/configuration.h.in ${PROJECT_BINARY_DIR}/cbor/configuration.h)
install(FILES ${PROJECT_BINARY_DIR}/cbor/configuration.h DESTINATION include/cbor)
install(FILES ${PROJECT_BINARY_DIR}/cbor/configuration.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cbor)
# Make the header visible at compile time
include_directories(${PROJECT_BINARY_DIR})

Expand Down
2 changes: 1 addition & 1 deletion contrib/libcbor/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

libcbor is maintained by [@PJK](https://github.com/PJK) in his spare time on a best-effort basis.

Community contributions are welcome as long as they align with the [project priorities](https://github.com/PJK/libcbor#main-features) and [goals](https://libcbor.readthedocs.io/en/latest/development.html#goals) and follow the guidelines described belows.
Community contributions are welcome as long as they align with the [project priorities](https://github.com/PJK/libcbor#main-features) and [goals](https://libcbor.readthedocs.io/en/latest/development.html#goals) and follow the guidelines described below.

## Principles

Expand Down
2 changes: 1 addition & 1 deletion contrib/libcbor/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PROJECT_NAME = libcbor
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 0.10.2
PROJECT_NUMBER = 0.11.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
7 changes: 3 additions & 4 deletions contrib/libcbor/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# [libcbor](https://github.com/PJK/libcbor)

[![CircleCI](https://circleci.com/gh/PJK/libcbor/tree/master.svg?style=svg)](https://circleci.com/gh/PJK/libcbor/tree/master)
[![Build status](https://ci.appveyor.com/api/projects/status/8kkmvmefelsxp5u2?svg=true)](https://ci.appveyor.com/project/PJK/libcbor)
[![Documentation Status](https://readthedocs.org/projects/libcbor/badge/?version=latest)](https://readthedocs.org/projects/libcbor/?badge=latest)
[![latest packaged version(s)](https://repology.org/badge/latest-versions/libcbor.svg)](https://repology.org/project/libcbor/versions)
[![codecov](https://codecov.io/gh/PJK/libcbor/branch/master/graph/badge.svg)](https://codecov.io/gh/PJK/libcbor)

**libcbor** is a C library for parsing and generating [CBOR](https://tools.ietf.org/html/rfc7049), the general-purpose schema-less binary data format.
**libcbor** is a C library for parsing and generating [CBOR](https://cbor.io/), the general-purpose schema-less binary data format.

## Main features
- Complete RFC conformance
- Robust C99 implementation
- Complete [IETF RFC 8949 (STD 94)](https://www.rfc-editor.org/info/std94) conformance
- Robust platform-independent C99 implementation
- Layered architecture offers both control and convenience
- Flexible memory management
- No shared global state - threading friendly
Expand Down
14 changes: 0 additions & 14 deletions contrib/libcbor/appveyor.yml

This file was deleted.

2 changes: 1 addition & 1 deletion contrib/libcbor/doc/source/api/item_types.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Types of items
===============================================

Every :type:`cbor_item_t` has a :type:`cbor_type` associated with it - these constants correspond to the types specified by the `CBOR standard <http://tools.ietf.org/html/rfc7049>`_:
Every :type:`cbor_item_t` has a :type:`cbor_type` associated with it - these constants correspond to the types specified by the `CBOR standard <https://www.rfc-editor.org/info/std94>`_:

.. doxygenenum:: cbor_type

Expand Down
18 changes: 5 additions & 13 deletions contrib/libcbor/doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
'breathe',
'sphinx.ext.mathjax',
'sphinx.ext.autodoc',
'sphinx.ext.ifconfig'
'sphinx.ext.ifconfig',
'sphinx_rtd_theme'
]

import subprocess, os
Expand Down Expand Up @@ -76,8 +77,8 @@
# built documents.
#
# The short X.Y version.
version = '0.10'
release = '0.10.2'
version = '0.11'
release = '0.11.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -127,7 +128,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
html_theme = 'sphinx_rtd_theme'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -285,12 +286,3 @@

# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False


if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# otherwise, readthedocs.org uses their theme by default, so no need to specify it

6 changes: 3 additions & 3 deletions contrib/libcbor/doc/source/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ everywhere.
Goals
~~~~~~~~~~~~~~~~~~~~~~

RFC-conformance and full feature support
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Standard conformance and full feature support
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Anything the standard allows, libcbor can do.

**Why?** Because conformance and interoperability is the point of defining
standards. Clients expect the support to be feature-complete and
there is no significant complexity reduction that can be achieved by slightly
cutting corners, which means that the incremental cost of full RFC support is
cutting corners, which means that the incremental cost of full [CBOR standard](https://www.rfc-editor.org/info/std94) support is
comparatively small over "almost-conformance" seen in many alternatives.


Expand Down
8 changes: 4 additions & 4 deletions contrib/libcbor/doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Overview


Main features
- Complete RFC conformance [#]_
- Complete `IETF RFC 8949 (STD 94) <https://www.rfc-editor.org/info/std94>`_ conformance [#]_
- Robust C99 implementation
- Layered architecture offers both control and convenience
- Flexible memory management
Expand All @@ -19,7 +19,7 @@ Main features
- Extensive documentation and test suite
- No runtime dependencies, small footprint

.. [#] See :doc:`rfc_conformance`
.. [#] See :doc:`standard_conformance`
.. [#] With the exception of custom memory allocators (see :doc:`api/item_reference_counting`)
Expand All @@ -31,9 +31,9 @@ Contents
using
api
tests
rfc_conformance
standard_conformance
internal
changelog
development

.. _CBOR: http://tools.ietf.org/html/rfc7049
.. _CBOR: https://www.rfc-editor.org/info/std94
Loading

0 comments on commit 2693a26

Please sign in to comment.