Skip to content

feat(ctrl-c): add LLAR formula - #142

Open
MeteorsLiu wants to merge 1 commit into
xgo-dev:mainfrom
MeteorsLiu:issue/96-ctrl-c
Open

feat(ctrl-c): add LLAR formula#142
MeteorsLiu wants to merge 1 commit into
xgo-dev:mainfrom
MeteorsLiu:issue/96-ctrl-c

Conversation

@MeteorsLiu

Copy link
Copy Markdown
Collaborator

Closes #96.

Adds the evgenykislov/ctrl-c LLAR Formula for upstream v1.0.0 from the Conan Center snapshot ffe30df101afd4dc95aac2f14b25bf345e64d7be.

  • Carries the CCI-exported CMake entrypoint and maps the verified shared/fPIC options.
  • Installs the public header, libctrl-c, and MIT license with direct consumer metadata.
  • Adds an independent C++11 consumer check based on the CCI test package.
  • Upstream exposes only one version tag (v1.0.0), so no comparator is needed.

Validation: git diff --cached --check (clean). Local LLAR/CI tests were intentionally not awaited per request.

@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.

FennoAI Review — evgenykislov/ctrl-c v1.0.0

Clean, well-structured recipe that follows the repo's core conventions: forced lib/ layout, cache-hit-safe onTest deriving flags from the install dir, and consistent -I/-L/-lctrl-c flags between build metadata and the test. No security concerns. A few findings below.

Documentation gap (repo convention): Sibling recipes (recp/cglm, json-c/json-c) consistently comment their non-obvious choices — why CMAKE_INSTALL_LIBDIR is forced to lib, the shared/fPIC defaults' mapping to the Conan recipe, the filter intent, and the cache-hit rationale for deriving test flags from the install dir. This recipe has essentially no comments. Adding short rationale comments (especially on the lib override and the LICENSE copy, which is novel vs. siblings) would match the established convention and protect future editors.

c.define "CTRL_C_SRC_DIR", ctx.SourceDir
c.define "CMAKE_INSTALL_LIBDIR", "lib"
c.defineBool "BUILD_SHARED_LIBS", shared
c.defineBool "CMAKE_POSITION_INDEPENDENT_CODE", fPIC

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.

[P1] shared=ON with fPIC=OFF is allowed but produces an invalid build

A consumer can request shared=ON, fPIC=OFF. A shared library requires position-independent code, but this passes CMAKE_POSITION_INDEPENDENT_CODE=OFF while BUILD_SHARED_LIBS=ON, which will typically fail to link on most toolchains.

Suggest either forcing PIC on for the shared case, e.g. fPIC := shared || slices.contains(target.options["fPIC"], "ON"), or rejecting the invalid combination in filter.

Comment on lines +91 to +92
os.setenv("LD_LIBRARY_PATH", filepath.join(installDir, "lib"))!
os.setenv("DYLD_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.

[P3] LD_LIBRARY_PATH/DYLD_LIBRARY_PATH overwrite instead of prepend

For the shared build the test sets LD_LIBRARY_PATH/DYLD_LIBRARY_PATH to the install lib dir, discarding any existing value. Prepending (installDir/lib + ":" + os.getenv(...)) is safer if toolchain/runtime libs live elsewhere. Low priority — usually harmless in a sandboxed runner.

@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.

FennoAI Review (cont.)

One additional finding (see inline).

fPIC := slices.contains(target.options["fPIC"], "ON")
c := cmake.new(ctx.SourceDir, filepath.join(ctx.SourceDir, "_build"), installDir)
c.define "CTRL_C_SRC_DIR", ctx.SourceDir
c.define "CMAKE_INSTALL_LIBDIR", "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.

[P2] Undocumented CMAKE_INSTALL_LIBDIR override

CMAKE_INSTALL_LIBDIR is forced to lib, and the hardcoded -L.../lib flags at lines 64 and 83 depend on this. Since CMakeLists.txt includes GNUInstallDirs (which selects lib64 on some distros), a future edit removing this override would silently break the metadata and test flags on lib64 systems. json-c documents exactly this choice; a one-line comment here would prevent that regression.

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 ctrl-c recipe to LLAR

1 participant