Skip to content
This repository was archived by the owner on Sep 20, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions anrieff/libcpuid/v0.5.0/0.5.0-cmake-fixes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- a/cpuid_tool/CMakeLists.txt
+++ b/cpuid_tool/CMakeLists.txt
@@ -5 +5 @@
-if(WIN32)
+if(0)
--- a/libcpuid/CMakeLists.txt
+++ b/libcpuid/CMakeLists.txt
@@ -15,5 +15,5 @@
if(UNIX)
- add_library(cpuid SHARED ${cpuid_sources})
+ add_library(cpuid ${cpuid_sources})
else()
add_library(cpuid ${cpuid_sources})
endif()
114 changes: 114 additions & 0 deletions anrieff/libcpuid/v0.5.0/libcpuid_llar.gox
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import (
"os"
"path/filepath"
"slices"
)

const consumerSource = `#include "libcpuid/libcpuid.h"

#include <stdio.h>

int main(void)
{
if (!cpuid_present()) {
return 1;
}

struct cpu_raw_data_t raw;
struct cpu_id_t data;
if (cpuid_get_raw_data(&raw) < 0) {
return 2;
}
if (cpu_identify(&raw, &data) < 0) {
return 3;
}

printf("%s %s\n", data.vendor_str, data.cpu_codename);
return 0;
}
`

id "anrieff/libcpuid"

fromVer "v0.5.0"

defaults {
"shared": "OFF",
"fPIC": "ON",
}

filter => {
for name, values in target.options {
if name != "shared" && name != "fPIC" {
return false
}
for value in values {
if value != "ON" && value != "OFF" {
return false
}
}
}
return slices.contains(target.require["arch"], "amd64")

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] Preserve 32-bit x86 support in the architecture filter

The Conan recipe's validate contract explicitly accepts both x86 and x86_64, and the upstream project publishes ix86 builds. LLAR represents 32-bit x86 as 386, so this filter rejects a supported target before onBuild runs; the same predicate is duplicated in the v0.6.0 and v0.7.0 thresholds. Include 386 alongside amd64 (or otherwise mirror the recipe's x86/x86_64 matrix) so the formula does not silently drop a supported architecture.

}

onBuild ctx => {
installDir := ctx.outputDir

patch := ctx.Proj.readFile("v0.5.0/0.5.0-cmake-fixes.patch")!
patchPath := filepath.join(ctx.SourceDir, "_llar_cmake-fixes.patch")
os.writeFile(patchPath, patch, 0o644)!
git! "apply", "--unidiff-zero", patchPath

shared := target.options["shared"][0] == "ON"
fPIC := target.options["fPIC"][0] == "ON"
c := cmake.new(ctx.SourceDir, filepath.join(ctx.SourceDir, "_build"), installDir)
c.defineBool "BUILD_SHARED_LIBS", shared
c.defineBool "CMAKE_POSITION_INDEPENDENT_CODE", fPIC
c.defineBool "CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS", shared
c.defineBool "ENABLE_DOCS", false
c.configure
c.build "--target", "cpuid_tool"
c.install

licenseDir := filepath.join(installDir, "licenses")
os.mkdirAll(licenseDir, 0o755)!
os.writeFile(filepath.join(licenseDir, "COPYING"), os.readFile(filepath.join(ctx.SourceDir, "COPYING"))!, 0o644)!

pcDir := filepath.join(installDir, "lib", "pkgconfig")
os.mkdirAll(pcDir, 0o755)!
pc := pkgconfig.new(
name = "libcpuid",
description = "libcpuid provides CPU identification for x86",
version = "v0.5.0",
libs = ["-L$${libdir}", "-lcpuid"],
cflags = ["-I$${includedir}"],
)!
out := os.create(filepath.join(pcDir, "libcpuid.pc"))!
pc.writeTo(out)!
out.close()!

pkgconfig.use installDir
ctx.setMetadata pkgconfig.lookup("libcpuid")!
}

