From 249c4e5cb914cce706195e3c72c52c20821a5416 Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Wed, 9 Sep 2026 21:11:22 +0800 Subject: [PATCH 1/2] formula: add cxong/tinydir --- cxong/tinydir/1.2.6/tinydir_llar.gox | 83 ++++++++++++++++++++++++++++ cxong/tinydir/versions.json | 4 ++ 2 files changed, 87 insertions(+) create mode 100644 cxong/tinydir/1.2.6/tinydir_llar.gox create mode 100644 cxong/tinydir/versions.json diff --git a/cxong/tinydir/1.2.6/tinydir_llar.gox b/cxong/tinydir/1.2.6/tinydir_llar.gox new file mode 100644 index 0000000..60d395e --- /dev/null +++ b/cxong/tinydir/1.2.6/tinydir_llar.gox @@ -0,0 +1,83 @@ +import ( + "os" + "path/filepath" +) + +const consumerSource = `#include + +#include "tinydir.h" + +int main(void) +{ + tinydir_dir dir; + if (tinydir_open(&dir, ".") != 0) + return 1; + + while (dir.has_next) + { + tinydir_file file; + if (tinydir_readfile(&dir, &file) != 0) + { + tinydir_close(&dir); + return 1; + } + + printf("%s%s\n", file.name, file.is_dir ? "/" : ""); + if (tinydir_next(&dir) != 0) + { + tinydir_close(&dir); + return 1; + } + } + + tinydir_close(&dir); + return 0; +} +` + +id "cxong/tinydir" + +fromVer "1.2.4" + +onBuild ctx => { + installDir := ctx.outputDir + includeDir := filepath.join(installDir, "include") + os.mkdirAll(includeDir, 0o755)! + os.writeFile(filepath.join(includeDir, "tinydir.h"), os.readFile(filepath.join(ctx.SourceDir, "tinydir.h"))!, 0o644)! + + 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 = "tinydir", + description = "Lightweight, portable and easy to integrate C directory and file reader", + version = "1.2.4", + cflags = ["-I$${includedir}"], + )! + out := os.create(filepath.join(pcDir, "tinydir.pc"))! + pc.writeTo(out)! + out.close()! + + pkgconfig.use installDir + ctx.setMetadata pkgconfig.lookup("tinydir")! +} + +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 + flagsFile := filepath.join(testDir, "tinydir.flags") + os.writeFile(flagsFile, []byte(pkgconfig.lookup("tinydir")!), 0o644)! + + binary := filepath.join(testDir, "consumer") + cc! consumer, "-o", binary, "@"+flagsFile + exec! binary +} diff --git a/cxong/tinydir/versions.json b/cxong/tinydir/versions.json new file mode 100644 index 0000000..e74a5eb --- /dev/null +++ b/cxong/tinydir/versions.json @@ -0,0 +1,4 @@ +{ + "path": "cxong/tinydir", + "deps": {} +} From 8fbcc83c0e6d5a3ae6a72a891c271d48ee4f01c8 Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Thu, 10 Sep 2026 13:42:39 +0800 Subject: [PATCH 2/2] align tinydir formula version --- cxong/tinydir/1.2.6/tinydir_llar.gox | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cxong/tinydir/1.2.6/tinydir_llar.gox b/cxong/tinydir/1.2.6/tinydir_llar.gox index 60d395e..2bcc45b 100644 --- a/cxong/tinydir/1.2.6/tinydir_llar.gox +++ b/cxong/tinydir/1.2.6/tinydir_llar.gox @@ -37,7 +37,7 @@ int main(void) id "cxong/tinydir" -fromVer "1.2.4" +fromVer "1.2.6" onBuild ctx => { installDir := ctx.outputDir @@ -54,7 +54,7 @@ onBuild ctx => { pc := pkgconfig.new( name = "tinydir", description = "Lightweight, portable and easy to integrate C directory and file reader", - version = "1.2.4", + version = "1.2.6", cflags = ["-I$${includedir}"], )! out := os.create(filepath.join(pcDir, "tinydir.pc"))!