Skip to content

feat(libyaml): add LLAR formula - #169

Open
MeteorsLiu wants to merge 2 commits into
xgo-dev:mainfrom
MeteorsLiu:issue/29-libyaml
Open

feat(libyaml): add LLAR formula#169
MeteorsLiu wants to merge 2 commits into
xgo-dev:mainfrom
MeteorsLiu:issue/29-libyaml

Conversation

@MeteorsLiu

Copy link
Copy Markdown
Collaborator

Closes #29

  • Add yaml/libyaml Formula for upstream tag 0.2.5 from the Conan Center snapshot.
  • Preserve Conan shared/fPIC defaults, CMake install layout, and the License file.
  • Publish a relocatable yaml.pc and compile the Conan yaml_emitter consumer with pkg-config flags.

Validation: git diff --check passed. Per task instruction, local llar test was not blocked on.

@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: libyaml 0.2.5 recipe

This recipe is well-constructed and closely follows the established repo conventions (streamvbyte, libde265, semver.c). The pkg-config .pc generation, license copy, and the CMake variables (YAML_STATIC_LIB_NAME, INSTALL_LIB_DIR, INSTALL_CMAKE_DIR) are the correct upstream libyaml settings, and the filter is if anything stricter/safer than the reference recipes. The -lyaml in the generated .pc is correct for both static and shared builds. No blocking issues.

A few low-severity / nit-level items are noted inline. The sprintf in the embedded C test is not a real bug — values come only from the hardcoded data[] table and a 32-bit int fits easily in the 64-byte buffer — so it's flagged only as optional hardening.

@@ -0,0 +1,4 @@
{
"path": "yaml/libyaml",
"deps": {}

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.

Nit — indentation. Other versions.json files in the repo (fast-pack/streamvbyte, madler/zlib, json-c/json-c) use tab indentation; this file uses two spaces. Worth normalizing to tabs for consistency.

cc! consumer, "@${flagsFile}", "-o", binary

if slices.contains(target.options["shared"], "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.

Low — loader path is overwritten, not prepended. os.setenv("LD_LIBRARY_PATH", ...) (and DYLD_LIBRARY_PATH on the next line) replace any inherited value rather than prepending the install lib dir. If the test env relies on an inherited loader path, the shared-build consumer could fail to resolve unrelated libraries. Consider prepending the existing value, e.g. filepath.join(installDir, "lib") + ":" + os.getenv("LD_LIBRARY_PATH"). Test-reliability only, not a security issue.

libdir=$${prefix}/lib
includedir=$${prefix}/include

Name: yaml

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.

Low — .pc Name/Description diverge from upstream. Upstream's own template (yaml-0.1.pc.in) uses Name: LibYAML and Description: Library to parse and emit YAML. Functionally harmless — pkgconfig.lookup("yaml") resolves by filename, not the Name field — but consumers inspecting pkg-config --description yaml will see different text. Consider aligning with upstream for accuracy. (Version: 0.2.5 is correct.)

(yaml_char_t *)"count", strlen("count"), 1, 0, YAML_PLAIN_SCALAR_STYLE);
if (!yaml_emitter_emit(&emitter, &event)) goto error;

sprintf(buffer, "%d", f->count);

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.

Info — optional hardening. sprintf(buffer, "%d", f->count) into the fixed 64-byte buffer is safe as written (values come only from the hardcoded data[]; a 32-bit int is ≤11 chars). No bug. If you want to future-proof against copy-paste reuse, snprintf(buffer, sizeof(buffer), "%d", f->count) is the trivial change.

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 libyaml recipe to LLAR

1 participant