Skip to content

feat(libde265): add LLAR formula - #135

Open
MeteorsLiu wants to merge 1 commit into
xgo-dev:mainfrom
MeteorsLiu:issue/103-libde265
Open

feat(libde265): add LLAR formula#135
MeteorsLiu wants to merge 1 commit into
xgo-dev:mainfrom
MeteorsLiu:issue/103-libde265

Conversation

@MeteorsLiu

@MeteorsLiu MeteorsLiu commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add strukturag/libde265 Formula metadata and version thresholds for v1.0.12 and v1.0.17
  • preserve the Conan option surface for shared, fPIC, and SSE builds
  • install license metadata and validate the installed pkg-config interface with a C consumer

Verification

  • v1.0.12 fresh build and C consumer
  • v1.0.15 fresh build and cache-hit consumer
  • v1.0.17 fresh build and C consumer
  • default v1.1.1 fresh build and cache-hit consumer
  • v1.0.11 rejected because no Formula applies

Closes #103

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review: feat(libde265): add LLAR formula

Nice, well-structured addition. The formulas follow the repo's per-version model, capture the license into licenses/COPYING, use a real compile-and-run consumer test that works on cache hits, and handle LD_LIBRARY_PATH/DYLD_LIBRARY_PATH cross-platform for shared tests. The upstream option mappings (shared/fPIC/sse/ENABLE_SDL) were verified accurate against both tags' CMakeLists.txt, and the $${pcfiledir} doubled-$ is the correct Go+ escape for emitting a literal ${pcfiledir}.

Findings below are non-blocking. The two version files share most logic, so any fix to the pkg-config or filter blocks should be applied to both v1.0.12 and v1.0.17.

No performance or security concerns of note.

@@ -0,0 +1,4 @@
{
"path": "strukturag/libde265",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Indentation inconsistent with repo convention. All existing versions.json files (madler/zlib, recp/cglm, json-c/json-c) use tab indentation; this file uses 2 spaces. Reformat with tabs to match.

// for the static C consumer used by this Formula.
pcPath := filepath.join(installDir, "lib", "pkgconfig", "libde265.pc")
pc := string(os.readFile(pcPath)!)
pc = strings.replace(pc, "prefix="+installDir, "prefix=$${pcfiledir}/../..", 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fragile prefix rewrite may silently leave the absolute build path embedded. strings.replace(pc, "prefix="+installDir, ...) requires the generated prefix= line to be a byte-for-byte match. If CMake normalizes the path (trailing slash, symlink/case resolution) or emits a ${prefix}-style line, the replace is a no-op and the published .pc keeps the absolute install path — defeating the stated relocatability and leaking the build-host path. Consider anchoring on the line starting with prefix= and rewriting the whole line, then asserting the replacement actually occurred. Same on v1.0.17 line 53.

}
if !shared {
for i, line in lines {
if privateLibs != "" && line.hasPrefix("Libs:") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Folding Libs.private/Cflags.private into the public Libs:/Cflags: makes the published .pc non-standard. Private deps should stay private; this permanently mutates the installed metadata for all consumers. The json-c formula solves the same static-linking need cleanly by letting pkg-config do it (pkg-config --static). If pkgconfig.lookup supports a static query, prefer that and leave the .pc unmodified. Note also that upstream libde265.pc.in has no Cflags.private field, so the Cflags.private branch is effectively dead code here. Same on v1.0.17 line 67.

shared := target.options["shared"][0] == "ON"
fPIC := target.options["fPIC"][0] == "ON"

cmakeLists := filepath.join(ctx.SourceDir, "CMakeLists.txt")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing rationale comments that v1.0.12 carries for identical logic. v1.0.12 documents why the CMAKE_POSITION_INDEPENDENT_CODE line is stripped from the upstream CMakeLists.txt and why the pkg-config file is rewritten; v1.0.17 performs the same non-obvious mutations with no comments. Since both tags' CMakeLists.txt contain that set(...) line (verified) and the strings.replace(..., 1) silently no-ops if it ever disappears, the rationale is equally load-bearing here. Replicate the comments to match v1.0.12 and the repo's documentation standard (see cglm/json-c).

exec "cc", "-std=c11", "@"+flagsFile, consumer, "-o", binary
lastErr!
if target.options["shared"][0] == "ON" {
os.setenv("LD_LIBRARY_PATH", filepath.join(installDir, "lib"))!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

os.setenv overwrites LD_LIBRARY_PATH/DYLD_LIBRARY_PATH instead of prepending. This discards any existing loader search paths the test environment relied on. Prefer prepending installDir/lib and preserving the prior value. Same on v1.0.17 lines 107-108.

"sse": "ON",
}

filter => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

filter accepts any option key, not just the known set. Unlike cglm (which validates the specific shared key), this loops over all of target.options and only checks values are ON/OFF. A typo like shred/Sse would pass the filter, then target.options["shared"][0] etc. proceed with defaults while the intended option is silently ignored. Consider validating against the known keys (shared, fPIC, sse). Same on v1.0.17 line 16.

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 Conan Center libde265 recipe to LLAR

1 participant