Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 12 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# corLibs

Umbrella build for the **k-libs** and **Cor-Libs** that the coraine (NGSI-LD
Umbrella build for the **Cor-Libs** that the coraine (NGSI-LD
context broker) links against. **This repo contains no library.** What it holds is
everything one needs to know to assemble the stack:

- **which repositories make it up**, and in which order they build — `bootstrap.sh`
and the makefile, which collect the archives, shared objects and test tooling
into `lib/` and `bin/`
- **at which versions** — `klib-pins`, the single source of truth for the k-lib
refs, read by `bootstrap.sh` and by the broker's own Dockerfile
- **what environment that build needs** — `docker/Dockerfile.ci`, published as
**`quay.io/seamware/coraine-ci`** and used by every cor repo's CI

Expand All @@ -27,28 +25,23 @@ them; it does not vendor them.
```
~/git/
├── corLibs/ ← this repo (umbrella: makefile + iter.sh, collects into bin/ lib/)
├── kbase ← k-libs (gitlab.com/kzangeli)
├── corLog corAlloc corArgs corHash corTree corJson corProm ← Cor-Libs (github.com/SEAMWARE)
├── corBase corLog corAlloc corArgs corHash corTree corJson corProm ← Cor-Libs (github.com/SEAMWARE)
├── corHttp corRest corJsonld corPlugin corNgsild
├── corTest ← test runner (github.com/SEAMWARE)
└── coraine ← the broker (links the above)
```

Build order respects dependencies: k-libs first (foundation, no Cor-Lib deps),
then Cor-Libs (`corLog corAlloc corArgs corHash corTree corJson corProm corHttp corRest corJsonld corPlugin corNgsild`) -
the log, allocator, command-line, hash, tree, JSON and metrics libraries first, since they need nothing but k-libs; then
Build order respects dependencies (`corBase corLog corAlloc corArgs corHash corTree corJson corProm corHttp corRest corJsonld corPlugin corNgsild`) -
corBase first, since it needs nothing; then the log, allocator, command-line, hash, tree, JSON and metrics libraries; then
corHttp, because corRest links it on a `COR_HTTP_SERVER=builtin` build.

## Libraries

Each library has its own README (linked below — the repo landing page renders it).

**k-libs** (gitlab.com/kzangeli) — foundation, no Cor-Lib dependencies:

- [kbase](https://gitlab.com/kzangeli/kbase) — core utilities and base types

**Cor-Libs** (github.com/SEAMWARE) — depend on the k-libs and each other:
**Cor-Libs** (github.com/SEAMWARE):

- [corBase](https://github.com/SEAMWARE/corBase) — core utilities and the library log (was the k-lib `kbase`)
- [corLog](https://github.com/SEAMWARE/corLog) — logging and trace levels (was the k-lib `ktrace`)
- [corAlloc](https://github.com/SEAMWARE/corAlloc) — arena allocator (`CorAlloc`) (was the k-lib `kalloc`)
- [corArgs](https://github.com/SEAMWARE/corArgs) — CLI argument parsing (was the k-lib `kargs`)
Expand All @@ -72,24 +65,16 @@ Each library has its own README (linked below — the repo landing page renders
- A C toolchain + `make`. Individual libs may pull system packages (OpenSSL,
libmicrohttpd, mosquitto, GEOS, the mongo-c v2 driver, …) — see coraine.

The pinned versions known to build together live in [`klib-pins`](klib-pins),
and **only** there - `bootstrap.sh`, this repo's umbrella makefile and the
broker's `docker/Dockerfile` all read that one file.

This README used to restate them as a table. It drifted, in five entries at
once: it still named `klog`, which has left the stack entirely, and it claimed
kjson `release/0.11.1` when the pin had reached `release/0.14.0`. That is the
precise failure `klib-pins` exists to prevent, so there is no table here any
more.

The Cor-Libs - corHttp, corRest, corJsonld, corPlugin, corNgsild, corTest -
track `main` by design.
Every library tracks `main` by design: they move together, and a pin between
them would only ever be stale. (The k-libs they grew out of were pinned to
release branches in a `klib-pins` file; with corBase the last of them left the
stack, and the file with them.)

## Quick start

If you don't have the sibling repos yet, the easiest path is
[`bootstrap.sh`](bootstrap.sh) **in this repo**: it clones every dependency at
the refs `klib-pins` names, as siblings of corLibs, then runs the umbrella build.
[`bootstrap.sh`](bootstrap.sh) **in this repo**: it clones every dependency
as a sibling of corLibs, then runs the umbrella build.

```sh
git clone https://github.com/SEAMWARE/corLibs.git && cd corLibs
Expand Down
5 changes: 2 additions & 3 deletions STYLE_GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Coding style — the Cor stack

Governs the **k-libs** (`kbase`, `kalloc`, `kargs`), the
**Cor-Libs** (`corLog`, `corHash`, `corTree`, `corJson`, `corProm`, `corRest`, `corJsonld`,
Governs the **Cor-Libs** (`corBase`, `corAlloc`, `corArgs`, `corLog`, `corHash`, `corTree`, `corJson`, `corProm`, `corRest`, `corJsonld`,
`corNgsild`, `corPlugin`, `corTest`) and **coraine**. One guide for all of them; where a rule below and
existing code disagree, the rule wins and the code is wrong.

Expand Down Expand Up @@ -35,7 +34,7 @@ Groups separated by one blank line, no blank lines inside a group:

1. C system headers
2. third-party headers
3. project headers, low-level to high-level (`kbase` → `kalloc` → `corLog` → `corTree` →
3. project headers, low-level to high-level (`corBase` → `corAlloc` → `corLog` → `corTree` →
`corJson` → `corHash` → `corRest` → `corJsonld` → `corNgsild`)
4. **own interface last**, in a `.c`, commented `// Own interface`

Expand Down
28 changes: 5 additions & 23 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ PROTO="${PROTO:-https}"
JOBS="${JOBS:-$(nproc 2>/dev/null || echo 4)}"

CI_ORG="SEAMWARE" # the cor* repos
KLIB_OWNER="kzangeli" # the k-libs, on gitlab

#
# The k-lib pins come from ./klib-pins, which is the single source of truth -
# the broker's Dockerfile reads the same file. Do not restate them here.
#
PINS="$HERE/klib-pins"
[ -r "$PINS" ] || { echo "bootstrap.sh: cannot read $PINS"; exit 1; }

#
# repo : host : ref
Expand All @@ -56,13 +48,8 @@ PINS="$HERE/klib-pins"
# only ever be stale. corLibs itself is deliberately absent - you are standing
# in it.
#
REPOS=()
while read -r repo ref; do
case "$repo" in ''|\#*) continue ;; esac
REPOS+=("$repo:gitlab:$ref")
done < <(sed 's/#.*//' "$PINS")

REPOS+=(
REPOS=(
"corBase:github:main"
"corLog:github:main"
"corAlloc:github:main"
"corArgs:github:main"
Expand Down Expand Up @@ -156,13 +143,8 @@ urlFor()
{
local repo="$1" host="$2"

if [ "$host" = gitlab ]; then
[ "$PROTO" = ssh ] && echo "git@gitlab.com:$KLIB_OWNER/${repo}.git" \
|| echo "https://gitlab.com/$KLIB_OWNER/${repo}.git"
else
[ "$PROTO" = ssh ] && echo "git@github.com:$CI_ORG/${repo}.git" \
|| echo "https://github.com/$CI_ORG/${repo}.git"
fi
[ "$PROTO" = ssh ] && echo "git@github.com:$CI_ORG/${repo}.git" \
|| echo "https://github.com/$CI_ORG/${repo}.git"
}

echo ">>> umbrella : $HERE"
Expand All @@ -184,7 +166,7 @@ for entry in "${REPOS[@]}"; do
if [ -d "$BASE/$repo/.git" ]; then
gitRetry "$repo fetch" git -C "$BASE/$repo" fetch --all --quiet
git -C "$BASE/$repo" checkout --quiet "$ref"
# A pinned release branch has nothing to pull; main might. Never merge.
# Fast-forward only - never merge.
git -C "$BASE/$repo" pull --ff-only --quiet || true
else
gitRetry "$repo clone" cloneFresh "$(urlFor "$repo" "$host")" "$ref" "$BASE/$repo"
Expand Down
3 changes: 1 addition & 2 deletions docker/Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ RUN git clone --depth 1 --branch "${MONGOC_VERSION}" \
#
# ⭐ THE VERSIONS ARE NOT NAMED HERE. corDdsBridge/ddsenabler-pinned.repos is
# the single source of truth for which eProsima releases the bridge is built
# against - the relationship klib-pins has with the k-libs - so it is FETCHED
# rather than restated. Two copies of a version pin are how they come to
# against, so it is FETCHED rather than restated. Two copies of a version pin are how they come to
# disagree at the worst possible moment.
#
# ⛔ And it pins RELEASES, not branches. eProsima's own ddsenabler.repos names
Expand Down
4 changes: 2 additions & 2 deletions iter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ ROOT=$(cd "$(dirname "$0")/.." && pwd)
# silently skipped a library and silently looked for one that is not there. The
# `-d` guard below is what made it quiet.
#
DIRS=$(sed -n 's/^K_DIRS *= *//p; s/^COR_DIRS *= *//p' "$ROOT/corLibs/makefile")
DIRS=$(sed -n 's/^COR_DIRS *= *//p' "$ROOT/corLibs/makefile")
if [ -z "$DIRS" ]; then
echo "iter.sh: could not read K_DIRS/COR_DIRS from corLibs/makefile" >&2
echo "iter.sh: could not read COR_DIRS from corLibs/makefile" >&2
exit 1
fi

Expand Down
13 changes: 0 additions & 13 deletions klib-pins

This file was deleted.

21 changes: 9 additions & 12 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Copyright 2026 Seamware
# SPDX-License-Identifier: Apache-2.0
#
# Umbrella makefile for all k-libs and Cor-Libs.
# Umbrella makefile for all Cor-Libs.
# Every library is a separate repo, and they are SIBLINGS of this one - the
# include paths and CMake references all resolve as ../<name>, so the layout is
# part of the build contract.
Expand All @@ -18,16 +18,14 @@
#
ROOT ?= $(abspath $(dir $(lastword $(MAKEFILE_LIST)))..)

# k-libs (foundation, no Cor-Lib dependencies)
K_DIRS = kbase

#
# Cor-Libs (depend on k-libs and each other)
# Cor-Libs, in dependency order
#
# corLog, corAlloc, corArgs, corHash, corTree, corJson and corProm come FIRST:
# they are the foundation the rest are built on - the log, the allocator, the
# command line, the hash tables, the tree, the JSON parser and renderer, and the
# metrics - and they depend on k-libs only. corHttp comes next: corRest links it when built with
# corBase is the very first: string/file/time helpers and the library log, and
# it depends on nothing. corLog, corAlloc, corArgs, corHash, corTree, corJson and
# corProm come next: they are the foundation the rest are built on - the log, the
# allocator, the command line, the hash tables, the tree, the JSON parser and
# renderer, and the metrics. corHttp comes next: corRest links it when built with
# COR_HTTP_SERVER=builtin, and this loop is ordered.
#
#
Expand All @@ -38,9 +36,9 @@ K_DIRS = kbase
# printed reason where it is not, and COR_BRIDGE_DDS=ON turns a missing
# dependency into an error for anyone who meant it.
#
COR_DIRS = corLog corAlloc corArgs corHash corTree corJson corProm corHttp corBridge corRest corJsonld corPlugin corNgsild corDdsBridge
COR_DIRS = corBase corLog corAlloc corArgs corHash corTree corJson corProm corHttp corBridge corRest corJsonld corPlugin corNgsild corDdsBridge

DIRS = $(K_DIRS) $(COR_DIRS)
DIRS = $(COR_DIRS)

CORLIBS_HOME = $(ROOT)/corLibs
BIN_DIR = $(CORLIBS_HOME)/bin
Expand Down Expand Up @@ -163,5 +161,4 @@ help:
@echo "make help - show this help"
@echo ""
@echo "Libraries under $(ROOT):"
@echo " k-libs: $(K_DIRS)"
@echo " Cor-Libs: $(COR_DIRS)"
Loading