From 6214dd47f0f24d1a0a0a11082dd3922bedcfae34 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Fri, 3 Oct 2025 05:30:09 +0200 Subject: [PATCH] Init project --- .gitignore | 18 ++++++++++++++++++ .gitmodules | 3 +++ codex/Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++ go.mod | 3 +++ third_party/nim-codex | 1 + 5 files changed, 67 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 codex/Makefile create mode 100644 go.mod create mode 160000 third_party/nim-codex diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2b32cdb --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Generated dependencies and cache +nimcache \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..7127cf1 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "third_party/nim-codex"] + path = third_party/nim-codex + url = https://github.com/codex-storage/nim-codex.git \ No newline at end of file diff --git a/codex/Makefile b/codex/Makefile new file mode 100644 index 0000000..13ce464 --- /dev/null +++ b/codex/Makefile @@ -0,0 +1,42 @@ +# Makefile for Codex Go Bindings + +# Directories +THIRD_PARTY_DIR := ../third_party +NIM_CODEX_REPO := https://github.com/codex-storage/nim-codex +NIM_CODEX_DIR := $(THIRD_PARTY_DIR)/nim-codex + +.PHONY: all clean prepare build-libcodex build + +# Default target +all: build + +# Prepare third_party directory and clone nim-codex +prepare: + @echo "Creating third_party directory..." + @mkdir -p $(THIRD_PARTY_DIR) + + @echo "Cloning nim-codex repository..." + @if [ ! -d "$(NIM_CODEX_DIR)" ]; then \ + cd $(THIRD_PARTY_DIR) && \ + git clone $(NIM_CODEX_REPO) && \ + cd $(NIM_CODEX_DIR) && \ + make update; \ + else \ + echo "nim-codex repository already exists."; \ + fi + +# Build libcodex +build-libcodex: prepare + @echo "Building libcodex..." + @cd $(NIM_CODEX_DIR) && make libcodex + +# Build Codex Go Bindings +build: build-libcodex + @echo "Building Codex Go Bindings..." + go build ./... + +# Clean up generated files +clean: + @echo "Cleaning up..." + @rm -rf $(THIRD_PARTY_DIR) + @rm -f codex-go-bindings \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..65cde93 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module codex + +go 1.25.1 diff --git a/third_party/nim-codex b/third_party/nim-codex new file mode 160000 index 0000000..40cc019 --- /dev/null +++ b/third_party/nim-codex @@ -0,0 +1 @@ +Subproject commit 40cc0195dc99eecd4ea3a4396bb9f1dbd107fd86