summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi/Makefile
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2021-12-10 13:02:52 +0100
committerJustus Winter <justus@sequoia-pgp.org>2021-12-10 13:02:52 +0100
commitcf4c70b46040a53bf3992a124ba70b1b1ca852f1 (patch)
treec321c5f549dc2d69519bd68bf540f78e7a294735 /openpgp-ffi/Makefile
parent34b930595f7e125cbbad64404c79de454c6e62ef (diff)
Remove the ffi crates.
- Remove the general-purpose ffi crates. They will be moved into their own repository. Note that we consider general-purpose ffi crates to be a dead end: exposing Sequoia's interface requires a large number of types and functions, and using the interface from C turned out to be verbose and error-prone. Instead, we prefer to write point solutions in Rust that implement exactly the functionality the downstream consumer needs, then expose this via ffi bindings. - See https://gitlab.com/sequoia-pgp/sequoia-ffi.
Diffstat (limited to 'openpgp-ffi/Makefile')
-rw-r--r--openpgp-ffi/Makefile102
1 files changed, 0 insertions, 102 deletions
diff --git a/openpgp-ffi/Makefile b/openpgp-ffi/Makefile
deleted file mode 100644
index 6bb37c3d..00000000
--- a/openpgp-ffi/Makefile
+++ /dev/null
@@ -1,102 +0,0 @@
-# Makefile for Sequoia's bindings.
-
-# Configuration.
-PREFIX ?= /usr/local
-DESTDIR ?=
-
-CARGO ?= cargo
-CARGO_TARGET_DIR ?= $(shell pwd)/../target
-# We currently only support absolute paths.
-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.
-ifneq ($(filter Darwin %BSD,$(shell uname -s)),)
- INSTALL ?= ginstall
-else
- INSTALL ?= install
-endif
-
-# Make sure subprocesses pick these up.
-export PREFIX
-export DESTDIR
-
-# $(1) = install dir
-# $(2) = whether to set libdir and prefix to $(1) (empty string = false)
-sequoia_openpgp_pc = \
- sed -e 's|VERSION|$(VERSION)|g' \
- $(if $(2),-e 's|PREFIX|$(shell pwd)|g',-e's|PREFIX|$(PREFIX)|g') \
- $(if $(2),-e 's|libdir=.*|libdir=$(1)|g') \
- sequoia-openpgp.pc.in \
- > $(1)/sequoia-openpgp.pc
-
-all: build
-
-.PHONY: build
-build:
- $(call sequoia_openpgp_pc,$(CARGO_TARGET_DIR)/debug,true)
-
-.PHONY: force-build
-force-build:
- cd .. ; cargo build -p sequoia-openpgp-ffi
-
-# Testing and examples.
-.PHONY: test check
-test check: check-headers
-
-# Header files.
-.PHONY: check-headers
-check-headers: force-build
- nm -g --defined-only \
- $(CARGO_TARGET_DIR)/debug/libsequoia_openpgp_ffi.$(_SEQ_LIB_EXT) \
- | cut -d' ' -f3 | sed s/^_// | sort -u | grep pgp_ \
- | while read SYM ; \
- do grep -r -q "$$SYM" include || echo $$SYM ; \
- done | tee $(CARGO_TARGET_DIR)/debug/.check-headers ; \
- ! test -s $(CARGO_TARGET_DIR)/debug/.check-headers
-
-.PHONY: examples
-examples:
- $(MAKE) -Cexamples --always-make
-
-# Installation.
-.PHONY: build-release
-build-release:
- CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) \
- $(CARGO) build $(CARGO_FLAGS) --release --package sequoia-openpgp-ffi
- $(call sequoia_openpgp_pc,$(CARGO_TARGET_DIR)/release,true)
-
-.PHONY: install
-install: build-release
- $(INSTALL) -d $(DESTDIR)$(PREFIX)/share/pkgconfig
- $(call sequoia_openpgp_pc,$(DESTDIR)$(PREFIX)/share/pkgconfig,)
- $(INSTALL) -d $(DESTDIR)$(PREFIX)/include
- $(INSTALL) -d $(DESTDIR)$(PREFIX)/include/sequoia
- $(INSTALL) -t $(DESTDIR)$(PREFIX)/include/sequoia \
- include/sequoia/*.h
- $(INSTALL) -d $(DESTDIR)$(PREFIX)/include/sequoia/openpgp
- $(INSTALL) -t $(DESTDIR)$(PREFIX)/include/sequoia/openpgp \
- include/sequoia/openpgp/*.h
- $(INSTALL) -d $(DESTDIR)$(PREFIX)/lib
- $(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
-
-# Housekeeping.
-.PHONY: clean
-clean:
- $(MAKE) -Cexamples clean