Repository navigation
[build-system] make libuca builds portable and reproducible - #109
NikolayZagainov wants to merge 9 commits into
Conversation
|
Don't review yet, testing something |
Define C11 consistently in CMake and Meson, enable compiler warnings, and raise the declared GLib baseline from 2.38 to 2.56. Require libtiff 4.3 when TIFF support is selected and initialize CTest from the top-level build.\n\nThis removes differences between the two supported build systems and makes unsupported dependency combinations fail during configuration instead of later during compilation. The explicit language standard also prevents compiler-default changes from silently altering how libuca is built.
Disable the old GTK 2 camera-control GUI by default in both CMake and Meson while preserving an explicit opt-in build path. Raise its GTK requirement to 2.24 and emit a deprecation notice whenever it is selected.\n\nHeadless camera servers and packaging jobs no longer acquire an obsolete desktop dependency accidentally. Existing users can still build the tool deliberately with WITH_GUI=ON in CMake or -Dgui=enabled in Meson.
Link the command-line tools to libtiff only when TIFF support is enabled and apply the same minimum libtiff version to CMake and Meson builds.\n\nThis makes WITH_TIFF=OFF a real supported configuration instead of allowing configuration to succeed and then failing at link time. It also keeps the file plugin and command-line tools aligned on their dependency contract.
Set image geometry before asking libtiff to choose a strip size, restore all directory fields for every page, and declare grayscale data as PHOTOMETRIC_MINISBLACK.\n\nTIFFWriteDirectory clears per-page state, so the previous implementation could produce malformed or ambiguously interpreted multi-frame files. This commit makes every captured frame a complete, standards-compliant TIFF directory.
Match complete plugin basenames instead of arbitrary path substrings, accept camera names containing underscores or hyphens, and recognize versioned Unix shared libraries. Ignore non-matching files and release the temporary camera-name list after network-camera counting.\n\nThis prevents false plugin names, supports normal packaged library filenames such as libucacamera.so.2, and removes a repeated discovery-time memory leak.
Replace the hard-coded RPM-only generator with a cache-selectable CPack generator that defaults to a portable TGZ archive, and enable automatic shared-library dependency calculation for Debian packages.\n\nDownstream builders can now request TGZ, DEB, or RPM output without editing libuca sources. Debian packages also declare the runtime libraries discovered from their binaries instead of relying on manual dependency lists.
Modernize the recipe and workflow for Conan 2, pin a tested dependency graph with a lock file, export every source required by CMake, and expose TIFF as a package option. Use current maintained GitHub Actions and install a bounded Conan release explicitly.\n\nThe previous job depended on an unpinned third-party action and the recipe omitted source directories needed by packaged builds. The new path can reproduce the same GLib and libtiff inputs locally and in CI, rejects unsupported static GLib configurations, and supports packages built without TIFF.
cfc232b to
f682097
Compare
There was a problem hiding this comment.
This allows building libuca and its command-line tools without TIFF support—for example, for acquisition where images are transferred or processed directly instead of saved as TIFF. This is a general build fix discovered during the work, not a PCO requirement. It can be reviewed and merged separately—or left out of the initial PCO contribution.
There was a problem hiding this comment.
The rational behind these changes:
If we left the code unchanged, the camera could acquire correct images, but uca-grab could save them in a TIFF file that some programs read incorrectly or reject.
- Calculating strip size before setting image dimensions.
TIFF stores an image in blocks called strips. Choosing their size requires knowing how many bytes one image row occupies. At that point, the old code hadn’t supplied the width or pixel format. Depending on libtiff’s behavior, this could produce warnings or an unsuitable strip size. It does not necessarily corrupt pixels, but relies on fallback behavior. - Setting the page-type tag only for the first image.
Finishing a TIFF page clears its settings. Consequently, subsequent images weren’t explicitly marked as pages of a multi-page document. Many readers still find them through TIFF’s directory chain, so this does not mean later frames disappear. However, the file is inconsistently described, and software relying on that tag may handle later pages differently. - Not declaring how grayscale values should be displayed.
The missing tag tells the reader that zero means black and larger values mean brighter pixels. Without it, readers may assume a default, display the image incorrectly, warn about the missing information, or reject it. Adding PHOTOMETRIC_MINISBLACK makes the interpretation explicit.
I asked to find failure scenarious:
So it seems the firs one is serious. And the 2 and 3rd issues which may arise in other programs or apps during reading.
|
My two cents: is it even worth keeping the GUI? I know most distros keep GTK 2 around forever but … I don't know if anyone other than me back then used it after integration with Concert became a thing. |
I have never saw anyone used it, so I also don't know why it is needed. But now it would be optional, so it does not matter much. |
The Windows CI job failed before compilation because the committed lockfile omitted platform-specific dependencies. Extend it using the existing Windows host and build profiles, preserving all previous version and recipe pins. Pin msys2 as a build requirement and libiconv and libgettext as host requirements. Keep strict lockfile enforcement in CI; partial resolution is used only when generating the expanded lockfile. Validation: Conan graph info succeeds with conan/windows_release for both --build=missing and forced source builds, without --lockfile-partial. Actual Windows compilation must be confirmed by CI.
|
@codex review |
Windows CI resolves all dependencies but CMake cannot find glib-mkenums on the build PATH. The GLib host library requirement does not ensure that its bin directory is available as a build-tool search path. Set GLIB2_MKENUMS in the generated CMake toolchain to the script in the resolved GLib package. Existing CMake commands execute it with the build Python interpreter. This avoids depending on global GLib tools or adding another GLib build dependency. Validated recipe path generation for Windows and Linux package paths and Linux CMake configuration/build with an explicit script path. Windows compilation still requires a CI rerun.
Summary
This pull request modernizes libuca’s build and packaging infrastructure and
aligns its CMake, Meson and Conan configurations.
The previous build definitions had diverged over time. Some dependencies and
optional components were handled differently depending on the selected build
system, packaging relied on developer-machine assumptions, and clean builds on
new Linux or Windows environments were unnecessarily difficult.
This change establishes a common, reproducible build foundation for existing
libuca functionality and future binary camera plugins. It does not add a new
camera driver or change the public camera API.
Problems addressed
Before this change:
optional-component behavior.
dependency to otherwise headless installations.
disabled.
versions.
version.
appropriate package format.
handle plugin names containing
_or-, or versioned shared-libraryfilenames.
cameras.
did not restore per-page fields after
TIFFWriteDirectory().These issues made local builds, CI builds, binary packaging and installation on
clean machines behave differently.
Changes
Common build requirements
Meson.
Optional components
normal or CI builds.
The Ximea camera implementation itself is not included in this pull request.
Only the optional build configuration needed to keep proprietary SDKs out of
ordinary builds is introduced here.
CMake packaging
include(CTest)mechanism.selected.
This allows downstream projects to choose TGZ, DEB or RPM without modifying
libuca’s source tree.
Conan packaging and CI
LGPL-2.1-or-laterlicense identifier.Plugin discovery
Plugin discovery now:
Matches only the filename rather than applying the expression to the complete
path.
Accepts plugin names containing letters, numbers, underscores and hyphens.
Recognizes Linux shared libraries such as:
Recognizes the corresponding Windows DLL names.
Ignores files that do not match the complete plugin naming convention.
Releases the temporary camera-name list after counting network cameras.
This prevents accidental matches and supports packaged/versioned shared
libraries more reliably.
TIFF output
The uca-grab multi-page TIFF writer now:
Sets image geometry before calculating the default strip size.
Sets the photometric interpretation explicitly.
Restores per-directory fields for every page because
TIFFWriteDirectory() resets them.
Calculates a valid strip size independently for each image directory.
Compatibility notes
The minimum CMake version is now 3.16.
The minimum GLib version is now 2.56.
The minimum libtiff version, when enabled, is now 4.3.
The deprecated GTK 2 GUI is disabled by default and must be requested
explicitly.
The core libuca camera API and ABI are not intentionally changed by this pull
request.
Dependencies
This is the first branch in the proposed feature series and has no dependency
on the trigger, metadata, PCO.edge, uca-net or Concert changes.
It is intended to serve as the build foundation for later, independent pull
requests:
Generic trigger and frame-metadata API
PCO.edge CLHS camera plugin
Ximea camera plugin
Testing
The resulting build configuration has been used successfully as the foundation
for the PCO.edge plugin build.
The following configurations should be covered by CI or reviewer testing:
CMake core build without GUI
CMake build with TIFF enabled
CMake build with TIFF disabled
Meson core build without GUI
Meson build with TIFF enabled and disabled
Conan 2 package creation without proprietary SDKs
Existing libuca mock and ring-buffer tests
Multi-page TIFF creation with uca-grab
No camera hardware is required to review or test this pull request.