summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi/Makefile
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-03-22 16:21:03 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-03-22 16:21:03 +0100
commitc36dbe6eb447239824f0014ec6beae2df9f42a7c (patch)
tree62c0655c362b82b340f3084bee1d0a9ccdab8a8a /openpgp-ffi/Makefile
parent6a9e2743d149fecd5d7706b273dc69a45fe25ea2 (diff)
Fix build on macOS.
- Use GNU install, use the correct extension for dynamic libraries. - Fixes #226.
Diffstat (limited to 'openpgp-ffi/Makefile')
-rw-r--r--openpgp-ffi/Makefile27
1 files changed, 19 insertions, 8 deletions
diff --git a/openpgp-ffi/Makefile b/openpgp-ffi/Makefile
index d0d84bdd..bbf49329 100644
--- a/openpgp-ffi/Makefile
+++ b/openpgp-ffi/Makefile
@@ -12,8 +12,19 @@ CARGO_TARGET_DIR := $(abspath $(CARGO_TARGET_DIR))
VERSION ?= $(shell grep '^version[[:space:]]*=[[:space:]]*' Cargo.toml | cut -d'"' -f2)
VERSION_MAJOR = $(shell echo $(VERSION) | cut -d'.' -f1)
+# Build the right library
+ifeq ($(shell uname -s), Darwin)
+ _SEQ_LIB_EXT = dylib
+else
+ _SEQ_LIB_EXT = so
+endif
+
# Tools.
-INSTALL ?= install
+ifeq ($(shell uname -s), Darwin)
+ INSTALL ?= ginstall
+else
+ INSTALL ?= install
+endif
# Make sure subprocesses pick these up.
export PREFIX
@@ -46,7 +57,7 @@ test check: check-headers
.PHONY: check-headers
check-headers: force-build
nm -g --defined-only \
- $(CARGO_TARGET_DIR)/debug/libsequoia_openpgp_ffi.so \
+ $(CARGO_TARGET_DIR)/debug/libsequoia_openpgp_ffi.$(_SEQ_LIB_EXT) \
| cut -d' ' -f3 | sort -u | grep pgp_ \
| while read SYM ; \
do git grep -q "$$SYM" include || echo $$SYM ; \
@@ -71,12 +82,12 @@ install:
$(INSTALL) -t $(DESTDIR)$(PREFIX)/include/sequoia \
include/sequoia/*.h
$(INSTALL) -d $(DESTDIR)$(PREFIX)/lib
- $(INSTALL) $(CARGO_TARGET_DIR)/release/libsequoia_openpgp_ffi.so \
- $(DESTDIR)$(PREFIX)/lib/libsequoia_openpgp_ffi.so.$(VERSION)
- ln -fs libsequoia_openpgp_ffi.so.$(VERSION) \
- $(DESTDIR)$(PREFIX)/lib/libsequoia_openpgp_ffi.so.$(VERSION_MAJOR)
- ln -fs libsequoia_openpgp_ffi.so.$(VERSION) \
- $(DESTDIR)$(PREFIX)/lib/libsequoia_openpgp_ffi.so
+ $(INSTALL) $(CARGO_TARGET_DIR)/release/libsequoia_openpgp_ffi.$(_SEQ_LIB_EXT) \
+ $(DESTDIR)$(PREFIX)/lib/libsequoia_openpgp_ffi.$(_SEQ_LIB_EXT).$(VERSION)
+ ln -fs libsequoia_openpgp_ffi.$(_SEQ_LIB_EXT).$(VERSION) \
+ $(DESTDIR)$(PREFIX)/lib/libsequoia_openpgp_ffi.$(_SEQ_LIB_EXT).$(VERSION_MAJOR)
+ ln -fs libsequoia_openpgp_ffi.$(_SEQ_LIB_EXT).$(VERSION) \
+ $(DESTDIR)$(PREFIX)/lib/libsequoia_openpgp_ffi.$(_SEQ_LIB_EXT)
$(INSTALL) $(CARGO_TARGET_DIR)/release/libsequoia_openpgp_ffi.a \
$(DESTDIR)$(PREFIX)/lib/libsequoia_openpgp_ffi.a