|
| 1 | +# See LICENSE for licensing information. |
| 2 | + |
| 3 | +PROJECT = corral |
| 4 | +PROJECT_DESCRIPTION = QUIC backends for Erlang/OTP. |
| 5 | +PROJECT_VERSION = 0.1.0 |
| 6 | + |
| 7 | +# Dependencies. |
| 8 | + |
| 9 | +LOCAL_DEPS = public_key |
| 10 | + |
| 11 | +# @todo Make sure it still works if using CORRAL_DEPS=quicer or with both. |
| 12 | +# @todo And then remove quicer by default? |
| 13 | +CORRAL_DEPS ?= quic quicer |
| 14 | +export CORRAL_DEPS |
| 15 | + |
| 16 | +DEPS = $(CORRAL_DEPS) |
| 17 | +TEST_DEPS = quic |
| 18 | + |
| 19 | +dep_quic = git https://github.com/essen/erlang_quic corral |
| 20 | +dep_quicer = git https://github.com/emqx/quic main |
| 21 | + |
| 22 | +TEST_DEPS = ct_helper |
| 23 | +dep_ct_helper = git https://github.com/ninenines/ct_helper master |
| 24 | + |
| 25 | +# CI configuration. |
| 26 | + |
| 27 | +dep_ci.erlang.mk = git https://github.com/ninenines/ci.erlang.mk master |
| 28 | +DEP_EARLY_PLUGINS = ci.erlang.mk |
| 29 | + |
| 30 | +AUTO_CI_OTP ?= OTP-LATEST-26+ |
| 31 | +AUTO_CI_WINDOWS ?= OTP-LATEST-26+ |
| 32 | + |
| 33 | +include erlang.mk |
| 34 | + |
| 35 | +# Conditional backend macros. |
| 36 | + |
| 37 | +ifeq ($(filter quic,$(CORRAL_DEPS)),quic) |
| 38 | +ERLC_OPTS += -D BACKEND_ERLANG_QUIC=1 |
| 39 | +TEST_ERLC_OPTS += -D BACKEND_ERLANG_QUIC=1 |
| 40 | +endif |
| 41 | + |
| 42 | +ifeq ($(filter quicer,$(CORRAL_DEPS)),quicer) |
| 43 | +ERLC_OPTS += -D BACKEND_QUICER=1 |
| 44 | +TEST_ERLC_OPTS += -D BACKEND_QUICER=1 |
| 45 | +endif |
| 46 | + |
| 47 | +# Fix quicer compilation. |
| 48 | + |
| 49 | +autopatch-quicer:: |
| 50 | + $(verbose) printf "%s\n" "all: ;" > $(DEPS_DIR)/quicer/c_src/Makefile.erlang.mk |
| 51 | + |
| 52 | +# Generate certificates for testing. |
| 53 | + |
| 54 | +$(ERLANG_MK_TMP)/certs: |
| 55 | + $(verbose) mkdir -p $@ |
| 56 | +# Server. |
| 57 | + $(gen_verbose) openssl req -x509 -nodes \ |
| 58 | + -days 365 \ |
| 59 | + -newkey ec -pkeyopt ec_paramgen_curve:P-256 \ |
| 60 | + -subj "/CN=localhost" \ |
| 61 | + -addext "subjectAltName = DNS:localhost, IP:127.0.0.1" \ |
| 62 | + -keyout $@/server.key \ |
| 63 | + -out $@/server.crt \ |
| 64 | + 2>/dev/null |
| 65 | +# Client CA. |
| 66 | + $(verbose) openssl genrsa -out $@/ca.key 4096 |
| 67 | + $(verbose) openssl req -x509 -new -nodes -days 3650 \ |
| 68 | + -key $@/ca.key \ |
| 69 | + -subj "/CN=Test CA" \ |
| 70 | + -out $@/ca.crt |
| 71 | +# Client. |
| 72 | + $(verbose) openssl req -new -nodes \ |
| 73 | + -newkey ec -pkeyopt ec_paramgen_curve:P-256 \ |
| 74 | + -subj "/CN=client" \ |
| 75 | + -addext "subjectAltName = DNS:client" \ |
| 76 | + -addext "extendedKeyUsage = clientAuth" \ |
| 77 | + -keyout $@/client.key \ |
| 78 | + -out $@/client.csr \ |
| 79 | + 2>/dev/null |
| 80 | + $(verbose) openssl x509 -req -days 365 \ |
| 81 | + -in $@/client.csr \ |
| 82 | + -CA $@/ca.crt \ |
| 83 | + -CAkey $@/ca.key \ |
| 84 | + -CAcreateserial \ |
| 85 | + -out $@/client.crt \ |
| 86 | + -extfile <(printf "subjectAltName = DNS:client\nextendedKeyUsage = clientAuth") \ |
| 87 | + 2>/dev/null |
| 88 | + |
| 89 | +test-build:: $(ERLANG_MK_TMP)/certs |
0 commit comments