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:
<<: *build-job
stage: haproxy
script: make -C haproxy
script:
- apt install -y --no-install-recommends -qq git
- make -C haproxy
needs:
- job: lua
artifacts: true

View File

@ -14,4 +14,10 @@ deps/quictls:
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

20
deps/lua/Makefile vendored
View File

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

22
deps/pcre2/Makefile vendored
View File

@ -1,28 +1,30 @@
PCRE2_VERSION = 10.40
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_BUILDIR = src
PCRE2_DESTDIR = dist
PCRE2_DESTDIR_ABS = $(shell realpath $(PCRE2_DESTDIR))
all: build dist
src:
if ! [ -d "src" ]; then mkdir -v "src"; fi
$(PCRE2_BUILDIR):
@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)"
build: src/pcre2-$(PCRE2_VERSION).tar.gz
tar -C src --strip-components=1 -xf "$(PCRE2_TARBALL)"
if [ -f "src/CmakeCache.txt" ]; then rm -v "src/CmakeCache.txt"; fi
cd "src" && cmake -DPCRE2_STATIC_PIC=ON -DPCRE2_SUPPORT_JIT=ON -DCMAKE_INSTALL_PREFIX="$(PCRE2_DESTDIR_ABS)" . && make
build: $(PCRE2_BUILDIR)/pcre2-$(PCRE2_VERSION).tar.gz
tar -C $(PCRE2_BUILDIR) --strip-components=1 -xf "$(PCRE2_TARBALL)"
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
dist: build
if ! [ -d "$(PCRE2_DESTDIR)" ]; then mkdir -v "$(PCRE2_DESTDIR)"; fi
cd "src" && make install
cd "$(PCRE2_BUILDIR)" && make install
clean:
rm -rf "src"
rm -rf "$(PCRE2_BUILDIR)"
rm -rf "$(PCRE2_DESTDIR)"
rm -fv "$(PCRE2_TARBALL)"
.PHONY: clean build dist

37
deps/quictls/Makefile vendored
View File

@ -1,37 +1,38 @@
QUICTLS_VERSION = OpenSSL_1_1_1o
QUICTLS_SOURCES = https://codeload.github.com/quictls/openssl/tar.gz/$(QUICTLS_VERSION)+quic
QUICTLS_TARBALL = quictls-$(QUICTLS_VERSION).tar.gz
QUICTLS_BUILDIR = src
QUICTLS_DESTDIR = dist
QUICTLS_DESTDIR_ABS = $(shell realpath $(QUICTLS_DESTDIR))
QUICTLS_ARCHIVE = quictls-$(QUICTLS_VERSION)-dist.tar.gz
all: build $(QUICTLS_DESTDIR) archive
all: $(QUICTLS_DESTDIR) $(QUICTLS_ARCHIVE)
src:
if ! [ -d "src" ]; then mkdir -v "src"; fi
$(QUICTLS_BUILDIR):
@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)"
build: src/quictls-$(QUICTLS_VERSION).tar.gz
tar -C src --strip-components=1 -xf "$(QUICTLS_TARBALL)"
cd "src" && ./config --prefix="/opt/quictls" --openssldir="/opt/quictls" no-shared
$(MAKE) -C "src" -j "$(shell nproc)"
ldd "src/apps/openssl" || true
src/apps/openssl version
build: $(QUICTLS_BUILDIR)/quictls-$(QUICTLS_VERSION).tar.gz
tar -C $(QUICTLS_BUILDIR) --strip-components=1 -xf "$(QUICTLS_TARBALL)"
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
"$(QUICTLS_BUILDIR)/apps/openssl" version
$(QUICTLS_DESTDIR):
$(QUICTLS_DESTDIR): build
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.
archive: $(QUICTLS_DESTDIR)
$(QUICTLS_ARCHIVE): $(QUICTLS_DESTDIR)
tar -C "$(QUICTLS_DESTDIR)" -cjf "$(QUICTLS_ARCHIVE)" "opt"
clean:
@rm -rf "src" || true
@rm -rf "$(QUICTLS_TARBALL)" || true
@rm -rf "$(QUICTLS_DESTDIR)" || true
@rm -v "$(QUICTLS_ARCHIVE)" || true
rm -rf "$(QUICTLS_BUILDIR)"
rm -rf "$(QUICTLS_DESTDIR)"
rm -rf "$(QUICTLS_TARBALL)"
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_ABS = $(shell realpath $(HAPROXY_DESTDIR))
HAPROXY_ARCHIVE = haproxy-$(HAPROXY_VERSION)-dist.tar.gz
DEP_ROOT_LUA = ../deps/lua
DEP_ROOT_PCRE2 = ../deps/pcre2
@ -25,7 +29,8 @@ HAPROXY_MAKE_ARGS := DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS" \
USE_PCRE2_JIT=1 \
USE_STATIC_PCRE2=1 \
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_QUIC=1 \
USE_SLZ=1 \
@ -34,19 +39,24 @@ HAPROXY_MAKE_ARGS := DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS" \
all: build $(HAPROXY_DESTDIR)
src:
git clone "$(HAPROXY_REPO_SRC)" src
git -C "src" checkout "master"
$(HAPROXY_BUILDIR):
git clone "$(HAPROXY_REPOSRC)" $(HAPROXY_BUILDIR)
git -C "$(HAPROXY_BUILDIR)" checkout "master"
build: src
make -C "src" -j "$(shell nproc)" $(HAPROXY_MAKE_ARGS) opts
make -C "src" -j "$(shell nproc)" $(HAPROXY_MAKE_ARGS)
build: $(HAPROXY_BUILDIR)
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
$(MAKE) -C "src" -j "$(shell nproc)" DESTDIR="$(HAPROXY_DESTDIR_ABS)" install
@if ! [ -d "$(HAPROXY_DESTDIR)" ]; then mkdir -v "$(HAPROXY_DESTDIR)"; fi
$(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:
git -C "src" clean -fdx
rm -rf "$(HAPROXY_BUILDIR)"
rm -rf "$(HAPROXY_DESTDIR)"
rm -fv "$(HAPROXY_ARCHIVE)"
.PHONY: clean build $(HAPROXY_DESTDIR)