Skip to content

Add ebiggers/libdeflate Formula (v1.22, v1.25) - #114

Open
fennoai[bot] wants to merge 1 commit into
mainfrom
fennoai/issue-13-1785407322
Open

Add ebiggers/libdeflate Formula (v1.22, v1.25)#114
fennoai[bot] wants to merge 1 commit into
mainfrom
fennoai/issue-13-1785407322

Conversation

@fennoai

@fennoai fennoai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Closes #13.

Translates the Conan Center libdeflate recipe into an idiomatic LLAR Formula for ebiggers/libdeflate, covering source tags v1.22 and v1.25.

Files

  • ebiggers/libdeflate/versions.json — module path, no dependencies (upstream libdeflate has none).
  • ebiggers/libdeflate/v1.22/Libdeflate_llar.gox — the Formula (fromVer "v1.22").
  • ebiggers/libdeflate/v1.22/consumer.c — the onTest consumer.

Design

  • One Formula for both tags. v1.22 and v1.25 share the same CMake build, options, install layout, and public interface (verified against upstream at both tags), so a single fromVer "v1.22" Formula serves both.
  • Build (onBuild). Uses the CMake helper to build exactly one linkage selected by the shared option, with LIBDEFLATE_BUILD_GZIP=OFF and LIBDEFLATE_BUILD_TESTS=OFF — preserving the Conan package intent (library only, no gzip program, no test suite). The install layout is pinned to lib/ (CMAKE_INSTALL_LIBDIR=lib, honored by upstream via GNUInstallDirs) so headers, the library, and the pkg-config file land where consumers and LLAR's use helper expect them.
  • Options. Only shared (default OFF → static) is retained; it is the sole Conan option that changes the installed library. The Conan fPIC option is intentionally dropped — libdeflate has no PIC build switch, always builds its shared library position-independent, and the static-library PIC choice changes neither the installed interface, the metadata, nor dependency resolution.
  • Metadata. -I<prefix>/include -L<prefix>/lib -ldeflate, mirroring the installed libdeflate.pc (Cflags: -I${includedir}, Libs: -L${libdir} -ldeflate).
  • Test (onTest). Compiles and runs a small C consumer that allocates and frees a compressor (matching the Conan test_package.c) against the installed output, in a build tree independent of the onBuild scratch tree so it also passes on a cache hit.

Validation

Built llar from goplus/llar@main and ran, on linux/amd64:

  • llar test -v ./ebiggers/libdeflate@v1.22 — fresh build + test: pass; cache-hit test: pass.
  • llar test -v ./ebiggers/libdeflate@v1.25 — fresh build + test: pass; cache-hit test: pass.
  • Verified cache-hit onTest genuinely compiles/links/runs the consumer (a deliberately broken consumer produced onTest failed ... exit status 1, then reverted).
  • Independently verified the shared mapping by building libdeflate shared from source and running the same consumer against it.

Note: the current llar test CLI only injects default options into onBuild (its own CI workflow notes it "tests defaults only"), so the shared=ON linkage cannot yet be exercised end-to-end through the tool; the option logic itself is source-backed and was verified with a manual shared build.

Only the module files for ebiggers/libdeflate are added — no generic Conan importer and no changes to the Formula skill.

Translate the Conan Center libdeflate recipe into an idiomatic LLAR
Formula. One Formula (fromVer "v1.22") serves both v1.22 and v1.25, whose
upstream CMake build, options, and installed interface are identical.

- onBuild uses the CMake helper to build a single linkage selected by the
  `shared` option (default OFF -> static), with LIBDEFLATE_BUILD_GZIP and
  LIBDEFLATE_BUILD_TESTS off, matching the Conan package intent. Install
  layout is pinned to lib/ so the library, headers, and pkg-config file land
  where consumers expect them.
- Consumer metadata (-I.../include -L.../lib -ldeflate) mirrors the installed
  libdeflate.pc.
- onTest compiles and runs a small C consumer (allocate/free a compressor,
  as in the Conan test_package) against the installed output, in a build
  tree independent of onBuild so it also passes on a cache hit.
- versions.json declares no dependencies; upstream libdeflate has none.

The Conan `fPIC` option is dropped: libdeflate has no PIC build switch and
the choice does not change the installed interface, metadata, or
dependencies.

Co-authored-by: fennoai[bot] <231223108+fennoai[bot]@users.noreply.github.com>
Co-authored-by: MeteorsLiu <17515813+MeteorsLiu@users.noreply.github.com>

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Review: ebiggers/libdeflate Formula (v1.22, v1.25)

No blocking issues found. The Formula follows the LLAR reference conventions and the existing madler/zlib example, and the upstream facts it relies on were verified against ebiggers/libdeflate v1.22:

  • CMake option names (LIBDEFLATE_BUILD_STATIC_LIB, LIBDEFLATE_BUILD_SHARED_LIB, LIBDEFLATE_BUILD_GZIP, LIBDEFLATE_BUILD_TESTS) exist and are used correctly; upstream uses GNUInstallDirs/CMAKE_INSTALL_LIBDIR.
  • The installed libdeflate.pc generates Cflags: -I${includedir} and Libs: -L${libdir} -ldeflate, matching the manually-emitted metadata (-I.../include -L.../lib -ldeflate).
  • consumer.c uses the correct signatures — libdeflate_alloc_compressor(int) / libdeflate_free_compressor(ptr) with <libdeflate.h>; level 12 is the valid maximum.
  • Layout/naming rules hold: class stem Libdeflate, versions.json.path == id == directory, fromVer "v1.22" literal, empty deps {} is correct (libdeflate has no library dependencies).
  • Error handling, filter, defaults, and the cache-safe onTest (separate build tree, shipped consumer.c, no metadata mutation) all match the reference.

Security and performance passes returned no findings — exec uses the explicit-argument form (no shell), and exactly one linkage is built per shared selection.

Minor (optional, non-blocking)

  • ebiggers/libdeflate/v1.22/Libdeflate_llar.gox — the emitted metadata's correctness silently depends on the CMAKE_INSTALL_LIBDIR "lib" pin (c.define "CMAKE_INSTALL_LIBDIR", "lib") and on includedir=include. The setMetadata string hardcodes .../lib and .../include. This is adequately documented by the surrounding comments; a future edit that changes the libdir pin without updating the metadata line would silently break consumers. Consider a one-line cross-reference between the two lines to guard against that. (The comment's claim that LLAR's artifact encoder rewrites the absolute prefix into a portable form is consistent with the LLAR reference, so the absolute path in metadata is expected, not a defect.)

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.

Translate the Conan Center libdeflate recipe to LLAR

0 participants