Skip to content

meson: make zip container support optional - #299

Open
igoropaniuk wants to merge 1 commit into
linux-msm:masterfrom
igoropaniuk:feature/optional-zip-container
Open

meson: make zip container support optional#299
igoropaniuk wants to merge 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 from 5658fdc to 4beee92 Compare August 2, 2026 10:06
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.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
@igoropaniuk
igoropaniuk force-pushed the feature/optional-zip-container branch 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>
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.

2 participants