88.2. json-c-0.19
JSON implementation in C
0.19-1 · MIT · 0.6 SBU · 209.3 KiB, 24 files · 41_system, 34 of 1047 · ports/core/formats/json-c
Homepage: https://github.com/json-c/json-c
json-c is a small C library for reading and writing JSON as a tree of reference-counted objects. Storage and system tools are its main users here: cryptsetup keeps LUKS2 metadata in JSON through it, and nvme-cli, libnvme, ndctl, crun and libvirt link it, as do gdal, freerdp and clamav.
Required by (15): accountsservice, clamav, crun, cryptsetup, freerdp, gdal, libmypaint, libnvme, libvirt, ndctl, newsboat, nvme-cli, thunderbird, tpm2-tss, v4l-utils.
Sources: json-c-0.19.tar.gz (451.4 KiB). Every step kpkg takes applies to this port.
Install: script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install json-c'
build.sh:
cmake -S . -B build -G Ninja \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBEXECDIR=lib \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS_RELEASE="$CFLAGS -DNDEBUG" \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_STATIC_LIBS=OFF \
-DDISABLE_EXTRA_LIBS=ON \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
-DCMAKE_C_FLAGS_RELEASE="$CFLAGS -DNDEBUG"— Replaces CMake’s Release flags,-O3 -DNDEBUG, with the tree’sCFLAGSand-DNDEBUG, so the library builds at the tree’s-O2(json-c’s ownCMakeLists.txtthen appends a further-O2).-DNDEBUGis kept, so assertions stay off as in any Release build.-DCMAKE_INSTALL_LIBEXECDIR=lib— Where helper programs would be installed; json-c installs none.-DBUILD_STATIC_LIBS=OFF— Build nolibjson-c.a. Upstream builds both the static and the shared library by default.-DDISABLE_EXTRA_LIBS=ON— Never link an extra library forarc4random(). musl has noarc4random, so without this switch configure looks for libbsd and links it whenever its header is installed, and the library’s dependencies would then change with what happened to be installed. With it, the hash seed comes fromgetrandom().-Wno-dev— Silences CMake’s warnings meant for the project’s own developers.
Libraries: libjson-c.so.
Directories: /usr/include/json-c, /usr/lib/cmake/json-c, /usr/share/licenses/json-c.