From 2dfd2a8faa77c13b1031ebb20bee9e27c83ab24d Mon Sep 17 00:00:00 2001 From: Arnaud Date: Wed, 15 Oct 2025 06:54:58 +0200 Subject: [PATCH] Provide better flexibility for passing OS and ARCH --- Makefile | 8 ++++---- README.md | 13 ++++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 8f24689..7a2c913 100644 --- a/Makefile +++ b/Makefile @@ -6,9 +6,9 @@ CGO_CFLAGS := -I$(LIBS_DIR) CGO_LDFLAGS := -L$(LIBS_DIR) -Wl,-rpath,$(LIBS_DIR) # Configuration for fetching the right binary -OS := "linux" -ARCH := "amd64" -VERSION := "v0.0.15" +OS ?= "linux" +ARCH ?= "amd64" +VERSION ?= "v0.0.15" LATEST_URL := "https://github.com/codex-storage/codex-go-bindings/releases/latest/download/codex-${OS}-${ARCH}.zip" VERSIONED_URL := "https://github.com/codex-storage/codex-go-bindings/releases/download/$(VERSION)/codex-${OS}-${ARCH}.zip" @@ -20,7 +20,7 @@ all: run fetch: @echo "Fetching libcodex from GitHub Actions: ${LATEST_URL}" @curl -fSL --create-dirs -o $(LIBS_DIR)/codex-${OS}-${ARCH}.zip ${LATEST_URL} - @unzip $(LIBS_DIR)/codex-${OS}-${ARCH}.zip -d $(LIBS_DIR) + @unzip $(LIBS_DIR)/codex-${OS}-${ARCH}.zip -d -qq $(LIBS_DIR) @rm -f $(LIBS_DIR)/*.zip build: diff --git a/README.md b/README.md index 8f16b5f..73ba574 100644 --- a/README.md +++ b/README.md @@ -15,14 +15,17 @@ go get ### Fetch the artifacts ```sh -# Adapt for your OS -OS := "linux" # can be linux, macos or windows -ARCH := "amd64" # can amd64 or arm64 make fetch ``` -By default, the last release will be downloaded and extracted to libs folder. You can change the `Makefile` -to specify another folder or download a specific version. +The default `OS` is `linux` and the default `ARCH` is `amd64`. +You can update them like this: + +```sh +OS="macos" ARCH="arm64" make fetch +``` + +By default, the last release will be downloaded and extracted to libs folder. ### Build