From e4744fd94236944569bfed27af80a604b7668e4b Mon Sep 17 00:00:00 2001 From: StevenWdV Date: Mon, 29 Nov 2021 01:20:06 +0100 Subject: Fix Java wrapper on Unix (append 'lib' prefix to library) --- exports/Makefile | 9 +++++++-- wrappers/csharp/EduVpnCommon.csproj | 26 ++++++++++++++++---------- wrappers/python/discovery.py | 11 ++++++++++- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/exports/Makefile b/exports/Makefile index fdedba2..801692b 100644 --- a/exports/Makefile +++ b/exports/Makefile @@ -1,17 +1,22 @@ .PHONY: build clean +lib_prefix_linux = lib +lib_prefix_windows = +lib_prefix_darwin = lib + lib_suffix_linux = .so lib_suffix_windows = .dll lib_suffix_darwin = .dylib GOOS ?= $(shell go env GOHOSTOS) GOARCH ?= $(shell go env GOHOSTARCH) +LIB_PREFIX = $(lib_prefix_$(GOOS)) LIB_SUFFIX = $(lib_suffix_$(GOOS)) # Creates targets like 'linux/amd64/eduvpn_verify.so' -build: $(GOOS)/$(GOARCH)/eduvpn_verify$(LIB_SUFFIX) +build: $(GOOS)/$(GOARCH)/$(LIB_PREFIX)eduvpn_verify$(LIB_SUFFIX) -$(GOOS)/$(GOARCH)/eduvpn_verify$(LIB_SUFFIX): exports.go ../verify.go +$(GOOS)/$(GOARCH)/$(LIB_PREFIX)eduvpn_verify$(LIB_SUFFIX): exports.go ../verify.go CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $@ -buildmode=c-shared $< clean: diff --git a/wrappers/csharp/EduVpnCommon.csproj b/wrappers/csharp/EduVpnCommon.csproj index 04df7f0..4643da2 100644 --- a/wrappers/csharp/EduVpnCommon.csproj +++ b/wrappers/csharp/EduVpnCommon.csproj @@ -24,15 +24,20 @@ Or Exists('../../exports/windows/386/eduvpn_verify.dll') Or Exists('../../exports/windows/arm/eduvpn_verify.dll') Or Exists('../../exports/windows/arm64/eduvpn_verify.dll') - Or Exists('../../exports/linux/amd64/eduvpn_verify.so') - Or Exists('../../exports/linux/arm/eduvpn_verify.so') - Or Exists('../../exports/linux/arm64/eduvpn_verify.so'))"> + Or Exists('../../exports/linux/amd64/libeduvpn_verify.so') + Or Exists('../../exports/linux/arm/libeduvpn_verify.so') + Or Exists('../../exports/linux/arm64/libeduvpn_verify.so'))"> - + + + Always @@ -49,16 +54,17 @@ Include="../../exports/windows/arm64/eduvpn_verify.dll" Pack="true" PackagePath="runtimes/win-arm64/native/"> Always - + + Always - + Always - + Always diff --git a/wrappers/python/discovery.py b/wrappers/python/discovery.py index 21118a9..b22c82e 100644 --- a/wrappers/python/discovery.py +++ b/wrappers/python/discovery.py @@ -2,6 +2,14 @@ import platform from ctypes import * from enum import Enum +# TODO OpenBSD? + +_lib_prefixes = { + "windows": "", + "linux": "lib", + "darwin": "lib", +} + _lib_suffixes = { "windows": ".dll", "linux": ".so", @@ -26,7 +34,7 @@ _arch = \ _os = platform.system().lower() -_lib = cdll.LoadLibrary(f"../../exports/{_os}/{_arch}/eduvpn_verify{_lib_suffixes[_os]}") +_lib = cdll.LoadLibrary(f"../../exports/{_os}/{_arch}/{_lib_prefixes[_os]}eduvpn_verify{_lib_suffixes[_os]}") class GoSlice(Structure): @@ -74,6 +82,7 @@ def verify(signature: bytes, signed_json: bytes, expected_file_name: str, min_si """ Verifies the signature on the JSON server_list.json/organization_list.json file. If the function returns the signature is valid for the given file type. + :param signature: .minisig signature file contents. :param signed_json: Signed .json file contents. :param expected_file_name: The file type to be verified, one of "server_list.json" or "organization_list.json". -- cgit v1.2.3