From 05b9f1eabece4583099fd0be9b474deb622a5a95 Mon Sep 17 00:00:00 2001 From: Tristan Date: Thu, 23 Jun 2022 15:23:25 +0200 Subject: [PATCH 1/2] Add necessary switches for darwin builds --- deps/lua/Makefile | 8 ++++++++ deps/quictls/Makefile | 19 +++++++++++++++---- deps/vtest/Makefile | 10 ++++++++++ haproxy/Makefile | 9 +++++++++ 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/deps/lua/Makefile b/deps/lua/Makefile index 47ced91..4e6c4a4 100644 --- a/deps/lua/Makefile +++ b/deps/lua/Makefile @@ -16,8 +16,16 @@ $(LUA_BUILDIR): $(LUA_TARBALL) tar -C $(LUA_BUILDIR) --strip-components=1 -xf "$(LUA_TARBALL)" build: $(LUA_BUILDIR) + $(MAKE) build_$(shell uname -s) + +.PHONY: build_Linux +build_Linux: $(MAKE) -C $(LUA_BUILDIR) -j$(shell nproc) linux +.PHONY: build_Darwin +build_Darwin: + $(MAKE) -C $(LUA_BUILDIR) -j$(shell nproc) macosx + $(LUA_DESTDIR): build if ! [ -d "$(LUA_DESTDIR)" ]; then mkdir -v "$(LUA_DESTDIR)"; fi $(MAKE) -C $(LUA_BUILDIR) -j$(shell nproc) install INSTALL_TOP="$(LUA_DESTDIR_ABS)" diff --git a/deps/quictls/Makefile b/deps/quictls/Makefile index 1452862..156744e 100644 --- a/deps/quictls/Makefile +++ b/deps/quictls/Makefile @@ -19,15 +19,26 @@ $(QUICTLS_BUILDIR): $(QUICTLS_TARBALL) tar -C $(QUICTLS_BUILDIR) --strip-components=1 -xf "$(QUICTLS_TARBALL)" build: $(QUICTLS_BUILDIR) - cd "$(QUICTLS_BUILDIR)" && sed -i 's/^BUILD_METADATA.*/BUILD_METADATA=$(QUICTLS_BUILD_VERSION)/g' "VERSION.dat" - cd "$(QUICTLS_BUILDIR)" && sed -i 's/^RELEASE_DATE.*/RELEASE_DATE="$(shell date -u +'%e %b %Y')"/g' "VERSION.dat" + cd "$(QUICTLS_BUILDIR)" && ! [ -f "VERSION.dat.orig" ] && mv -fv "VERSION.dat" "VERSION.dat.orig" || true + cd "$(QUICTLS_BUILDIR)" && sed 's/^BUILD_METADATA.*/BUILD_METADATA=$(QUICTLS_BUILD_VERSION)/g' "VERSION.dat.orig" > "VERSION.dat.meta" + cd "$(QUICTLS_BUILDIR)" && sed 's/^RELEASE_DATE.*/RELEASE_DATE="$(shell date -u +'%e %b %Y')"/g' "VERSION.dat.meta" > "VERSION.dat" cd "$(QUICTLS_BUILDIR)" && ./Configure --prefix="/opt/quictls" --openssldir="/opt/quictls" --libdir="lib" -DPURIFY no-shared $(MAKE) -C "$(QUICTLS_BUILDIR)" -j "$(shell nproc)" VERSION=$(OPENSSL_VERSION)+quic-mangadex-$(BUILD_VERSION_REPOSHA) build_sw - ldd "$(QUICTLS_BUILDIR)/apps/openssl" || true "$(QUICTLS_BUILDIR)/apps/openssl" version + $(MAKE) buildinfo_$(shell uname -s) + +.PHONY: buildinfo_Linux +buildinfo_Linux: + @echo "Checking shared libraries openssl is linked against (Linux):" + @ldd "$(QUICTLS_BUILDIR)/apps/openssl" || true + +.PHONY: buildinfo_Darwin +buildinfo_Darwin: + @echo "Checking shared libraries openssl is linked against (Darwin):" + @otool -L "$(QUICTLS_BUILDIR)/apps/openssl" || true $(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 "$(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. diff --git a/deps/vtest/Makefile b/deps/vtest/Makefile index 89f00fe..7932bb0 100644 --- a/deps/vtest/Makefile +++ b/deps/vtest/Makefile @@ -14,6 +14,16 @@ $(VTEST_BUILDIR): $(VTEST_TARBALL) tar -C $(VTEST_BUILDIR) --strip-components=1 -xf "$(VTEST_TARBALL)" build: $(VTEST_BUILDIR) + $(MAKE) build_$(shell uname -s) + +.PHONY: build_Darwin +build_Darwin: + $(MAKE) -C "$(VTEST_BUILDIR)" -j "$(shell nproc)" \ + INCS="-Isrc -Ilib -I$$(brew --prefix pcre2)/include -pthread" \ + LIBS="-L$$(brew --prefix pcre2)/lib -lm -lpcre2-8 -lz" + +.PHONY: build_Linux +build_Linux: $(VTEST_BUILDIR) $(MAKE) -C "$(VTEST_BUILDIR)" -j "$(shell nproc)" $(VTEST_DESTDIR): build diff --git a/haproxy/Makefile b/haproxy/Makefile index fdae934..d5fa934 100644 --- a/haproxy/Makefile +++ b/haproxy/Makefile @@ -67,9 +67,18 @@ 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) build_$(shell uname -s) + +.PHONY: build_Linux +build_Linux: $(MAKE) -C "$(HAPROXY_BUILDIR)" -j "$(shell nproc)" $(MAKEARGS) opts $(MAKE) -C "$(HAPROXY_BUILDIR)" -j "$(shell nproc)" $(MAKEARGS) +.PHONY: build_Darwin +build_Darwin: + BREW_CLANG="$(shell brew --prefix llvm)/bin/clang" && $(MAKE) -C "$(HAPROXY_BUILDIR)" -j "$(shell nproc)" CC="$${BREW_CLANG}" LD="$${BREW_CLANG}" $(MAKEARGS) TARGET=osx opts + BREW_CLANG="$(shell brew --prefix llvm)/bin/clang" && $(MAKE) -C "$(HAPROXY_BUILDIR)" -j "$(shell nproc)" CC="$${BREW_CLANG}" LD="$${BREW_CLANG}" $(MAKEARGS) TARGET=osx + # Ignore ssl/ssl_generate_certificate.vtc as it fails and I have no clue why at all test: $(HAPROXY_BUILDIR) rm -v "$(HAPROXY_BUILDIR)/reg-tests/ssl/ssl_generate_certificate.vtc" || true From 8be4a5d29a7c98339601ddbbc030e41a6c6f965c Mon Sep 17 00:00:00 2001 From: Tristan Date: Thu, 23 Jun 2022 15:23:48 +0200 Subject: [PATCH 2/2] Add convenience debian scratch env setup script Purely for local reproduction purposes --- tool/setup-debian.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 tool/setup-debian.sh diff --git a/tool/setup-debian.sh b/tool/setup-debian.sh new file mode 100755 index 0000000..6e9882b --- /dev/null +++ b/tool/setup-debian.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -euo pipefail + +export DEBIAN_FRONTEND=noninteractive + +apt -qq update +apt -qq -y --no-install-recommends install apt-utils apt-transport-https ca-certificates +sed -i -e 's/http\:/https\:/g' /etc/apt/sources.list +apt -qq update +apt -qq -y --no-install-recommends install \ + build-essential \ + bzip2 \ + ca-certificates \ + cmake \ + curl \ + debhelper \ + debian-archive-keyring \ + devscripts \ + git \ + gnupg2 \ + libpcre2-dev \ + libreadline-dev \ + libsystemd-dev \ + pkg-config \ + tar \ + zlib1g-dev