Parameterize src dirs everywhere and fix PCRE incs for HAProxy

This commit is contained in:
Tristan 2022-06-06 06:52:47 +01:00
parent 6376218f49
commit 069e156f0c
No known key found for this signature in database
GPG Key ID: BDDFC4A0651ACDE4
6 changed files with 72 additions and 49 deletions

View File

@ -40,7 +40,9 @@ quictls:
haproxy: haproxy:
<<: *build-job <<: *build-job
stage: haproxy stage: haproxy
script: make -C haproxy script:
- apt install -y --no-install-recommends -qq git
- make -C haproxy
needs: needs:
- job: lua - job: lua
artifacts: true artifacts: true

View File

@ -14,4 +14,10 @@ deps/quictls:
haproxy: haproxy:
$(MAKE) -C "haproxy" $(MAKE) -C "haproxy"
clean:
$(MAKE) -C "deps/lua" clean
$(MAKE) -C "deps/pcre2" clean
$(MAKE) -C "deps/quictls" clean
$(MAKE) -C "haproxy" clean
.PHONY: deps/* haproxy .PHONY: deps/* haproxy

20
deps/lua/Makefile vendored
View File

@ -1,27 +1,29 @@
LUA_VERSION = 5.3.6 LUA_VERSION = 5.3.6
LUA_SOURCES = https://www.lua.org/ftp/lua-$(LUA_VERSION).tar.gz LUA_SOURCES = https://www.lua.org/ftp/lua-$(LUA_VERSION).tar.gz
LUA_TARBALL = lua-$(LUA_VERSION).tar.gz LUA_TARBALL = lua-$(LUA_VERSION).tar.gz
LUA_BUILDIR = src
LUA_DESTDIR = dist LUA_DESTDIR = dist
LUA_DESTDIR_ABS = $(shell realpath $(LUA_DESTDIR)) LUA_DESTDIR_ABS = $(shell realpath $(LUA_DESTDIR))
all: build $(LUA_DESTDIR) all: $(LUA_BUILDIR) $(LUA_DESTDIR)
src: $(LUA_BUILDIR):
if ! [ -d "src" ]; then mkdir -v "src"; fi @if ! [ -d "$(LUA_BUILDIR)" ]; then mkdir -v "$(LUA_BUILDIR)"; fi
src/lua-$(LUA_VERSION).tar.gz: src $(LUA_BUILDIR)/lua-$(LUA_VERSION).tar.gz: $(LUA_BUILDIR)
curl -sSL -o "$(LUA_TARBALL)" "$(LUA_SOURCES)" curl -sSL -o "$(LUA_TARBALL)" "$(LUA_SOURCES)"
build: src/lua-$(LUA_VERSION).tar.gz build: $(LUA_BUILDIR)/lua-$(LUA_VERSION).tar.gz
tar -C src --strip-components=1 -xf "$(LUA_TARBALL)" tar -C $(LUA_BUILDIR) --strip-components=1 -xf "$(LUA_TARBALL)"
$(MAKE) -C src -j$(shell nproc) linux $(MAKE) -C $(LUA_BUILDIR) -j$(shell nproc) linux
$(LUA_DESTDIR): build $(LUA_DESTDIR): build
if ! [ -d "$(LUA_DESTDIR)" ]; then mkdir -v "$(LUA_DESTDIR)"; fi if ! [ -d "$(LUA_DESTDIR)" ]; then mkdir -v "$(LUA_DESTDIR)"; fi
$(MAKE) -C src -j$(shell nproc) install INSTALL_TOP="$(LUA_DESTDIR_ABS)" $(MAKE) -C $(LUA_BUILDIR) -j$(shell nproc) install INSTALL_TOP="$(LUA_DESTDIR_ABS)"
clean: clean:
rm -rf "src" rm -rf "$(LUA_BUILDIR)"
rm -rf "$(LUA_DESTDIR)" rm -rf "$(LUA_DESTDIR)"
rm -fv "$(LUA_TARBALL)"
.PHONY: clean build .PHONY: clean build

22
deps/pcre2/Makefile vendored
View File

@ -1,28 +1,30 @@
PCRE2_VERSION = 10.40 PCRE2_VERSION = 10.40
PCRE2_SOURCES = https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$(PCRE2_VERSION)/pcre2-$(PCRE2_VERSION).tar.gz PCRE2_SOURCES = https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$(PCRE2_VERSION)/pcre2-$(PCRE2_VERSION).tar.gz
PCRE2_TARBALL = pcre2-$(PCRE2_VERSION).tar.gz PCRE2_TARBALL = pcre2-$(PCRE2_VERSION).tar.gz
PCRE2_BUILDIR = src
PCRE2_DESTDIR = dist PCRE2_DESTDIR = dist
PCRE2_DESTDIR_ABS = $(shell realpath $(PCRE2_DESTDIR)) PCRE2_DESTDIR_ABS = $(shell realpath $(PCRE2_DESTDIR))
all: build dist all: build dist
src: $(PCRE2_BUILDIR):
if ! [ -d "src" ]; then mkdir -v "src"; fi @if ! [ -d "$(PCRE2_BUILDIR)" ]; then mkdir -v "$(PCRE2_BUILDIR)"; fi
src/pcre2-$(PCRE2_VERSION).tar.gz: src $(PCRE2_BUILDIR)/pcre2-$(PCRE2_VERSION).tar.gz: $(PCRE2_BUILDIR)
curl -sSL -o "$(PCRE2_TARBALL)" "$(PCRE2_SOURCES)" curl -sSL -o "$(PCRE2_TARBALL)" "$(PCRE2_SOURCES)"
build: src/pcre2-$(PCRE2_VERSION).tar.gz build: $(PCRE2_BUILDIR)/pcre2-$(PCRE2_VERSION).tar.gz
tar -C src --strip-components=1 -xf "$(PCRE2_TARBALL)" tar -C $(PCRE2_BUILDIR) --strip-components=1 -xf "$(PCRE2_TARBALL)"
if [ -f "src/CmakeCache.txt" ]; then rm -v "src/CmakeCache.txt"; fi if [ -f "$(PCRE2_BUILDIR)/CmakeCache.txt" ]; then rm -v "$(PCRE2_BUILDIR)/CmakeCache.txt"; fi
cd "src" && cmake -DPCRE2_STATIC_PIC=ON -DPCRE2_SUPPORT_JIT=ON -DCMAKE_INSTALL_PREFIX="$(PCRE2_DESTDIR_ABS)" . && make cd "$(PCRE2_BUILDIR)" && cmake -DPCRE2_STATIC_PIC=ON -DPCRE2_SUPPORT_JIT=ON -DCMAKE_INSTALL_PREFIX="$(PCRE2_DESTDIR_ABS)" . && make
dist: build dist: build
if ! [ -d "$(PCRE2_DESTDIR)" ]; then mkdir -v "$(PCRE2_DESTDIR)"; fi if ! [ -d "$(PCRE2_DESTDIR)" ]; then mkdir -v "$(PCRE2_DESTDIR)"; fi
cd "src" && make install cd "$(PCRE2_BUILDIR)" && make install
clean: clean:
rm -rf "src" rm -rf "$(PCRE2_BUILDIR)"
rm -rf "$(PCRE2_DESTDIR)"
rm -fv "$(PCRE2_TARBALL)"
.PHONY: clean build dist .PHONY: clean build dist

37
deps/quictls/Makefile vendored
View File

@ -1,37 +1,38 @@
QUICTLS_VERSION = OpenSSL_1_1_1o QUICTLS_VERSION = OpenSSL_1_1_1o
QUICTLS_SOURCES = https://codeload.github.com/quictls/openssl/tar.gz/$(QUICTLS_VERSION)+quic QUICTLS_SOURCES = https://codeload.github.com/quictls/openssl/tar.gz/$(QUICTLS_VERSION)+quic
QUICTLS_TARBALL = quictls-$(QUICTLS_VERSION).tar.gz QUICTLS_TARBALL = quictls-$(QUICTLS_VERSION).tar.gz
QUICTLS_BUILDIR = src
QUICTLS_DESTDIR = dist QUICTLS_DESTDIR = dist
QUICTLS_DESTDIR_ABS = $(shell realpath $(QUICTLS_DESTDIR)) QUICTLS_DESTDIR_ABS = $(shell realpath $(QUICTLS_DESTDIR))
QUICTLS_ARCHIVE = quictls-$(QUICTLS_VERSION)-dist.tar.gz QUICTLS_ARCHIVE = quictls-$(QUICTLS_VERSION)-dist.tar.gz
all: build $(QUICTLS_DESTDIR) archive all: $(QUICTLS_DESTDIR) $(QUICTLS_ARCHIVE)
src: $(QUICTLS_BUILDIR):
if ! [ -d "src" ]; then mkdir -v "src"; fi @if ! [ -d "$(QUICTLS_BUILDIR)" ]; then mkdir -v "$(QUICTLS_BUILDIR)"; fi
src/quictls-$(QUICTLS_VERSION).tar.gz: src $(QUICTLS_BUILDIR)/quictls-$(QUICTLS_VERSION).tar.gz: $(QUICTLS_BUILDIR)
curl -sSL -o "$(QUICTLS_TARBALL)" "$(QUICTLS_SOURCES)" curl -sSL -o "$(QUICTLS_TARBALL)" "$(QUICTLS_SOURCES)"
build: src/quictls-$(QUICTLS_VERSION).tar.gz build: $(QUICTLS_BUILDIR)/quictls-$(QUICTLS_VERSION).tar.gz
tar -C src --strip-components=1 -xf "$(QUICTLS_TARBALL)" tar -C $(QUICTLS_BUILDIR) --strip-components=1 -xf "$(QUICTLS_TARBALL)"
cd "src" && ./config --prefix="/opt/quictls" --openssldir="/opt/quictls" no-shared cd "$(QUICTLS_BUILDIR)" && ./config --prefix="/opt/quictls" --openssldir="/opt/quictls" no-shared
$(MAKE) -C "src" -j "$(shell nproc)" $(MAKE) -C "$(QUICTLS_BUILDIR)" -j "$(shell nproc)"
ldd "src/apps/openssl" || true ldd "$(QUICTLS_BUILDIR)/apps/openssl" || true
src/apps/openssl version "$(QUICTLS_BUILDIR)/apps/openssl" version
$(QUICTLS_DESTDIR): $(QUICTLS_DESTDIR): build
if ! [ -d "$(QUICTLS_DESTDIR)" ]; then mkdir -v "$(QUICTLS_DESTDIR)"; fi if ! [ -d "$(QUICTLS_DESTDIR)" ]; then mkdir -v "$(QUICTLS_DESTDIR)"; fi
$(MAKE) -C "src" -j "$(shell nproc)" DESTDIR="$(QUICTLS_DESTDIR_ABS)" install_sw $(MAKE) -C "$(QUICTLS_BUILDIR)" -j "$(shell nproc)" DESTDIR="$(QUICTLS_DESTDIR_ABS)" install_sw
# Take a moment to hate on how fucking shit the `tar` CLI is with me, especially regarding the awkward dance of path prefixes. Press S. # Take a moment to hate on how fucking shit the `tar` CLI is with me, especially regarding the awkward dance of path prefixes. Press S.
archive: $(QUICTLS_DESTDIR) $(QUICTLS_ARCHIVE): $(QUICTLS_DESTDIR)
tar -C "$(QUICTLS_DESTDIR)" -cjf "$(QUICTLS_ARCHIVE)" "opt" tar -C "$(QUICTLS_DESTDIR)" -cjf "$(QUICTLS_ARCHIVE)" "opt"
clean: clean:
@rm -rf "src" || true rm -rf "$(QUICTLS_BUILDIR)"
@rm -rf "$(QUICTLS_TARBALL)" || true rm -rf "$(QUICTLS_DESTDIR)"
@rm -rf "$(QUICTLS_DESTDIR)" || true rm -rf "$(QUICTLS_TARBALL)"
@rm -v "$(QUICTLS_ARCHIVE)" || true rm -fv "$(QUICTLS_ARCHIVE)"
.PHONY: clean build $(QUICTLS_DESTDIR) dist archive .PHONY: clean build

View File

@ -1,6 +1,10 @@
HAPROXY_REPO_SRC = http://git.haproxy.org/git/haproxy-2.6.git HAPROXY_VERSION = 2.6
HAPROXY_REPOSRC = http://git.haproxy.org/git/haproxy-$(HAPROXY_VERSION).git
HAPROXY_BUILDIR = src
HAPROXY_DESTDIR = dist HAPROXY_DESTDIR = dist
HAPROXY_DESTDIR_ABS = $(shell realpath $(HAPROXY_DESTDIR)) HAPROXY_DESTDIR_ABS = $(shell realpath $(HAPROXY_DESTDIR))
HAPROXY_ARCHIVE = haproxy-$(HAPROXY_VERSION)-dist.tar.gz
DEP_ROOT_LUA = ../deps/lua DEP_ROOT_LUA = ../deps/lua
DEP_ROOT_PCRE2 = ../deps/pcre2 DEP_ROOT_PCRE2 = ../deps/pcre2
@ -25,7 +29,8 @@ HAPROXY_MAKE_ARGS := DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS" \
USE_PCRE2_JIT=1 \ USE_PCRE2_JIT=1 \
USE_STATIC_PCRE2=1 \ USE_STATIC_PCRE2=1 \
PCRE2_INC="../$(DEP_ROOT_PCRE2)/dist/include" \ PCRE2_INC="../$(DEP_ROOT_PCRE2)/dist/include" \
PCRE2_LIB="../$(DEP_ROOT_PCRE2)/dist/lib" \ PCRE2_LIB="../$(DEP_ROOT_PCRE2)/dist/lib64" \
PCRE2_CONFIG="../$(DEP_ROOT_PCRE2)/dist/bin/pcre2-config" \
USE_PROMEX=1 \ USE_PROMEX=1 \
USE_QUIC=1 \ USE_QUIC=1 \
USE_SLZ=1 \ USE_SLZ=1 \
@ -34,19 +39,24 @@ HAPROXY_MAKE_ARGS := DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS" \
all: build $(HAPROXY_DESTDIR) all: build $(HAPROXY_DESTDIR)
src: $(HAPROXY_BUILDIR):
git clone "$(HAPROXY_REPO_SRC)" src git clone "$(HAPROXY_REPOSRC)" $(HAPROXY_BUILDIR)
git -C "src" checkout "master" git -C "$(HAPROXY_BUILDIR)" checkout "master"
build: src build: $(HAPROXY_BUILDIR)
make -C "src" -j "$(shell nproc)" $(HAPROXY_MAKE_ARGS) opts make -C "$(HAPROXY_BUILDIR)" -j "$(shell nproc)" $(HAPROXY_MAKE_ARGS) opts
make -C "src" -j "$(shell nproc)" $(HAPROXY_MAKE_ARGS) make -C "$(HAPROXY_BUILDIR)" -j "$(shell nproc)" $(HAPROXY_MAKE_ARGS)
$(HAPROXY_DESTDIR): $(HAPROXY_DESTDIR):
if ! [ -d "$(HAPROXY_DESTDIR)" ]; then mkdir -v "$(HAPROXY_DESTDIR)"; fi @if ! [ -d "$(HAPROXY_DESTDIR)" ]; then mkdir -v "$(HAPROXY_DESTDIR)"; fi
$(MAKE) -C "src" -j "$(shell nproc)" DESTDIR="$(HAPROXY_DESTDIR_ABS)" install $(MAKE) -C "$(HAPROXY_BUILDIR)" -j "$(shell nproc)" DESTDIR="$(HAPROXY_DESTDIR_ABS)" install
$(HAPROXY_ARCHIVE): $(HAPROXY_DESTDIR)
tar -C "$(HAPROXY_DESTDIR)" -cjf "$(HAPROXY_ARCHIVE)" "usr"
clean: clean:
git -C "src" clean -fdx rm -rf "$(HAPROXY_BUILDIR)"
rm -rf "$(HAPROXY_DESTDIR)"
rm -fv "$(HAPROXY_ARCHIVE)"
.PHONY: clean build $(HAPROXY_DESTDIR) .PHONY: clean build $(HAPROXY_DESTDIR)