onTest ctx => {
installDir := ctx.outputDir
testDir := filepath.join(ctx.SourceDir, "_llar_consumer")
os.mkdirAll(testDir, 0o755)!

consumer := filepath.join(testDir, "consumer.c")
os.writeFile(consumer, []byte(consumerSource), 0o644)!

pkgconfig.use installDir
binary := filepath.join(testDir, "consumer")
flagsFile := filepath.join(testDir, "libcpuid.flags")
os.writeFile(flagsFile, []byte(pkgconfig.lookup("libcpuid")!), 0o644)!
cc! consumer, "-o", binary, "@"+flagsFile

if target.options["shared"][0] == "ON" {
os.setenv("LD_LIBRARY_PATH", filepath.join(installDir, "lib"))!
os.setenv("DYLD_LIBRARY_PATH", filepath.join(installDir, "lib"))!
}
exec! binary
exec! filepath.join(installDir, "bin", "cpuid_tool"), "--report"
}
110 changes: 110 additions & 0 deletions anrieff/libcpuid/v0.6.0/libcpuid_llar.gox
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import (
"os"
"path/filepath"
"slices"
)

const consumerSource = `#include "libcpuid/libcpuid.h"

#include <stdio.h>

int main(void)
{
if (!cpuid_present()) {
return 1;
}

struct cpu_raw_data_t raw;
struct cpu_id_t data;
if (cpuid_get_raw_data(&raw) < 0) {
return 2;
}
if (cpu_identify(&raw, &data) < 0) {
return 3;
}

printf("%s %s\n", data.vendor_str, data.cpu_codename);
return 0;
}
`

id "anrieff/libcpuid"

fromVer "v0.6.0"

defaults {
"shared": "OFF",
"fPIC": "ON",
}

filter => {
for name, values in target.options {
if name != "shared" && name != "fPIC" {
return false
}
for value in values {
if value != "ON" && value != "OFF" {
return false
}
}
}
return slices.contains(target.require["arch"], "amd64")
}

onBuild ctx => {
installDir := ctx.outputDir
shared := target.options["shared"][0] == "ON"
fPIC := target.options["fPIC"][0] == "ON"

c := cmake.new(ctx.SourceDir, filepath.join(ctx.SourceDir, "_build"), installDir)
c.defineBool "BUILD_SHARED_LIBS", shared
c.defineBool "CMAKE_POSITION_INDEPENDENT_CODE", fPIC
c.defineBool "CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS", shared
c.defineBool "ENABLE_DOCS", false
c.defineBool "LIBCPUID_TESTS", false
c.configure
c.build
c.install

licenseDir := filepath.join(installDir, "licenses")
os.mkdirAll(licenseDir, 0o755)!
os.writeFile(filepath.join(licenseDir, "COPYING"), os.readFile(filepath.join(ctx.SourceDir, "COPYING"))!, 0o644)!

pcDir := filepath.join(installDir, "lib", "pkgconfig")
os.mkdirAll(pcDir, 0o755)!
pc := pkgconfig.new(
name = "libcpuid",
description = "libcpuid provides CPU identification for x86",
version = "v0.6.0",
libs = ["-L$${libdir}", "-lcpuid"],
cflags = ["-I$${includedir}"],
)!
out := os.create(filepath.join(pcDir, "libcpuid.pc"))!
pc.writeTo(out)!
out.close()!

pkgconfig.use installDir
ctx.setMetadata pkgconfig.lookup("libcpuid")!
}

onTest ctx => {
installDir := ctx.outputDir
testDir := filepath.join(ctx.SourceDir, "_llar_consumer")
os.mkdirAll(testDir, 0o755)!

consumer := filepath.join(testDir, "consumer.c")
os.writeFile(consumer, []byte(consumerSource), 0o644)!

pkgconfig.use installDir
binary := filepath.join(testDir, "consumer")
flagsFile := filepath.join(testDir, "libcpuid.flags")
os.writeFile(flagsFile, []byte(pkgconfig.lookup("libcpuid")!), 0o644)!
cc! consumer, "-o", binary, "@"+flagsFile

if target.options["shared"][0] == "ON" {
os.setenv("LD_LIBRARY_PATH", filepath.join(installDir, "lib"))!
os.setenv("DYLD_LIBRARY_PATH", filepath.join(installDir, "lib"))!
}
exec! binary
exec! filepath.join(installDir, "bin", "cpuid_tool"), "--report"
}
111 changes: 111 additions & 0 deletions anrieff/libcpuid/v0.7.0/libcpuid_llar.gox
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import (
"os"
"path/filepath"
"slices"
)

