feat(cpu_features): add LLAR formula - #168
Conversation
There was a problem hiding this comment.
Review summary
This adds a new LLAR build formula for google/cpu_features v0.9.0. It closely and correctly follows the established repo conventions (e.g. fast-pack/streamvbyte, intel/libipt): the filter/defaults blocks, CMake option handling, license copy, relocatable pkgconfig generation, defensive version panic, and shared-build LD_LIBRARY_PATH/DYLD_LIBRARY_PATH handling all match existing patterns. versions.json is minimal and correct.
One correctness bug worth fixing before merge (the PPC test include typo). A couple of minor, non-blocking notes are inline.
| #elif defined(CPU_FEATURES_ARCH_MIPS) | ||
| #include <cpuinfo_mips.h> | ||
| #elif defined(CPU_FEATURES_ARCH_PPC) | ||
| #include <ccpuinfo_ppc.h> |
There was a problem hiding this comment.
[P1] PPC include header has a typo (ccpuinfo_ppc.h)
The PPC branch of the embedded test consumer includes <ccpuinfo_ppc.h> (leading double c). The upstream cpu_features header is cpuinfo_ppc.h. On a PPC target, onTest compiles this consumer and the include will fail with a file-not-found error, breaking the test. The other arch branches (cpuinfo_x86.h, cpuinfo_arm.h, cpuinfo_aarch64.h, cpuinfo_mips.h) are correct.
| #include <ccpuinfo_ppc.h> | |
| #include <cpuinfo_ppc.h> |
| if line.hasPrefix("project(CpuFeatures VERSION ") { | ||
| version = line.trimPrefix("project(CpuFeatures VERSION ").split(" ")[0] |
There was a problem hiding this comment.
[P3] Version parse is whitespace-brittle for future tags
Version extraction relies on the exact literal prefix project(CpuFeatures VERSION plus .split(" ")[0]. This is correct for v0.9.0 (project(CpuFeatures VERSION 0.9.0 LANGUAGES C)). But since fromVer "v0.9.0" means this formula may be reused for later tags, any whitespace variation (extra space, tab, or a line-wrapped project(...)) would miss the prefix and hit the panic. Consider a whitespace-tolerant parse (e.g. tokenizing) as done in intel/libipt. Non-blocking.
Closes #36
Translate the Conan Center
cpu_featuresrecipe (ffe30df101afd4dc95aac2f14b25bf345e64d7be) into an LLAR Formula forgoogle/cpu_features.Formula
google/cpu_featuresfromVer:v0.9.0(Conan recipe covers0.9.0/0.10.1; CMake install layout, public headers underinclude/cpu_features, and consumer contract match)shared(defaultOFF),fPIC(defaultON)BUILD_TESTING=OFF,CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON,CMAKE_INSTALL_LIBDIR=lib,BUILD_SHARED_LIBS/CMAKE_POSITION_INDEPENDENT_CODEfrom optionslicenses/pkg-config
Upstream does not install a
.pcfile. The Formula writes relocatablelib/pkgconfig/cpu_features.pc:prefix=${pcfiledir}/../..Cflags: -I${includedir}/cpu_featuresso the Conan test can#include <cpu_features_macros.h>Libs: -L${libdir} -lcpu_featuresplus-ldlon Linux/FreeBSD (Conansystem_libs = ["dl"]; placed inLibsso default staticpkgconfig.lookupis enough)pkg-config --cflags --libslookuponTestcompiles the Conantest_package.cconsumer with a flags file from that lookupApple
CMAKE_SYSTEM_PROCESSOR=aarch64is not set: v0.9.0+ already matches Darwin'sarm64, and CI is linux/darwin only. Androidndk_compatis not exposed.