Skip to content

Commit

Permalink
Merge pull request #3 from spacemeshos/remove-cgo-directive
Browse files Browse the repository at this point in the history
Remove CGO directives
  • Loading branch information
lrettig authored Apr 27, 2023
2 parents ca2d828 + bc71169 commit 34fd892
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,5 @@ jobs:
- name: get dependencies
run: make deps

- name: build
run: go build -v ./...

- name: go test
run: LD_LIBRARY_PATH=../deps go test -v ./...
run: make test
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Based on https://gist.github.com/trosendal/d4646812a43920bfe94e

DEPLOC = https://github.com/spacemeshos/ed25519_bip32/releases/download
DEPURL = https://github.com/spacemeshos/ed25519_bip32/releases/download
DEPTAG = 1.0.6
DEPLIB = libed25519_bip32
DEPDIR = deps

ifeq ($(OS),Windows_NT)
# MACHINE = WIN32
Expand Down Expand Up @@ -37,7 +38,13 @@ FN = $(DEPLIB)_$(PLATFORM).tar.gz
# Download the platform-specific dynamic library we rely on
.PHONY: deps
deps:
@mkdir -p deps
@mkdir -p $(DEPDIR)
@# silent, show errors, fail fast, follow links
curl -sSfL $(DEPLOC)/v$(DEPTAG)/$(FN) -o deps/$(FN)
cd deps && tar -xzf $(FN) --exclude=LICENSE
curl -sSfL $(DEPURL)/v$(DEPTAG)/$(FN) -o deps/$(FN)
cd $(DEPDIR) && tar -xzf $(FN) --exclude=LICENSE

REALDEPDIR = $(shell realpath $(DEPDIR))

.PHONY: test
test:
LD_LIBRARY_PATH=$(REALDEPDIR) go test -v -ldflags "-extldflags \"-L$(REALDEPDIR) -led25519_bip32\"" ./...
2 changes: 0 additions & 2 deletions bip32/bip32.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package bip32
// TODO: is it possible to read the C header info from the header file rather than hardcoding it here?

/*
#cgo CFLAGS: -I../deps
#cgo LDFLAGS: -L../deps -led25519_bip32
#include <stdint.h>
/// derive_c does the same thing as the above function, but is intended for use over the CFFI.
Expand Down

0 comments on commit 34fd892

Please sign in to comment.