const consumerSource = `#include "libcpuid/libcpuid.h"

#include <stdio.h>

int main(void)
{
if (!cpuid_present()) {
return 1;
}

struct cpu_raw_data_t raw;
struct cpu_id_t data;
if (cpuid_get_raw_data(&raw) < 0) {
return 2;
}
if (cpu_identify(&raw, &data) < 0) {
return 3;
}

printf("%s %s\n", data.vendor_str, data.cpu_codename);
return 0;
}
`

id "anrieff/libcpuid"

fromVer "v0.7.0"

defaults {
"shared": "OFF",
"fPIC": "ON",
}

filter => {
for name, values in target.options {
if name != "shared" && name != "fPIC" {
return false
}
for value in values {
if value != "ON" && value != "OFF" {
return false
}
}
}
return slices.contains(target.require["arch"], "amd64")
}

onBuild ctx => {
installDir := ctx.outputDir
shared := target.options["shared"][0] == "ON"
fPIC := target.options["fPIC"][0] == "ON"

c := cmake.new(ctx.SourceDir, filepath.join(ctx.SourceDir, "_build"), installDir)
c.defineBool "BUILD_SHARED_LIBS", shared
c.defineBool "CMAKE_POSITION_INDEPENDENT_CODE", fPIC
c.defineBool "CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS", shared
c.defineBool "LIBCPUID_BUILD_DRIVERS", false
c.defineBool "LIBCPUID_ENABLE_TESTS", false
c.defineBool "LIBCPUID_ENABLE_DOCS", false
c.configure
c.build
c.install

licenseDir := filepath.join(installDir, "licenses")
os.mkdirAll(licenseDir, 0o755)!
os.writeFile(filepath.join(licenseDir, "COPYING"), os.readFile(filepath.join(ctx.SourceDir, "COPYING"))!, 0o644)!

pcDir := filepath.join(installDir, "lib", "pkgconfig")
os.mkdirAll(pcDir, 0o755)!
pc := pkgconfig.new(
name = "libcpuid",
description = "libcpuid provides CPU identification for x86",
version = "v0.7.0",
libs = ["-L$${libdir}", "-lcpuid"],
cflags = ["-I$${includedir}"],
)!
out := os.create(filepath.join(pcDir, "libcpuid.pc"))!
pc.writeTo(out)!
out.close()!

pkgconfig.use installDir
ctx.setMetadata pkgconfig.lookup("libcpuid")!
}

onTest ctx => {
installDir := ctx.outputDir
testDir := filepath.join(ctx.SourceDir, "_llar_consumer")
os.mkdirAll(testDir, 0o755)!

consumer := filepath.join(testDir, "consumer.c")
os.writeFile(consumer, []byte(consumerSource), 0o644)!

pkgconfig.use installDir
binary := filepath.join(testDir, "consumer")
flagsFile := filepath.join(testDir, "libcpuid.flags")
os.writeFile(flagsFile, []byte(pkgconfig.lookup("libcpuid")!), 0o644)!
cc! consumer, "-o", binary, "@"+flagsFile

if target.options["shared"][0] == "ON" {
os.setenv("LD_LIBRARY_PATH", filepath.join(installDir, "lib"))!
os.setenv("DYLD_LIBRARY_PATH", filepath.join(installDir, "lib"))!
}
exec! binary
exec! filepath.join(installDir, "bin", "cpuid_tool"), "--report"
}
4 changes: 4 additions & 0 deletions anrieff/libcpuid/versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"path": "anrieff/libcpuid",
"deps": {}
}
Loading