Skip to content

piolib: Installation improvements - #237

Merged
pelwell merged 4 commits into
raspberrypi:masterfrom
pelwell:piolib-pkgconfig
Nov 26, 2026
Merged

pelwell merged 4 commits into
raspberrypi:masterfrom
pelwell:piolib-pkgconfig

Conversation

@pelwell

@pelwell pelwell commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Four patches to improve packaging and installation:
piolib: Install a pkg-config file
piolib: Include GNUInstallDirs after project()
piolib: Put the shared library in the piolib install component
piolib: Only install the examples on request

pelwell and others added 4 commits November 26, 2026 13:02
Generate and install libpio.pc, so that users of the library can find
it with pkg-config (PKG_CHECK_MODULES in autotools, pkg_check_modules
in CMake) rather than hard-coding the piolib include directory. The
headers are installed in <includedir>/piolib and include each other by
relative name, so Cflags adds that directory to the search path.

The version defaults to 0; packagers can set PIOLIB_VERSION.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GNUInstallDirs needs to know the target architecture to choose the
library directory, which it only does once project() has enabled the
languages. Included before project(), as it was in both piolib and its
examples, a standalone build warned "Unable to determine default
CMAKE_INSTALL_LIBDIR directory because no target architecture is
known" and installed the library in <prefix>/lib even for a prefix of
/usr, rather than in the Debian multiarch directory
(lib/aarch64-linux-gnu) where the packaged libpio lives.

Builds from the top-level utils directory were unaffected, as
project(utils) comes first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The install rule for the pio target only had an ARCHIVE clause, so
only the static library was assigned to the "piolib" component; a
shared libpio.so fell into the default component, and was missed by
"cmake --install <build> --component piolib". Give the LIBRARY
artefacts the same destination and component.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Installing piolib also installed all of its example programs (apitest,
blink, mirror, piotest, ...) into <prefix>/bin, which for the default
/usr/local prefix puts them on everyone's PATH, where they linger after
reverting to the packaged libpio. None of them is shipped in a package.

Keep building the examples, but only install them if the new option
PIOLIB_INSTALL_EXAMPLES is ON (default OFF), in an "examples" install
component. The README describes the option, and how to try a build
without displacing the packaged library.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pelwell
pelwell merged commit cf42db1 into raspberrypi:master Nov 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant