summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStevenWdV <stevenwdv@gmail.com>2021-11-29 01:20:06 +0100
committerStevenWdV <stevenwdv@gmail.com>2021-11-29 01:26:47 +0100
commite4744fd94236944569bfed27af80a604b7668e4b (patch)
treee360330d55706513395a27e6c85c7cdfca92ee68
parent4a293e0bba1f4c7f1069e5ea40fd0947185aaeea (diff)
Fix Java wrapper on Unix (append 'lib' prefix to library)
-rw-r--r--exports/Makefile9
-rw-r--r--wrappers/csharp/EduVpnCommon.csproj26
-rw-r--r--wrappers/python/discovery.py11
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'))">
<Message Text="Shared eduvpn_verify library not found, you should build that one first" Importance="high" />
</Target>
<ItemGroup>
<None Remove="EduVpnCommonTests/**" />
-
+
+ <!--
+ See https://docs.microsoft.com/en-us/nuget/create-packages/supporting-multiple-target-frameworks#architecture-specific-folders
+ and https://docs.microsoft.com/en-us/dotnet/core/rid-catalog
+ -->
+
<None Condition="Exists('../../exports/windows/amd64/eduvpn_verify.dll')"
Include="../../exports/windows/amd64/eduvpn_verify.dll" Pack="true" PackagePath="runtimes/win-x64/native/">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
@@ -49,16 +54,17 @@
Include="../../exports/windows/arm64/eduvpn_verify.dll" Pack="true" PackagePath="runtimes/win-arm64/native/">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
- <None Condition="Exists('../../exports/linux/amd64/eduvpn_verify.so')"
- Include="../../exports/linux/amd64/eduvpn_verify.so" Pack="true" PackagePath="runtimes/linux-x64/native/">
+
+ <None Condition="Exists('../../exports/linux/amd64/libeduvpn_verify.so')"
+ Include="../../exports/linux/amd64/libeduvpn_verify.so" Pack="true" PackagePath="runtimes/linux-x64/native/">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
- <None Condition="Exists('../../exports/linux/arm/eduvpn_verify.so')"
- Include="../../exports/linux/arm/eduvpn_verify.so" Pack="true" PackagePath="runtimes/linux-arm/native/">
+ <None Condition="Exists('../../exports/linux/arm/libeduvpn_verify.so')"
+ Include="../../exports/linux/arm/libeduvpn_verify.so" Pack="true" PackagePath="runtimes/linux-arm/native/">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
- <None Condition="Exists('../../exports/linux/arm64/eduvpn_verify.so')"
- Include="../../exports/linux/arm64/eduvpn_verify.so" Pack="true" PackagePath="runtimes/linux-arm64/native/">
+ <None Condition="Exists('../../exports/linux/arm64/libeduvpn_verify.so')"
+ Include="../../exports/linux/arm64/libeduvpn_verify.so" Pack="true" PackagePath="runtimes/linux-arm64/native/">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
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".