From b96c91570389a9eee43eb1e9edf01f63207ee25f Mon Sep 17 00:00:00 2001 From: Tristan Date: Tue, 7 Jun 2022 04:06:13 +0100 Subject: [PATCH] Cleanup makefiles and curl calls --- .gitlab-ci.yml | 12 ++++++------ README.md | 12 ++++++++---- deps/lua/Makefile | 16 ++++++++-------- deps/pcre2/Makefile | 14 +++++++------- deps/quictls/Makefile | 16 ++++++++-------- haproxy/Makefile | 28 ++++++++++++++++++---------- 6 files changed, 55 insertions(+), 43 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bc5bda8..a2f0dee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -124,14 +124,14 @@ pkg:quictls: artifacts: true script: | set -eu - + PKG_VER=1.1.1o if [ "$CI_COMMIT_REF_NAME" != "$CI_DEFAULT_BRANCH" ]; then export PKG_VER="branch-$CI_COMMIT_REF_SLUG" echo "Git reference $CI_COMMIT_REF_NAME is not the default branch. Setting version to $PKG_VER" fi - - curl -sS \ + + curl -fsSL \ -H"JOB-TOKEN: $CI_JOB_TOKEN" \ --upload-file "deps/quictls/quictls-dist.tar.gz" \ "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/quictls/$PKG_VER/quictls.tar.gz" @@ -146,14 +146,14 @@ pkg:haproxy: artifacts: true script: | set -eu - + PKG_VER=2.6.0 if [ "$CI_COMMIT_REF_NAME" != "$CI_DEFAULT_BRANCH" ]; then export PKG_VER="branch-$CI_COMMIT_REF_SLUG" echo "Git reference $CI_COMMIT_REF_NAME is not the default branch. Setting version to $PKG_VER" fi - - curl -sS \ + + curl -fsSL \ -H"JOB-TOKEN: $CI_JOB_TOKEN" \ --upload-file "haproxy/haproxy-dist.tar.gz" \ "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/haproxy/$PKG_VER/haproxy.tar.gz" diff --git a/README.md b/README.md index dbe30b8..10829cd 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,12 @@ Build scripts for HAProxy with QUIC -**PROJECT STATUS: Alpha, __not exhaustively tested yet__** +**PROJECT STATUS: ALPHA**. Seriously, it has __not__ been well tested yet + +[__TOC__] ## Quickstart -**NOTE FOR QUIC:** docker and docker-compose require explicit UDP protocol port -mapping, otherwise they assume only-TCP. See below. - ```shell docker run -it \ -v /path/to/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro \ @@ -18,6 +17,11 @@ docker run -it \ registry.gitlab.com/mangadex-pub/haproxy:2.6-bullseye ``` +## HTTP/3 and QUIC + +**NOTE FOR QUIC:** docker and docker-compose require explicit UDP protocol port +mapping, otherwise they assume only-TCP. See the explicit port-mapping above. + Here's a sample configuration (requires you to figure out the certificate) to test HTTP/3.0 support. The first connection should be over HTTP/1.1 or HTTP/2, and diff --git a/deps/lua/Makefile b/deps/lua/Makefile index c204b1e..47ced91 100644 --- a/deps/lua/Makefile +++ b/deps/lua/Makefile @@ -6,16 +6,16 @@ LUA_DESTDIR = dist LUA_DESTDIR_ABS = $(shell realpath $(LUA_DESTDIR)) LUA_ARCHIVE = lua-dist.tar.gz -all: $(LUA_BUILDIR) $(LUA_DESTDIR) $(LUA_ARCHIVE) +all: build $(LUA_DESTDIR) $(LUA_ARCHIVE) -$(LUA_BUILDIR): +$(LUA_TARBALL): + curl -fsSL -o "$(LUA_TARBALL)" "$(LUA_SOURCES)" + +$(LUA_BUILDIR): $(LUA_TARBALL) @if ! [ -d "$(LUA_BUILDIR)" ]; then mkdir -v "$(LUA_BUILDIR)"; fi - -$(LUA_BUILDIR)/lua-$(LUA_VERSION).tar.gz: $(LUA_BUILDIR) - curl -sSL -o "$(LUA_TARBALL)" "$(LUA_SOURCES)" - -build: $(LUA_BUILDIR)/lua-$(LUA_VERSION).tar.gz tar -C $(LUA_BUILDIR) --strip-components=1 -xf "$(LUA_TARBALL)" + +build: $(LUA_BUILDIR) $(MAKE) -C $(LUA_BUILDIR) -j$(shell nproc) linux $(LUA_DESTDIR): build @@ -26,9 +26,9 @@ $(LUA_ARCHIVE): $(LUA_DESTDIR) tar -C "$(LUA_DESTDIR)" -cjf "$(LUA_ARCHIVE)" $$(ls -1 $(LUA_DESTDIR)) clean: + rm -fv "$(LUA_TARBALL)" rm -rf "$(LUA_BUILDIR)" rm -rf "$(LUA_DESTDIR)" - rm -fv "$(LUA_TARBALL)" rm -fv "$(LUA_ARCHIVE)" .PHONY: clean build diff --git a/deps/pcre2/Makefile b/deps/pcre2/Makefile index 0978abf..ca87186 100644 --- a/deps/pcre2/Makefile +++ b/deps/pcre2/Makefile @@ -8,14 +8,14 @@ PCRE2_ARCHIVE = pcre2-dist.tar.gz all: build $(PCRE2_DESTDIR) $(PCRE2_ARCHIVE) -$(PCRE2_BUILDIR): +$(PCRE2_TARBALL): + curl -fsSL -o "$(PCRE2_TARBALL)" "$(PCRE2_SOURCES)" + +$(PCRE2_BUILDIR): $(PCRE2_TARBALL) @if ! [ -d "$(PCRE2_BUILDIR)" ]; then mkdir -v "$(PCRE2_BUILDIR)"; fi - -$(PCRE2_BUILDIR)/pcre2-$(PCRE2_VERSION).tar.gz: $(PCRE2_BUILDIR) - curl -sSL -o "$(PCRE2_TARBALL)" "$(PCRE2_SOURCES)" - -build: $(PCRE2_BUILDIR)/pcre2-$(PCRE2_VERSION).tar.gz tar -C $(PCRE2_BUILDIR) --strip-components=1 -xf "$(PCRE2_TARBALL)" + +build: $(PCRE2_BUILDIR) if [ -f "$(PCRE2_BUILDIR)/CmakeCache.txt" ]; then rm -v "$(PCRE2_BUILDIR)/CmakeCache.txt"; fi cd "$(PCRE2_BUILDIR)" && cmake -DPCRE2_STATIC_PIC=ON -DPCRE2_SUPPORT_JIT=ON -DCMAKE_INSTALL_PREFIX="$(PCRE2_DESTDIR_ABS)" . && make @@ -27,9 +27,9 @@ $(PCRE2_ARCHIVE): $(PCRE2_DESTDIR) tar -C "$(PCRE2_DESTDIR)" -cjf "$(PCRE2_ARCHIVE)" $$(ls -1 $(PCRE2_DESTDIR)) clean: + rm -fv "$(PCRE2_TARBALL)" rm -rf "$(PCRE2_BUILDIR)" rm -rf "$(PCRE2_DESTDIR)" - rm -fv "$(PCRE2_TARBALL)" rm -fv "$(PCRE2_ARCHIVE)" .PHONY: clean build diff --git a/deps/quictls/Makefile b/deps/quictls/Makefile index 6a21214..145aea5 100644 --- a/deps/quictls/Makefile +++ b/deps/quictls/Makefile @@ -6,16 +6,16 @@ QUICTLS_DESTDIR = dist QUICTLS_DESTDIR_ABS = $(shell realpath $(QUICTLS_DESTDIR)) QUICTLS_ARCHIVE = quictls-dist.tar.gz -all: $(QUICTLS_DESTDIR) $(QUICTLS_ARCHIVE) +all: build $(QUICTLS_DESTDIR) $(QUICTLS_ARCHIVE) -$(QUICTLS_BUILDIR): +$(QUICTLS_TARBALL): + curl -sfS -o "$(QUICTLS_TARBALL)" "$(QUICTLS_SOURCES)" + +$(QUICTLS_BUILDIR): $(QUICTLS_TARBALL) @if ! [ -d "$(QUICTLS_BUILDIR)" ]; then mkdir -v "$(QUICTLS_BUILDIR)"; fi - -$(QUICTLS_BUILDIR)/quictls-$(QUICTLS_VERSION).tar.gz: $(QUICTLS_BUILDIR) - curl -sSL -o "$(QUICTLS_TARBALL)" "$(QUICTLS_SOURCES)" - -build: $(QUICTLS_BUILDIR)/quictls-$(QUICTLS_VERSION).tar.gz tar -C $(QUICTLS_BUILDIR) --strip-components=1 -xf "$(QUICTLS_TARBALL)" + +build: $(QUICTLS_BUILDIR) cd "$(QUICTLS_BUILDIR)" && ./config --prefix="/opt/quictls" --openssldir="/opt/quictls" no-shared $(MAKE) -C "$(QUICTLS_BUILDIR)" -j "$(shell nproc)" ldd "$(QUICTLS_BUILDIR)/apps/openssl" || true @@ -30,9 +30,9 @@ $(QUICTLS_ARCHIVE): $(QUICTLS_DESTDIR) tar -C "$(QUICTLS_DESTDIR)" -cjf "$(QUICTLS_ARCHIVE)" "opt" clean: + rm -fv "$(QUICTLS_TARBALL)" rm -rf "$(QUICTLS_BUILDIR)" rm -rf "$(QUICTLS_DESTDIR)" - rm -rf "$(QUICTLS_TARBALL)" rm -fv "$(QUICTLS_ARCHIVE)" .PHONY: clean build diff --git a/haproxy/Makefile b/haproxy/Makefile index 7683965..14d98b8 100644 --- a/haproxy/Makefile +++ b/haproxy/Makefile @@ -1,6 +1,9 @@ -HAPROXY_VERSION = 2.6 -HAPROXY_REPOSRC = http://git.haproxy.org/git/haproxy-$(HAPROXY_VERSION).git +HAPROXY_VERSION = 2.6.0 +HAPROXY_VERSION_TAG = v$(HAPROXY_VERSION) +HAPROXY_VERSION_MINOR = $(shell echo "$(HAPROXY_VERSION)" | cut -d'.' -f1-2) +HAPROXY_SOURCES = https://git.haproxy.org/?p=haproxy-$(HAPROXY_VERSION_MINOR).git;a=snapshot;h=$(HAPROXY_VERSION_TAG);sf=tgz +HAPROXY_TARBALL = haproxy-$(HAPROXY_VERSION).tar.gz HAPROXY_BUILDIR = src HAPROXY_DESTDIR = dist HAPROXY_DESTDIR_ABS = $(shell realpath $(HAPROXY_DESTDIR)) @@ -41,16 +44,20 @@ HAPROXY_MAKE_ARGS := DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS" \ USE_TFO=1 \ USE_SYSTEMD=1 -all: build $(HAPROXY_DESTDIR) $(HAPROXY_ARCHIVE) +all: dist-bin -$(HAPROXY_BUILDIR): - git clone "$(HAPROXY_REPOSRC)" $(HAPROXY_BUILDIR) - git -C "$(HAPROXY_BUILDIR)" checkout "master" +dist-bin: build $(HAPROXY_DESTDIR) $(HAPROXY_ARCHIVE) + +$(HAPROXY_TARBALL): + curl -sfS -o "$(HAPROXY_TARBALL)" "$(HAPROXY_SOURCES)" + +$(HAPROXY_BUILDIR): $(HAPROXY_TARBALL) + @if ! [ -d "$(HAPROXY_BUILDIR)" ]; then mkdir -v "$(HAPROXY_BUILDIR)"; fi + tar -C "$(HAPROXY_BUILDIR)" --strip-components=1 -xf "$(HAPROXY_TARBALL)" build: $(HAPROXY_BUILDIR) - make -C "$(HAPROXY_BUILDIR)" -j "$(shell nproc)" clean - make -C "$(HAPROXY_BUILDIR)" -j "$(shell nproc)" $(HAPROXY_MAKE_ARGS) opts - make -C "$(HAPROXY_BUILDIR)" -j "$(shell nproc)" $(HAPROXY_MAKE_ARGS) + $(MAKE) -C "$(HAPROXY_BUILDIR)" -j "$(shell nproc)" $(HAPROXY_MAKE_ARGS) opts + $(MAKE) -C "$(HAPROXY_BUILDIR)" -j "$(shell nproc)" $(HAPROXY_MAKE_ARGS) $(HAPROXY_DESTDIR): @if ! [ -d "$(HAPROXY_DESTDIR)" ]; then mkdir -v "$(HAPROXY_DESTDIR)"; fi @@ -60,8 +67,9 @@ $(HAPROXY_ARCHIVE): $(HAPROXY_DESTDIR) tar -C "$(HAPROXY_DESTDIR)" -cjf "$(HAPROXY_ARCHIVE)" "usr" clean: + rm -fv "$(HAPROXY_TARBALL)" rm -rf "$(HAPROXY_BUILDIR)" rm -rf "$(HAPROXY_DESTDIR)" rm -fv "$(HAPROXY_ARCHIVE)" -.PHONY: clean build $(HAPROXY_DESTDIR) +.PHONY: clean build