Add support for including extra patches at build time

This commit is contained in:
Tristan 2022-06-09 21:59:39 +01:00
parent d32519511b
commit cf2d2a9eb8
No known key found for this signature in database
GPG Key ID: BDDFC4A0651ACDE4
2 changed files with 13 additions and 4 deletions

View File

@ -12,7 +12,7 @@ variables:
needs: [ ]
before_script:
- apt -qq update
- apt install -y --no-install-recommends -qq build-essential ca-certificates cmake curl libreadline-dev libsystemd-dev tar
- apt install -y --no-install-recommends -qq build-essential ca-certificates cmake curl git libreadline-dev libsystemd-dev tar
lua:
<<: *build-job
@ -164,7 +164,7 @@ deb:haproxy:
<<: *build-job
stage: build
script:
- apt install -y --no-install-recommends -qq bzip2 devscripts debhelper git pkg-config
- apt install -y --no-install-recommends -qq bzip2 devscripts debhelper pkg-config
- mkdir deps/lua/dist && tar -C deps/lua/dist -xf deps/lua/lua-dist.tar.gz
- mkdir deps/pcre2/dist && tar -C deps/pcre2/dist -xf deps/pcre2/pcre2-dist.tar.gz
- mkdir deps/quictls/dist && tar -C deps/quictls/dist -xf deps/quictls/quictls-dist.tar.gz

View File

@ -15,6 +15,10 @@ DEP_DIST_ROOT_QUICTLS = $(shell realpath ../deps/quictls/dist)
BUILD_VERSION_REPOSHA = $(shell git rev-parse --short HEAD)
BUILD_PATCHES_DIR = $(shell realpath patches)
BUILD_PATCHES_FILES = $(shell ls -1 $(BUILD_PATCHES_DIR))
DEBIAN_PATCHES_DIR = "$(HAPROXY_BUILDIR)/debian/patches"
MAKEARGS = DEBUG="-DDEBUG_STRICT -DDEBUG_MEMORY_POOLS" \
DEFINE="-DMAX_SESS_STKCTR=5" \
IGNOREGIT=true \
@ -57,7 +61,10 @@ $(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)
patches: $(HAPROXY_BUILDIR)
cd "$(HAPROXY_BUILDIR)" && for patch in $(BUILD_PATCHES_FILES); do patch -p1 --forward < "$(BUILD_PATCHES_DIR)/$${patch}" || true; done
build: $(HAPROXY_BUILDIR) patches
$(MAKE) -C "$(HAPROXY_BUILDIR)" -j "$(shell nproc)" $(MAKEARGS) opts
$(MAKE) -C "$(HAPROXY_BUILDIR)" -j "$(shell nproc)" $(MAKEARGS)
@ -73,6 +80,8 @@ $(HAPROXY_DEBORIG): $(HAPROXY_TARBALL)
build-deb: $(HAPROXY_DEBORIG) $(HAPROXY_BUILDIR)
cp -rf debian $(HAPROXY_BUILDIR)/
for patch in $(BUILD_PATCHES_FILES); do cp -v "$(BUILD_PATCHES_DIR)/$${patch}" "$(DEBIAN_PATCHES_DIR)/$${patch}"; done
for patch in $(BUILD_PATCHES_FILES); do echo "$${patch}" >> "$(DEBIAN_PATCHES_DIR)/series"; done
cd $(HAPROXY_BUILDIR) && debuild -us -uc
rm -fv $(HAPROXY_TARBALL)
rm -rf $(HAPROXY_BUILDIR)
@ -86,4 +95,4 @@ clean:
rm -fv "haproxy_$(HAPROXY_VERSION)"*
rm -fv "haproxy-dbgsym_$(HAPROXY_VERSION)"*
.PHONY: clean build
.PHONY: clean build patches