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
83 changes: 83 additions & 0 deletions cxong/tinydir/1.2.6/tinydir_llar.gox
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import (
"os"
"path/filepath"
)

const consumerSource = `#include <stdio.h>

#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.6"

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.6",
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
}
4 changes: 4 additions & 0 deletions cxong/tinydir/versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"path": "cxong/tinydir",
"deps": {}
}
Loading