diff options
| author | StevenWdV <stevenwdv@gmail.com> | 2021-11-26 18:14:49 +0100 |
|---|---|---|
| committer | StevenWdV <stevenwdv@gmail.com> | 2021-11-26 18:14:49 +0100 |
| commit | c5c71a584b5e5fd2fdf59477ea7ec1e4ddddda25 (patch) | |
| tree | 3a1b28e68365c45a3a9be38e7432529898e96d80 | |
| parent | 96dca850f8e80ae7608a008dbbe4e76df4991ca0 (diff) | |
Add requirements & MinGW instructions to READMEs. Change OS/ARCH to GOOS/GOARCH. Add build step to Python test Makefile.
| -rw-r--r-- | README.md | 38 | ||||
| -rw-r--r-- | exports/Makefile | 12 | ||||
| -rw-r--r-- | wrappers/csharp/README.md | 20 | ||||
| -rw-r--r-- | wrappers/python/Makefile | 1 | ||||
| -rw-r--r-- | wrappers/python/README.md | 8 |
5 files changed, 68 insertions, 11 deletions
@@ -11,31 +11,63 @@ each language used in EduVPN clients to easily interface with the library. Currently, only verification of signatures on files from `disco.eduvpn.org` is supported. For now, these files have to be downloaded by the caller. +## Requirements + +To run the Go tests, you will need [Go](https://go.dev/doc/install) 1.15 or later (add it to your `PATH`). To build the +shared library, you will additionally need to install gcc. If you want to use the Makefile scripts you will need GNU +make. + +On Windows, you can install gcc and make (or even Go) via MinGW or Cygwin or use WSL. For MinGW: + +1. [Install MinGW](https://www.msys2.org/#installation) (you don't need to install any extra packages yet) and open some + MSYS2 terminal (e.g. from the start menu or one of the installed binaries) +2. Install the [`make`](https://packages.msys2.org/package/make?repo=msys) package (`pacman -S make`) (or + e.g. [`mingw-w64-x86_64-make`](https://packages.msys2.org/package/mingw-w64-x86_64-make?repo=mingw64) and + use `mingw32-make` in the command line) +3. To compile for x86_64: + 1. Install the [`mingw-w64-x86_64-gcc`](https://packages.msys2.org/package/mingw-w64-x86_64-gcc?repo=mingw64) package + 2. Open the MinGW 64-bit console, via the start menu, or in your current + terminal: `path/to/msys64/msys2_shell.cmd -mingw64 -defterm -no-start -use-full-path` + 3. Run the make commands in the project directory +4. To compile for x86 (32-bit): + 1. Install the [`mingw-w64-i686-gcc`](https://packages.msys2.org/package/mingw-w64-i686-gcc?repo=mingw32) package + 2. Open the MinGW 32-bit console, via the start menu, or in your current + terminal: `path/to/msys64/msys2_shell.cmd -mingw32 -defterm -no-start -use-full-path` + 3. Run the make commands in the project directory + +Take a look at `wrappers/<lang>/README.md` for extra instructions for each wrapper. + ## Build & test Build shared library for current platform: + ```shell make ``` Build shared library for specified OS & architecture (example): + ```shell -make OS=windows ARCH=386 +make GOOS=windows GOARCH=386 ``` Results will be output in `exports/`. +TODO: notes on cross-compilation + Test Go code: + ```shell make test-go ``` -Test wrappers: +Test wrappers (you will need compilers for all wrappers if you do this): + ```shell make test-wrappers ``` -Take a look at `wrappers/<lang>/` for descriptions per wrapper. +Take a look at `wrappers/<lang>/README.md` for descriptions per wrapper. ## Directory diff --git a/exports/Makefile b/exports/Makefile index 912e930..fdedba2 100644 --- a/exports/Makefile +++ b/exports/Makefile @@ -4,15 +4,15 @@ lib_suffix_linux = .so lib_suffix_windows = .dll lib_suffix_darwin = .dylib -OS = $(shell go env GOHOSTOS) -ARCH = $(shell go env GOHOSTARCH) -LIB_SUFFIX = $(lib_suffix_$(OS)) +GOOS ?= $(shell go env GOHOSTOS) +GOARCH ?= $(shell go env GOHOSTARCH) +LIB_SUFFIX = $(lib_suffix_$(GOOS)) # Creates targets like 'linux/amd64/eduvpn_verify.so' -build: $(OS)/$(ARCH)/eduvpn_verify$(LIB_SUFFIX) +build: $(GOOS)/$(GOARCH)/eduvpn_verify$(LIB_SUFFIX) -$(OS)/$(ARCH)/eduvpn_verify$(LIB_SUFFIX): exports.go ../verify.go - CGO_ENABLED=1 GOOS=$(OS) GOARCH=$(ARCH) go build -o $@ -buildmode=c-shared $< +$(GOOS)/$(GOARCH)/eduvpn_verify$(LIB_SUFFIX): exports.go ../verify.go + CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $@ -buildmode=c-shared $< clean: rm -rf ../exports/*/ diff --git a/wrappers/csharp/README.md b/wrappers/csharp/README.md index 4b045ac..d4d1d97 100644 --- a/wrappers/csharp/README.md +++ b/wrappers/csharp/README.md @@ -1,21 +1,37 @@ +# C# wrapper + +## Requirements + +You will need to install the [.NET SDK](https://dotnet.microsoft.com/download), which includes the `dotnet` tool. The +wrapper targets .NET Standard 2.0, so which means that at least .NET Core 2.0 is required (.NET 5+ is also fine). For +the tests, .NET 5 or newer is required. + +## Build & test + First build the shared Go library. Next: Build `EduVpnCommon`: + ```shell make ``` Build as nupkg, including eduvpn_verify library: + ```shell make pack ``` -Currently, directly referencing the project may not work if you have multiple dynamic libraries compiled in -the `exports` folder. If you instead add the `.nupkg`, e.g. with one of the +The wrapper targets .NET Standard 2.0, which means that it can be referenced by projects using either .NET Framework +4.6.1+, .NET Core 2.0+, or .NET 5+. + +Currently, directly referencing the project may not work (with `System.BadImageFormatException`) if you have multiple +dynamic libraries compiled in the `exports` folder. If you instead add the `.nupkg`, e.g. with one of the methods [here](https://stackoverflow.com/q/43400069) or [here](https://stackoverflow.com/q/10240029), it automatically copies the correct library. Test: + ```shell make test ``` diff --git a/wrappers/python/Makefile b/wrappers/python/Makefile index 162b043..77c620e 100644 --- a/wrappers/python/Makefile +++ b/wrappers/python/Makefile @@ -4,4 +4,5 @@ compile: python3 -m discovery test: + $(MAKE) -C ../../exports python3 -m unittest test_discovery diff --git a/wrappers/python/README.md b/wrappers/python/README.md index f10e5ad..fddcde6 100644 --- a/wrappers/python/README.md +++ b/wrappers/python/README.md @@ -1,3 +1,11 @@ +# Python wrapper + +## Requirements + +Python 3.6+ is assumed, but it may work with older versions. + +## Test + First build the shared Go library. Next: No dependencies, just reference `discovery.py` and call `verify`. |
