feat(dragonbox): add LLAR formula - #126
Conversation
There was a problem hiding this comment.
Review: jk-jeon/dragonbox 1.1.3 formula
Solid, well-scoped formula that closely follows the sibling patterns (recp/cglm, json-c/json-c). Verified as correct:
- The include-directory patch is right: upstream 1.1.3 installs headers under
include/dragonbox-1.1.3/...; the patch flattens that toinclude/dragonbox/..., matching the consumer's#include "dragonbox/dragonbox_to_chars.h"and the-Iincludeflag. Thea/ab/bprefixes strip correctly undergit apply -p2, and--unidiff-zeromatches the zero-context hunk. dragonbox_to_charsis genuinely a static library, sofPIClegitimately changes installed object code — the option dimension and thedefaults/filterpattern (mirroring cglm) are justified.- The consumer test builds in
_llar_consumer, separate from the_buildscratch tree, and derives flags frominstallDirrather than build metadata — correct cache-hit-safe pattern. - Error propagation uses idiomatic
!/lastErr!, andversions.jsoncorrectly declares no deps. - Security review found nothing: permissions, path construction (all from trusted
ctx.*+ literals), and license handling are all sound.
The inline notes below are minor/consistency items. A couple (the patch idempotency and the misleading comment) are worth addressing before merge.
Minor, not inlined:
DRAGONBOX_ENABLE_SUBPROJECT=false(line 55) already matches the upstream default (OFF); it's harmless as documented intent but is a non-source-required flag per the formula-semantics guidance.- The metadata flags (lines 67–72) and the test flags (lines 84–91) are hand-maintained duplicates and must be kept in sync manually. Acceptable since upstream ships only
dragonboxConfig.cmake(no.pc), matching the cglm fallback pattern.
| // The Conan recipe's fPIC=True default changes the static archive, so expose | ||
| // that package-owned choice while keeping the source's subproject disabled. |
There was a problem hiding this comment.
[P3] Comment conflates two unrelated build choices (fPIC vs subproject)
This comment sits on the defaults block (which only defines fPIC) but ties the fPIC choice to DRAGONBOX_ENABLE_SUBPROJECT via "so expose ... while keeping the source's subproject disabled." They're independent: fPIC -> CMAKE_POSITION_INDEPENDENT_CODE (line 53), whereas DRAGONBOX_ENABLE_SUBPROJECT (line 55) only controls building the upstream subproject/benchmark/test and is never set by the Conan recipe. Suggest stopping the comment at the fPIC rationale and moving any subproject note next to line 55.
| @@ -0,0 +1,4 @@ | |||
| { | |||
| "path": "jk-jeon/dragonbox", | |||
There was a problem hiding this comment.
[P3] versions.json uses 2-space indent; all siblings use tabs
jk-jeon/dragonbox/versions.json is 2-space indented, whereas json-c/json-c/versions.json, recp/cglm/versions.json, and madler/zlib/versions.json all use tabs. Match the sibling convention (tabs) for consistency and to avoid noise in any format check.
| patch := ctx.Proj.readFile("1.1.3/dragonbox_include_directory.patch")! | ||
| patchPath := filepath.join(ctx.SourceDir, "_llar_dragonbox.patch") | ||
| os.writeFile(patchPath, patch, 0o644)! | ||
| git "-C", ctx.SourceDir, "apply", "--unidiff-zero", "-p2", patchPath | ||
| lastErr! |
There was a problem hiding this comment.
[P2] Patch is non-idempotent; scratch file dropped into CMake source root
onBuild writes _llar_dragonbox.patch into ctx.SourceDir (the CMake source dir passed to cmake.new on line 52) and runs git apply --unidiff-zero -p2 on every build. Two concerns:
- Not idempotent:
git applyhas no--forward/reverse guard here, so if the source tree is ever reused without a clean re-extraction (e.g. an interrupted prior build that already applied the patch), the second apply fails on the already-patched tree. Considergit apply --reverse --check(skip if already applied) orgit apply --checkfirst. - Scratch file at source root: writing the patch into
ctx.SourceDircan perturb CMake configure on generators thatfile(GLOB ... CONFIGURE_DEPENDS). Siblings keep scratch under subdirectories and don't drop loose files at the source root — writing the patch into_build(or a temp path) avoids this.
|
|
||
| onBuild ctx => { | ||
| installDir := ctx.outputDir | ||
| patch := ctx.Proj.readFile("1.1.3/dragonbox_include_directory.patch")! |
There was a problem hiding this comment.
[P3] Header-flatten patch is a non-obvious deviation with no comment
The patch flattens upstream's versioned header install path (include/dragonbox-1.1.3/...) to include/dragonbox/... so the plain -Iinclude flag and the consumer's #include "dragonbox/dragonbox_to_chars.h" resolve. This is deliberate but unexplained at the application site. Sibling formulas document their install-layout assumptions inline (e.g. Cglm_llar.gox, Jsonc_llar.gox); a one-line comment here would keep a future maintainer from mistaking the patch for cruft.
| licenseDir := filepath.join(installDir, "licenses") | ||
| os.mkdirAll(licenseDir, 0o755)! | ||
| for name in []string{"LICENSE-Apache2-LLVM", "LICENSE-Boost"} { | ||
| license := os.readFile(filepath.join(ctx.SourceDir, name))! | ||
| os.writeFile(filepath.join(licenseDir, name), license, 0o644)! | ||
| } |
There was a problem hiding this comment.
[P3] Hardcoded license filenames hard-fail if upstream renames them
This is the only formula in the repo doing manual license copying, and the two names are hardcoded. If either is renamed across any future fromVer range extension, os.readFile(...)! aborts the build with an opaque error. Names are correct for 1.1.3, so this is fine as-is — but confirm this licenses/ layout is a required store convention (siblings copy none); if nothing consumes it, consider dropping the block, and if it stays, note the tight coupling to exact upstream filename spelling.
Add an LLAR Formula for
jk-jeon/dragonboxversion1.1.3.The implementation includes:
fPICoption and publish its link metadata.dragonbox::dragonbox_to_chars.This completes the closed Dragonbox translation issue with a source-backed Formula and reproducible consumer validation.
Closes #111