Skip to content

Commit

Permalink
Download athena dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
lrettig committed Jul 29, 2024
1 parent d176dc8 commit 7106567
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ install:
build: go-spacemesh get-profiler get-postrs-service
.PHONY: build

get-libs: get-postrs-lib get-postrs-service
get-libs: get-postrs-lib get-postrs-service get-athena-lib

get-profiler: get-postrs-profiler

Expand Down
33 changes: 29 additions & 4 deletions Makefile-libs.Inc
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,45 @@ else
ULIMIT := ulimit -n 9999;
else
ifeq ($(GOARCH),arm64)
platform := linux-arm64
platform := linux
arch := arm64
libpost_arch := -arm64
else
platform := linux
arch := amd64
endif
CGO_LDFLAGS := $(CGO_LDFLAGS) -Wl,-rpath,$$ORIGIN
endif
endif

POSTRS_SETUP_REV = 0.7.11
POSTRS_SETUP_ZIP = libpost-$(platform)-v$(POSTRS_SETUP_REV).zip
POSTRS_SETUP_ZIP = libpost-$(platform)$(libpost_arch)-v$(POSTRS_SETUP_REV).zip
POSTRS_SETUP_URL_ZIP ?= https://github.com/spacemeshos/post-rs/releases/download/v$(POSTRS_SETUP_REV)/$(POSTRS_SETUP_ZIP)

POSTRS_PROFILER_ZIP = profiler-$(platform)-v$(POSTRS_SETUP_REV).zip
POSTRS_PROFILER_ZIP = profiler-$(platform)$(libpost_arch)-v$(POSTRS_SETUP_REV).zip
POSTRS_PROFILER_URL ?= https://github.com/spacemeshos/post-rs/releases/download/v$(POSTRS_SETUP_REV)/$(POSTRS_PROFILER_ZIP)

POSTRS_SERVICE_ZIP = post-service-$(platform)-v$(POSTRS_SETUP_REV).zip
POSTRS_SERVICE_ZIP = post-service-$(platform)$(libpost_arch)-v$(POSTRS_SETUP_REV).zip
POSTRS_SERVICE_URL ?= https://github.com/spacemeshos/post-rs/releases/download/v$(POSTRS_SETUP_REV)/$(POSTRS_SERVICE_ZIP)

ATHENA_SETUP_REV = 0.3.0
ATHENA_SETUP_ARTIFACT = athena_vmlib_v$(ATHENA_SETUP_REV)_$(platform)_$(arch).tar.gz
ATHENA_SETUP_ARTIFACT_URL ?= https://github.com/athenavm/athena/releases/download/v$(ATHENA_SETUP_REV)/$(ATHENA_SETUP_ARTIFACT)

ifeq ($(platform), windows)
POSTRS_SETUP_LIBS = post.h post.dll

POSTRS_PROFILER_BIN = profiler.exe
POSTRS_SERVICE_BIN = post-service.exe

ATHENA_SETUP_LIBS = libathena_vmlib.dll lib/loader/loader.c include/athcon/helpers.h include/athcon/athcon.h include/athcon/loader.h
else
ifeq ($(platform), $(filter $(platform), macos macos-m1))
POSTRS_SETUP_LIBS = post.h libpost.dylib
ATHENA_SETUP_LIBS = libathena_vmlib.dylib lib/loader/loader.c include/athcon/helpers.h include/athcon/athcon.h include/athcon/loader.h
else
POSTRS_SETUP_LIBS = post.h libpost.so
ATHENA_SETUP_LIBS = libathena_vmlib.so lib/loader/loader.c include/athcon/helpers.h include/athcon/athcon.h include/athcon/loader.h
endif

POSTRS_PROFILER_BIN = profiler
Expand All @@ -94,6 +105,19 @@ ifeq ($(shell expr "$(CURL_VERSION)" \>= 7.71.0),1)
CURL_OPTIONS := $(CURL_OPTIONS) --retry-all-errors
endif

$(PROJ_DIR)$(ATHENA_SETUP_ARTIFACT):
curl -sSL $(CURL_OPTIONS) $(ATHENA_SETUP_ARTIFACT_URL) -o $(PROJ_DIR)$(ATHENA_SETUP_ARTIFACT)

# file marking athena version
$(BIN_DIR).athena.version.$(ATHENA_SETUP_REV): $(PROJ_DIR)$(ATHENA_SETUP_ARTIFACT)
rm -f $(BIN_DIR).athena.version.*
mkdir -p $(dir $@)
touch $@

$(ATHENA_SETUP_LIBS): $(BIN_DIR).athena.version.$(ATHENA_SETUP_REV)
mkdir -p $(BIN_DIR)$(dir $@)
tar xzf $(PROJ_DIR)$(ATHENA_SETUP_ARTIFACT) -C $(BIN_DIR)$(dir $@) $@

$(PROJ_DIR)$(POSTRS_SETUP_ZIP):
curl -sSL $(CURL_OPTIONS) $(POSTRS_SETUP_URL_ZIP) -o $(PROJ_DIR)$(POSTRS_SETUP_ZIP)

Expand Down Expand Up @@ -126,6 +150,7 @@ $(BIN_DIR)$(POSTRS_SERVICE_BIN): $(BIN_DIR)/.service.version.$(POSTRS_SETUP_REV)
get-postrs-lib: $(BINDIR_POSTRS_SETUP_LIBS)
get-postrs-profiler: $(BIN_DIR)$(POSTRS_PROFILER_BIN)
get-postrs-service: $(BIN_DIR)$(POSTRS_SERVICE_BIN)
get-athena-lib: $(ATHENA_SETUP_LIBS)

go-env: get-postrs-lib
go env -w CGO_CFLAGS="$(CGO_CFLAGS)"
Expand Down

0 comments on commit 7106567

Please sign in to comment.