From a79995670baf0ae755cbbe78c5d77fc49575d342 Mon Sep 17 00:00:00 2001 From: StevenWdV Date: Fri, 17 Dec 2021 16:39:51 +0100 Subject: Fix PHP wrapper on Unix, extract common platform detection logic --- exports/platform.mk | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 exports/platform.mk (limited to 'exports/platform.mk') diff --git a/exports/platform.mk b/exports/platform.mk new file mode 100644 index 0000000..60f47ee --- /dev/null +++ b/exports/platform.mk @@ -0,0 +1,23 @@ +ifndef GOOS +export GOOS != go env GOHOSTOS +endif +ifndef GOARCH +export GOARCH != go env GOHOSTARCH +endif + +ifeq (windows,$(GOOS)) +LIB_PREFIX = +LIB_SUFFIX = .dll +else ifeq (darwin,$(GOOS)) +LIB_PREFIX = lib +LIB_SUFFIX = .dylib +else +LIB_PREFIX = lib +LIB_SUFFIX = .so +endif + +ifeq (Windows_NT,$(OS)) +export PATH := $(abspath ../../exports/$(GOOS)/$(GOARCH)):$(PATH) +else +export LD_LIBRARY_PATH := $(abspath ../../exports/$(GOOS)/$(GOARCH)):$(LD_LIBRARY_PATH) +endif -- cgit v1.2.3