From 360b9d10b9fb4dcf2e568a79a2ce5d50a80ea707 Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Tue, 18 Aug 2026 18:52:32 +0800 Subject: [PATCH] feat(libipt): add LLAR formula --- intel/libipt/v2.0.1/libipt_llar.gox | 90 +++++++++++++++++++++++++++++ intel/libipt/versions.json | 4 ++ 2 files changed, 94 insertions(+) create mode 100644 intel/libipt/v2.0.1/libipt_llar.gox create mode 100644 intel/libipt/versions.json diff --git a/intel/libipt/v2.0.1/libipt_llar.gox b/intel/libipt/v2.0.1/libipt_llar.gox new file mode 100644 index 0000000..d2d8fb2 --- /dev/null +++ b/intel/libipt/v2.0.1/libipt_llar.gox @@ -0,0 +1,90 @@ +import ( + "os" + "path/filepath" + "slices" + "strings" +) + +const consumerSource = `#include + +int main() { + pt_config cfg; + pt_config_init(&cfg); + return 0; +} +` + +id "intel/libipt" + +fromVer "v2.0.1" + +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 true +} + +onBuild ctx => { + installDir := ctx.outputDir + shared := slices.contains(target.options["shared"], "ON") + fPIC := slices.contains(target.options["fPIC"], "ON") + + c := cmake.new(ctx.SourceDir, filepath.join(ctx.SourceDir, "_build"), installDir) + c.define "CMAKE_INSTALL_LIBDIR", "lib" + c.defineBool "BUILD_SHARED_LIBS", shared + c.defineBool "CMAKE_POSITION_INDEPENDENT_CODE", fPIC + c.configure + c.build + c.install + + licenseDir := filepath.join(installDir, "licenses") + os.mkdirAll(licenseDir, 0o755)! + os.writeFile(filepath.join(licenseDir, "LICENSE"), os.readFile(filepath.join(ctx.SourceDir, "LICENSE"))!, 0o644)! + + metadata := []string{ + "-I" + filepath.join(installDir, "include"), + "-L" + filepath.join(installDir, "lib"), + "-lipt", + } + ctx.setMetadata strings.join(metadata, " ") +} + +onTest ctx => { + installDir := ctx.outputDir + testDir := filepath.join(ctx.SourceDir, "_llar_consumer") + os.mkdirAll(testDir, 0o755)! + + sourcePath := filepath.join(testDir, "consumer.cpp") + os.writeFile(sourcePath, []byte(consumerSource), 0o644)! + binary := filepath.join(testDir, "consumer") + args := []string{ + "-std=c++11", + "-I" + filepath.join(installDir, "include"), + sourcePath, + "-L" + filepath.join(installDir, "lib"), + "-lipt", + "-o", binary, + } + exec "c++", args... + lastErr! + + if slices.contains(target.options["shared"], "ON") { + os.setenv("LD_LIBRARY_PATH", filepath.join(installDir, "lib"))! + os.setenv("DYLD_LIBRARY_PATH", filepath.join(installDir, "lib"))! + } + exec binary + lastErr! +} diff --git a/intel/libipt/versions.json b/intel/libipt/versions.json new file mode 100644 index 0000000..07f2a94 --- /dev/null +++ b/intel/libipt/versions.json @@ -0,0 +1,4 @@ +{ + "path": "intel/libipt", + "deps": {} +}