diff --git a/Makefile b/Makefile index bb50334..306e55c 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,13 @@ GOBUILD=$(GOCMD) build GOCLEAN=$(GOCMD) clean BINARY_NAME=bootstrap -all: clean build +all: clean build build-shared build-example build: $(GOBUILD) -o bin/$(BINARY_NAME) -v src/main.go +build-shared: + $(GOBUILD) -o bin/$(BINARY_NAME).so -buildmode=c-shared -v src/main.go +build-example: build-shared + g++ -o bin/$(BINARY_NAME)_example -I./bin -L./bin example/example.cpp bin/bootstrap.so clean: $(GOCLEAN) - rm -f bin/$(BINARY_NAME) + rm -f bin/$(BINARY_NAME)* \ No newline at end of file diff --git a/example/example.cpp b/example/example.cpp new file mode 100644 index 0000000..6191c4b --- /dev/null +++ b/example/example.cpp @@ -0,0 +1,5 @@ +#include "bootstrap.h" + +int main(void) { + Update(); +} diff --git a/src/main.go b/src/main.go index c4aed80..bfde24c 100644 --- a/src/main.go +++ b/src/main.go @@ -1,5 +1,7 @@ package main +import "C" + import ( "encoding/json" "flag" @@ -19,6 +21,11 @@ type Repo struct { } func main() { + Update() +} + +//export Update +func Update() { repo := flag.String("r", "https://raw.githubusercontent.com/OpenVGS/MiSTer-repository/master/repo.json", "Repo URL") output := flag.String("o", "/tmp/mister", "Output Directory")