Skip to content

meson: make zip container support optional - #299

Merged
igoropaniuk merged 1 commit into
linux-msm:masterfrom
igoropaniuk:feature/optional-zip-container
Aug 10, 2026
Merged

meson: make zip container support optional#299
igoropaniuk merged 1 commit into
linux-msm:masterfrom
igoropaniuk:feature/optional-zip-container

Conversation

@igoropaniuk

@igoropaniuk igoropaniuk commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

qdl unconditionally links against libzip, although zip archives are
just one of the supported input formats: both the flash-from-zip path
and the create-zip subcommand are conveniences on top of the plain
contents.xml / flashmap.json flows.

That unconditional dependency gets in the way of integrating qdl into
minimal embedded distributions. In Yocto, for example, libzip lives in
meta-openembedded rather than oe-core, so packaging qdl means pulling
in a whole extra layer for a feature many products never use.

Introduce a zip-container feature option and gate all libzip-backed
code on it:

  • move the libzip implementation out of file.c into file_zip.c, which
    is only compiled when the feature is enabled; file.c keeps the plain
    POSIX file handling and dispatches through small helpers that turn
    into inert stubs in file.h otherwise
  • provide no-zip fallbacks of qdl_zip_open/get/put where open reports
    "not a zip archive", so the contents.xml and flashmap.json flows
    work unchanged; these remain real symbols rather than inline stubs
    because the unit tests replace them with mock definitions
  • build zipper.c only with the feature and stub out zipper_write(),
    with create-zip and a failed flash of a zip archive reporting that
    this qdl was built without zip-container support

The feature defaults to enabled rather than auto, so a missing libzip
is a hard configure error instead of a silently skipped dependency:
distro builds cannot accidentally lose zip support, and producing a
leaner qdl requires an explicit -Dzip-container=disabled opt-out.

@konradybcio

Copy link
Copy Markdown
Member

Can we make this an explicit opt-out instead of relying on library autodetection? I fear this may be easily overlooked and lead to not-fully-featured builds landing in distros

@igoropaniuk

Copy link
Copy Markdown
Contributor Author

Can we make this an explicit opt-out instead of relying on library autodetection? I fear this may be easily overlooked and lead to not-fully-featured builds landing in distros

Makes sense, will fix, thanks!

igoropaniuk added a commit to igoropaniuk/meta-qcom that referenced this pull request Aug 2, 2026
Rename qdl_git.bb (PV=2.1+git, pre-meson SRCREV) to qdl_2.8.bb
pinned to tag v2.8, and refresh the recipe for current
upstream:

  * Inherit `meson pkgconfig` instead of `oe_runmake install`;
    upstream removed the Makefile between v2.1 and v2.8.
  * DEPENDS trimmed to `libusb1 libxml2`, both from oe-core.
  * Carry 0001-meson-make-zip-container-support-optional.patch
    to gate libzip on a new `-Dzip-container` feature and set
    `EXTRA_OEMESON = "-Dzip-container=disabled"` so no
    meta-openembedded layer is needed to package qdl.
    Upstream-Status: Submitted
    (linux-msm/qdl#299)

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
@igoropaniuk
igoropaniuk force-pushed the feature/optional-zip-container branch 2 times, most recently from 4beee92 to fbcbdc6 Compare August 2, 2026 10:09
@igoropaniuk
igoropaniuk marked this pull request as ready for review August 2, 2026 10:10
@igoropaniuk
igoropaniuk requested a review from a team as a code owner August 2, 2026 10:10
igoropaniuk added a commit to igoropaniuk/meta-qcom that referenced this pull request Aug 3, 2026
Rename qdl_git.bb (PV=2.1+git, pre-meson SRCREV) to qdl_2.8.bb
pinned to tag v2.8, and refresh the recipe for current
upstream:

  * Inherit `meson pkgconfig` instead of `oe_runmake install`;
    upstream removed the Makefile between v2.1 and v2.8.
  * DEPENDS trimmed to `libusb1 libxml2`, both from oe-core.
  * Carry 0001-meson-make-zip-container-support-optional.patch
    to gate libzip on a new `-Dzip-container` feature, exposed
    as a `zip` PACKAGECONFIG (off by default) so no
    meta-openembedded layer is needed to package qdl.
    Upstream-Status: Submitted
    (linux-msm/qdl#299)

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
igoropaniuk added a commit to igoropaniuk/meta-qcom that referenced this pull request Aug 4, 2026
Rename qdl_git.bb (PV=2.1+git, pre-meson SRCREV) to qdl_2.8.bb
pinned to tag v2.8, and refresh the recipe for current
upstream:

  * Inherit `meson pkgconfig` instead of `oe_runmake install`;
    upstream removed the Makefile between v2.1 and v2.8.
  * DEPENDS trimmed to `libusb1 libxml2`, both from oe-core.
  * Carry 0001-meson-make-zip-container-support-optional.patch
    to gate libzip on a new `-Dzip-container` feature, exposed
    as a `zip` PACKAGECONFIG (off by default) so no
    meta-openembedded layer is needed to package qdl.
    Upstream-Status: Submitted
    (linux-msm/qdl#299)

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
@igoropaniuk
igoropaniuk force-pushed the feature/optional-zip-container branch from fbcbdc6 to 55b975d Compare August 10, 2026 11:37
Comment thread src/meson.build
qdl unconditionally links against libzip, although zip archives are
just one of the supported input formats: both the flash-from-zip path
and the create-zip subcommand are conveniences on top of the plain
contents.xml / flashmap.json flows.

That unconditional dependency gets in the way of integrating qdl into
minimal embedded distributions. In Yocto, for example, libzip lives in
meta-openembedded rather than oe-core, so packaging qdl means pulling
in a whole extra layer for a feature many products never use.

Introduce a zip-container feature option. Rather than switching code
paths with preprocessor conditionals, select whole files in the build
system: the libzip implementation moves out of file.c into file_zip.c,
which is compiled together with zipper.c (the create-zip backend) only
when the feature is enabled. Builds without it compile file_nozip.c
instead, which provides the same entry points as inert stubs, so the
headers declare a single unconditional interface and file.c keeps just
the plain POSIX file handling.

The stubbed qdl_zip_open() reports "not a zip archive" for every
input, which keeps the contents.xml and flashmap.json flows working
unchanged, while create-zip and a failed flash of a zip archive report
that this qdl was built without zip-container support. As real symbols
in a single compilation unit, the stubs also remain replaceable by the
mock definitions the unit tests link in.

The feature defaults to enabled rather than auto, so a missing libzip
is a hard configure error instead of a silently skipped dependency:
distro builds cannot accidentally lose zip support, and producing a
leaner qdl requires an explicit -Dzip-container=disabled opt-out.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
@igoropaniuk
igoropaniuk force-pushed the feature/optional-zip-container branch from 55b975d to 9b7d0e3 Compare August 10, 2026 15:46

@andersson andersson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@igoropaniuk
igoropaniuk merged commit a4d022c into linux-msm:master Aug 10, 2026
14 checks passed
@igoropaniuk
igoropaniuk deleted the feature/optional-zip-container branch August 10, 2026 16:19
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.

3 participants