From 9098730257e392a6e46ea93e495c73c5ed9f6aa9 Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Wed, 9 Sep 2026 18:38:51 +0800 Subject: [PATCH 1/4] formula: add onqtam/doctest --- onqtam/doctest/2.3.3/doctest_llar.gox | 78 +++++++++++++++++++++++++++ onqtam/doctest/versions.json | 4 ++ 2 files changed, 82 insertions(+) create mode 100644 onqtam/doctest/2.3.3/doctest_llar.gox create mode 100644 onqtam/doctest/versions.json diff --git a/onqtam/doctest/2.3.3/doctest_llar.gox b/onqtam/doctest/2.3.3/doctest_llar.gox new file mode 100644 index 0000000..cbad685 --- /dev/null +++ b/onqtam/doctest/2.3.3/doctest_llar.gox @@ -0,0 +1,78 @@ +import ( + "os" + "path/filepath" +) + +const consumerSource = `#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN +#include + +TEST_CASE("testing the factorial function") { + CHECK(1 == 1); +} +` + +id "onqtam/doctest" + +fromVer "2.3.3" + +onBuild ctx => { + installDir := ctx.outputDir + + includeDir := filepath.join(installDir, "include", "doctest") + os.mkdirAll(includeDir, 0o755)! + os.writeFile( + filepath.join(includeDir, "doctest.h"), + os.readFile(filepath.join(ctx.SourceDir, "doctest", "doctest.h"))!, + 0o644, + )! + + cmakeDir := filepath.join(installDir, "lib", "cmake") + os.mkdirAll(cmakeDir, 0o755)! + for name in ["doctest.cmake", "doctestAddTests.cmake"] { + os.writeFile( + filepath.join(cmakeDir, name), + os.readFile(filepath.join(ctx.SourceDir, "scripts", "cmake", name))!, + 0o644, + )! + } + + licenseDir := filepath.join(installDir, "licenses") + os.mkdirAll(licenseDir, 0o755)! + os.writeFile( + filepath.join(licenseDir, "LICENSE.txt"), + os.readFile(filepath.join(ctx.SourceDir, "LICENSE.txt"))!, + 0o644, + )! + + pcDir := filepath.join(installDir, "lib", "pkgconfig") + os.mkdirAll(pcDir, 0o755)! + pc := pkgconfig.new( + name = "doctest", + description = "C++11/14/17/20 single header testing framework", + version = "2.3.3", + cflags = ["-I$${includedir}"], + )! + out := os.create(filepath.join(pcDir, "doctest.pc"))! + pc.writeTo(out)! + out.close()! + + pkgconfig.use installDir + ctx.setMetadata pkgconfig.lookup("doctest")! +} + +onTest ctx => { + installDir := ctx.outputDir + testDir := filepath.join(ctx.SourceDir, "_llar_consumer") + os.mkdirAll(testDir, 0o755)! + + consumer := filepath.join(testDir, "consumer.cpp") + os.writeFile(consumer, []byte(consumerSource), 0o644)! + + pkgconfig.use installDir + flagsFile := filepath.join(testDir, "doctest.flags") + os.writeFile(flagsFile, []byte(pkgconfig.lookup("doctest")!), 0o644)! + + binary := filepath.join(testDir, "consumer") + exec! "c++", "-std=c++11", consumer, "-o", binary, "@"+flagsFile + exec! binary +} diff --git a/onqtam/doctest/versions.json b/onqtam/doctest/versions.json new file mode 100644 index 0000000..30d6aae --- /dev/null +++ b/onqtam/doctest/versions.json @@ -0,0 +1,4 @@ +{ + "path": "onqtam/doctest", + "deps": {} +} From 003ff2db9cdf7d3502d3df72c3ef4ee92ec548ac Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Thu, 10 Sep 2026 13:56:57 +0800 Subject: [PATCH 2/4] fix(doctest): remove incomplete CMake export files --- onqtam/doctest/2.3.3/doctest_llar.gox | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/onqtam/doctest/2.3.3/doctest_llar.gox b/onqtam/doctest/2.3.3/doctest_llar.gox index cbad685..a649188 100644 --- a/onqtam/doctest/2.3.3/doctest_llar.gox +++ b/onqtam/doctest/2.3.3/doctest_llar.gox @@ -26,16 +26,6 @@ onBuild ctx => { 0o644, )! - cmakeDir := filepath.join(installDir, "lib", "cmake") - os.mkdirAll(cmakeDir, 0o755)! - for name in ["doctest.cmake", "doctestAddTests.cmake"] { - os.writeFile( - filepath.join(cmakeDir, name), - os.readFile(filepath.join(ctx.SourceDir, "scripts", "cmake", name))!, - 0o644, - )! - } - licenseDir := filepath.join(installDir, "licenses") os.mkdirAll(licenseDir, 0o755)! os.writeFile( From d818314b6da3df52cf710a3ad3da3c7d33f5ef8d Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Thu, 10 Sep 2026 14:12:41 +0800 Subject: [PATCH 3/4] fix(doctest): preserve complete upstream CMake package --- onqtam/doctest/2.3.3/doctest_llar.gox | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/onqtam/doctest/2.3.3/doctest_llar.gox b/onqtam/doctest/2.3.3/doctest_llar.gox index a649188..eb8a93c 100644 --- a/onqtam/doctest/2.3.3/doctest_llar.gox +++ b/onqtam/doctest/2.3.3/doctest_llar.gox @@ -18,13 +18,15 @@ fromVer "2.3.3" onBuild ctx => { installDir := ctx.outputDir - includeDir := filepath.join(installDir, "include", "doctest") - os.mkdirAll(includeDir, 0o755)! - os.writeFile( - filepath.join(includeDir, "doctest.h"), - os.readFile(filepath.join(ctx.SourceDir, "doctest", "doctest.h"))!, - 0o644, - )! + // Use the upstream install rules so the CMake consumer receives the + // complete Config, Version, Targets, and helper-script set. + c := cmake.new(ctx.SourceDir, filepath.join(ctx.SourceDir, "_build"), installDir) + c.define "CMAKE_POLICY_VERSION_MINIMUM", "3.5" + c.defineBool "DOCTEST_WITH_TESTS", false + c.defineBool "DOCTEST_WITH_MAIN_IN_STATIC_LIB", false + c.configure + c.build + c.install licenseDir := filepath.join(installDir, "licenses") os.mkdirAll(licenseDir, 0o755)! From 04b803b2334b67bb49911a8cd232afe5ec2b77db Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Thu, 10 Sep 2026 14:28:30 +0800 Subject: [PATCH 4/4] fix(doctest): keep CMake package under lib --- onqtam/doctest/2.3.3/doctest_llar.gox | 1 + 1 file changed, 1 insertion(+) diff --git a/onqtam/doctest/2.3.3/doctest_llar.gox b/onqtam/doctest/2.3.3/doctest_llar.gox index eb8a93c..0bfa3aa 100644 --- a/onqtam/doctest/2.3.3/doctest_llar.gox +++ b/onqtam/doctest/2.3.3/doctest_llar.gox @@ -22,6 +22,7 @@ onBuild ctx => { // complete Config, Version, Targets, and helper-script set. c := cmake.new(ctx.SourceDir, filepath.join(ctx.SourceDir, "_build"), installDir) c.define "CMAKE_POLICY_VERSION_MINIMUM", "3.5" + c.define "CMAKE_INSTALL_LIBDIR", "lib" c.defineBool "DOCTEST_WITH_TESTS", false c.defineBool "DOCTEST_WITH_MAIN_IN_STATIC_LIB", false c.configure