From 38e50e248376826e5fa051354bb8c8e55093a8bc Mon Sep 17 00:00:00 2001 From: Takuro Ashie Date: Wed, 17 Jun 2026 08:22:12 +0900 Subject: [PATCH 1/2] CI: Verify release build --- .github/workflows/tests.yml | 9 ++- README.md | 19 ++++-- scripts/{bootstrap-tests.sh => build.sh} | 87 ++++++++++++------------ 3 files changed, 65 insertions(+), 50 deletions(-) rename scripts/{bootstrap-tests.sh => build.sh} (50%) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 585c826..dede204 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,9 +29,14 @@ jobs: - name: Build run: | - chmod +x ./scripts/bootstrap-tests.sh - SKIP_CHECK=1 ./scripts/bootstrap-tests.sh + chmod +x ./scripts/build.sh + ./scripts/build.sh - name: Run tests run: | make check + + - name: Verify release build + run: | + make distclean + BUILD_MODE=release ./scripts/build.sh diff --git a/README.md b/README.md index d8c1c64..04c104a 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ The following settings are for the Renesas Porter board, but they may be updated to use more generic settings. -``` +```ini [libv4l-gst] min-buffers=2 @@ -58,27 +58,34 @@ Running ======= Create a dummy V4L2 device file under /dev -``` +```console # touch /dev/video-gst # chmod 666 /dev/video-gst ``` Accessing the /dev/video-gst file will allow an application to use the v4l-gst plugin using the same API as a regular V4L2 device file. -Building and running unit tests -=============================== +Building and running unit tests on PC +===================================== + +## Overview + +Although this software intends to build on Yocto, you can run unit tests on GNU/Linux PC +using in-tree v4l-utils. ## Prerequisites In addition to developer tools for standard build, need following tools: * [`cutter`](https://github.com/clear-code/cutter) -* meson (to build v4l-utils) +* meson (to build in-tree v4l-utils) + +See [the CI workflow](./.github/workflows/tests.yml) for more detail. ## Build ```console -./scripts/bootstrap-tests.sh +$ ./scripts/build.sh ``` ## Run tests diff --git a/scripts/bootstrap-tests.sh b/scripts/build.sh similarity index 50% rename from scripts/bootstrap-tests.sh rename to scripts/build.sh index 2a8c822..1768346 100755 --- a/scripts/bootstrap-tests.sh +++ b/scripts/build.sh @@ -3,7 +3,7 @@ set -eu # Bootstrap and run tests for this repository. This script will: # - ensure v4l-utils submodule is built into _install_root/usr (if needed) # - ensure cutter is available (system or build submodule into _local) -# - configure (if needed), build (if needed) and run `make check` +# - configure (if needed), build (if needed) ROOT="$(cd "$(dirname "$0")/.." && pwd)" cd "$ROOT" @@ -48,43 +48,48 @@ if [ ! -d "$V4L_DIR" ]; then fi fi -# Cutter: prefer system cutter; otherwise use local installed copy or build -if command -v cutter >/dev/null 2>&1; then - echo "cutter found in PATH; skipping cutter build" -elif [ -x "$ROOT/_local/bin/cutter" ]; then - echo "Using existing local cutter at $ROOT/_local/bin/cutter" - export PATH="$ROOT/_local/bin:$PATH" - export PKG_CONFIG_PATH="$ROOT/_local/lib/pkgconfig:${PKG_CONFIG_PATH-}" +# Cutter: prefer system cutter; otherwise build the submodule when doing test builds +BUILD_MODE="${BUILD_MODE-test}" +if [ "$BUILD_MODE" = "release" ]; then + echo "BUILD_MODE=release: skipping cutter build (unit test harness not required)" else - echo "cutter not found — attempting to build from submodule..." - git submodule update --init --recursive cutter || { - echo "cutter submodule not present; please add or install cutter." >&2 - exit 1 - } + if command -v cutter >/dev/null 2>&1; then + echo "cutter found in PATH; skipping cutter build" + elif [ -x "$ROOT/_local/bin/cutter" ] || [ -x "$ROOT/_local/usr/bin/cutter" ]; then + echo "Using existing local cutter at $ROOT/_local/usr/bin or $ROOT/_local/bin" + export PATH="$ROOT/_local/usr/bin:$ROOT/_local/bin:$PATH" + export PKG_CONFIG_PATH="$ROOT/_local/usr/lib/pkgconfig:$ROOT/_local/lib/pkgconfig:${PKG_CONFIG_PATH-}" + else + echo "cutter not found — attempting to build from submodule..." + git submodule update --init --recursive cutter || { + echo "cutter submodule not present; please add or install cutter." >&2 + exit 1 + } - cd "$ROOT/cutter" - if [ -f meson.build ] && command -v meson >/dev/null 2>&1; then - CBUILD=builddir - if [ ! -d "$CBUILD" ]; then - meson setup "$CBUILD" --prefix=/usr + cd "$ROOT/cutter" + if [ -f meson.build ] && command -v meson >/dev/null 2>&1; then + CBUILD=builddir + if [ ! -d "$CBUILD" ]; then + meson setup "$CBUILD" --prefix=/usr + else + meson setup --reconfigure "$CBUILD" --prefix=/usr + fi + ninja -C "$CBUILD" -j"$(nproc)" + DESTDIR="$ROOT/_local" ninja -C "$CBUILD" install + elif [ -f configure.ac ] || [ -f configure ]; then + autoreconf -fi + ./configure --prefix="$ROOT/_local" + make -j"$(nproc)" + make install else - meson setup --reconfigure "$CBUILD" --prefix=/usr + echo "Could not detect build system for cutter; install cutter manually." >&2 + exit 1 fi - ninja -C "$CBUILD" -j"$(nproc)" - DESTDIR="$ROOT/_local" ninja -C "$CBUILD" install - elif [ -f configure.ac ] || [ -f configure ]; then - autoreconf -fi - ./configure --prefix="$ROOT/_local" - make -j"$(nproc)" - make install - else - echo "Could not detect build system for cutter; install cutter manually." >&2 - exit 1 - fi - cd "$ROOT" - export PATH="$ROOT/_local/usr/bin:$ROOT/_local/bin:$PATH" - export PKG_CONFIG_PATH="$ROOT/_local/usr/lib/pkgconfig:$ROOT/_local/lib/pkgconfig:${PKG_CONFIG_PATH-}" + cd "$ROOT" + export PATH="$ROOT/_local/usr/bin:$ROOT/_local/bin:$PATH" + export PKG_CONFIG_PATH="$ROOT/_local/usr/lib/pkgconfig:$ROOT/_local/lib/pkgconfig:${PKG_CONFIG_PATH-}" + fi fi # Configure & build the project only when needed @@ -97,7 +102,12 @@ else export PKG_CONFIG_PATH="$V4L_DIR/lib/pkgconfig:${PKG_CONFIG_PATH-}" export CPPFLAGS="-I$V4L_DIR/include ${CPPFLAGS-}" export LDFLAGS="-L$V4L_DIR/lib ${LDFLAGS-}" - ./configure --enable-unit-tests --with-libv4l-dir="$V4L_DIR" + if [ "$BUILD_MODE" = "release" ]; then + echo "Configuring release build (unit tests disabled)" + ./configure --with-libv4l-dir="$V4L_DIR" + else + ./configure --enable-unit-tests --with-libv4l-dir="$V4L_DIR" + fi fi if make -q >/dev/null 2>&1; then @@ -106,11 +116,4 @@ else make -j"$(nproc)" fi -# If SKIP_CHECK is set to "1", skip running `make check` so CI can run -# the build and tests as separate named steps within the same job. -if [ "${SKIP_CHECK-}" = "1" ]; then - echo "SKIP_CHECK=1: skipping 'make check'" - exit 0 -fi - -make check +echo "Build finished (BUILD_MODE=$BUILD_MODE)" From 184cebefba9eb3c2548ce2cf83662f2cd60a11b5 Mon Sep 17 00:00:00 2001 From: Takuro Ashie Date: Wed, 17 Jun 2026 09:14:00 +0900 Subject: [PATCH 2/2] README.md: Update settings --- README.md | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 04c104a..d3a3b0f 100644 --- a/README.md +++ b/README.md @@ -25,20 +25,37 @@ $ ./configure Configuration ============= + The setting file location is `/etc/xdg/libv4l-gst.conf` ### Settings -**max-width**: The maximum width of the video that can be decoded through the plugin (default: 1920) -**max-height**: The maximum height of the video that can be decoded through the plugin (default: 1080) -**bufferpool-library**: Path to the library that provides buffer pools for input and output nodes -**min-buffers**: The minimum number of buffers for each of the above buffer pools - -It also supports format specific configuration section: - -* **pipeline**: The GStreamer pipeline to be used. Should include everything but the input and output nodes +* `[libv4l-gst]` (global section) + * **max-width** (default: `1920`) + * The maximum width of the video that can be decoded through the plugin + * **max-height** (default: `1080`) + * The maximum height of the video that can be decoded through the plugin + * **bufferpool-library** (default: `NULL`) + * Path to the library that provides buffer pools for input and output nodes + * **min-buffers** (default: `2`) + * The minimum number of buffers for each of the above buffer pools + * **preferred-format** (default: auto-detect or `NV12`) + * Preffered output mode by FourCC (e.g. `AR24`) + * **fixed-pipeline** (default: auto-detect) + * Use fixed pipeline instead of auto-detecting + * Specify in one of the following FourCCs listed as section names (e.g. `H264`) +* `[H264]` + * **pipeline** + * The GStreamer pipeline to be used + * `appsrc` and `appsink` are automatically inserted so you shouldn't include any other `src` or `sink` elements + * If `appsrc` and `appsink` are included manually with some attributes, most of them are honored + * You can use `tee` element here to split output for debugging. + If you use it, you can use any `sink` elements (e.g. `waylandsink`) but one of them should be `appsink`. +* `[H265]` + * Ditto ### Example + The following settings are for the Renesas Porter board, but they may be updated to use more generic settings.