*~
/target
/local.conf
......@@ -60,6 +60,24 @@ bookworm:
CARGO_HOME: /cargo
after_script: []
makefile:
tags:
- linux
stage: build
image: registry.gitlab.com/sequoia-pgp/build-docker-image/bookworm-prebuild:latest
needs:
- codespell
script:
- make build
- make test
- make clean
- DEBUG=debug make test
variables:
BUILD: /target
CARGO_HOME: /cargo
CARGO_TARGET_DIR:
after_script: []
all_commits:
# Test each commit up to main, to facilitate bisecting.
stage: test
......
Makefile 0 → 100644
# Copyright 2023, pEp Foundation
# This file is part of pEpEngineSequoiaBackend
# This file may be used under the terms of the GNU General Public License version 3
# see COPYING
# Build config defaults
DEBUG?=debug
PREFIX?=/usr/local
CARGO?=cargo
BUILD?=_build
# Build config overrides
-include ./local.conf
# Make sure CARGO_TARGET_DIR is not set by the user -- it would be ignored.
CARGO_TARGET_DIR?=
ifneq ($(CARGO_TARGET_DIR),)
$(error "the user should not set 'CARGO_TARGET_DIR': 'BUILD' can be used \
instead.")
endif
#export as env var to sub-shells
export CARGO_TARGET_DIR=$(BUILD)
# constants
LIB_NAME=libpep_engine_sequoia_backend
# determine library file extension
PLATFORM:=$(shell uname)
ifeq ($(PLATFORM),Linux)
DYNLIB_EXT=so
else ifeq ($(PLATFORM),Darwin)
DYNLIB_EXT=dylib
else
$(error "Dont know how to build for '$(PLATFORM)'")
endif
# DEBUG can be defined as "release", "debug" or "maintainer".
ifeq ($(DEBUG),maintainer) # For compatibility with other pEp repos.
VARIANT_NAME=debug
VARIANT_FLAGS=
else ifeq ($(DEBUG),debug)
VARIANT_NAME=debug
VARIANT_FLAGS=
else ifeq ($(DEBUG),release)
VARIANT_NAME=release
VARIANT_FLAGS=--release
else
$(error "build option 'DEBUG' must be 'release', 'debug' or 'maintainer'")
endif
LIB_DYNAMIC_PATH=$(CARGO_TARGET_DIR)/$(VARIANT_NAME)/$(LIB_NAME).$(DYNLIB_EXT)
LIB_STATIC_PATH=$(CARGO_TARGET_DIR)/$(VARIANT_NAME)/$(LIB_NAME).a
PKGCONFIG_PATH=$(CARGO_TARGET_DIR)/$(VARIANT_NAME)/pep_engine_sequoia_backend.pc
LIB_DIR=$(PREFIX)/lib/
PKGCONFIG_DIR=$(PREFIX)/share/pkgconfig/
CARGO_FLAGS+=$(VARIANT_FLAGS)
ifneq ($(filter Darwin %BSD,$(shell uname -s)),)
INSTALL?=ginstall
else
INSTALL?=install
endif
.PHONY: all build install uninstall test clean
all: build
build:
$(CARGO) build $(CARGO_FLAGS)
install: build
mkdir -p $(LIB_DIR) $(PKGCONFIG_DIR)
$(INSTALL) $(LIB_DYNAMIC_PATH) $(LIB_DIR)
$(INSTALL) $(LIB_STATIC_PATH) $(LIB_DIR)
$(INSTALL) $(PKGCONFIG_PATH) $(PKGCONFIG_DIR)
uninstall:
rm -f $(LIB_DIR)/$(LIB_NAME).$(DYNLIB_EXT)
rm -f $(LIB_DIR)/$(LIB_NAME).a
rm -f $(PKGCONFIG_DIR)/pep_engine_sequoia_backend.pc
test:
$(CARGO) test $(CARGO_FLAGS)
clean:
$(CARGO) clean
# This is an Example build config (local.conf)
# The values here reflect the defaults.
# If needed, copy this file into a file called
# `local.conf` and adjust the values
# The dir where the build artifacts get installed into
# PREFIX=/usr/local
# Build variant: one of release , debug , maintainer (maintainer exists for
# compatibility with other pEp projects: in this project maintainer and debug
# builds are the same). The default is debug .
# DEBUG=release
# Defines the build dir. This can be a relative or an absolute path.
# BUILD=_build