]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Also generate Dockerfile with meson 15592/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 2 Jun 2025 12:48:21 +0000 (14:48 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 3 Jun 2025 10:58:19 +0000 (12:58 +0200)
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
Dockerfile-recursor
builder-support/debian/recursor/debian-buster/rules
builder-support/debian/recursor/debian-trixie/rules
meson/config/meson.build
pdns/remote_logger.cc

index a5a33a0d684f3bcf118cdf69e3b1d2af3f2da8aa..1369f680f0cc37569123074ef8171e60c1051d42 100644 (file)
@@ -5,22 +5,26 @@
 #   dig a www.example.com @0 -p 1053
 
 # Builder
-FROM debian:11-slim AS builder
+FROM debian:12-slim AS builder
 
-ENV NO_LUA_JIT="s390x arm64"
+ENV NO_LUA_JIT="s390x"
 
 # Reusable layer for base update
 RUN apt-get update && apt-get -y dist-upgrade && apt-get clean
 
+# Enable backports to get a recent enough version of meson
+RUN echo "deb http://deb.debian.org/debian bookworm-backports main" > /etc/apt/sources.list.d/bookworm-backports.list
 # devscripts gives us mk-build-deps (and a lot of other stuff)
-RUN apt-get install -y --no-install-recommends devscripts equivs git curl jq && apt-get clean
+RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y --no-install-recommends devscripts equivs git curl jq && apt-get clean
 
 COPY builder-support /source/builder-support
 
 # TODO: control file is not in tarballs at all right now
 RUN mk-build-deps -i -t 'apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends' /source/builder-support/debian/recursor/debian-buster/control && \
+    apt-get install -y -t bookworm-backports meson && \
     apt-get clean
 
+COPY meson /source/meson
 COPY pdns /source/pdns
 COPY build-aux /source/build-aux
 COPY m4 /source/m4
@@ -54,21 +58,30 @@ RUN if [ "${DOCKER_FAKE_RELEASE}" = "YES" ]; then \
 
 RUN mkdir /build && \
     LUAVER=$([ -z "${NO_LUA_JIT##*$(dpkg --print-architecture)*}" ] && echo 'lua5.3' || echo 'luajit') && \
-    apt-get install -y lib${LUAVER}-*dev && \
-    ./configure \
-      --with-libcap \
-      --with-libsodium \
-      --with-lua=${LUAVER} \
-      --with-net-snmp \
-      --enable-dns-over-tls \
-      --enable-dnstap \
-      --enable-nod \
-      LDFLAGS=-rdynamic \
+    apt-get install -y lib${LUAVER}-*dev ninja-build && \
+    BUILDDIR=$(mktemp -d) && \
+    IS_RELEASE="${DOCKER_FAKE_RELEASE}" \
+    LDFLAGS="-latomic -fuse-ld=lld -Wl,--build-id=sha1 -ldl" \
+    CC=clang \
+    CXX=clang++ \
+    PKG_CONFIG_PATH=/opt/lib/pkgconfig meson setup ${BUILDDIR} \
       --sysconfdir=/etc/powerdns \
-      --enable-option-checking=fatal && \
-      make clean && \
-      make $MAKEFLAGS install DESTDIR=/build && make clean && \
-      strip /build/usr/local/bin/* /build/usr/local/sbin/*
+      -Db_lto=true \
+      -Db_lto_mode=thin \
+      -Db_pie=true \
+      -Dlibcap=enabled \
+      -Dsigners-libsodium=enabled \
+      -Dlua=${LUAVER} \
+      -Dsnmp=enabled \
+      -Ddns-over-tls=enabled \
+      -Ddnstap=enabled \
+      -Dnod=enabled \
+      -Dsystemd-service=disabled && \
+    meson compile -C ${BUILDDIR} && \
+    meson install -C ${BUILDDIR} --destdir /build && \
+    strip /build/usr/local/bin/* && \
+    rm -rf /build/lib # remove systemd unit files, we do not need them and copying /lib to the run-time image breaks it
+
 RUN cd /tmp && mkdir /build/tmp/ && mkdir debian && \
     echo 'Source: docker-deps-for-pdns' > debian/control && \
     dpkg-shlibdeps /build/usr/local/bin/rec_control /build/usr/local/sbin/pdns_recursor && \
@@ -77,7 +90,7 @@ RUN cd /tmp && mkdir /build/tmp/ && mkdir debian && \
     dpkg-deb -I equivs-dummy_1.0_all.deb && cp equivs-dummy_1.0_all.deb /build/tmp/
 
 # Runtime
-FROM debian:11-slim
+FROM debian:12-slim
 
 # Reusable layer for base update - Should be cached from builder
 RUN apt-get update && apt-get -y dist-upgrade && apt-get clean
index 6dd8b4d888becae7623747a2ea2aa8c5eed08eef..ad02a97ba47d6b161910017e3c53afca0239f3e0 100755 (executable)
@@ -20,7 +20,7 @@ MESON_ARGS += -Dsystemd-service=disabled
 endif
 
 # Only disable luajit on arm64
-ifneq (,$(wildcard /usr/lib/aarch64-linux-gnu/pkgconfig/luajit.pc))
+ifneq (,$(wildcard /usr/lib/*/pkgconfig/luajit.pc))
 MESON_ARGS += -Dlua=luajit
 else
 MESON_ARGS += -Dlua=lua
index 6dd8b4d888becae7623747a2ea2aa8c5eed08eef..ad02a97ba47d6b161910017e3c53afca0239f3e0 100755 (executable)
@@ -20,7 +20,7 @@ MESON_ARGS += -Dsystemd-service=disabled
 endif
 
 # Only disable luajit on arm64
-ifneq (,$(wildcard /usr/lib/aarch64-linux-gnu/pkgconfig/luajit.pc))
+ifneq (,$(wildcard /usr/lib/*/pkgconfig/luajit.pc))
 MESON_ARGS += -Dlua=luajit
 else
 MESON_ARGS += -Dlua=lua
index 09c7034829361fd763cc5a6977984dfaa4dc44b9..deb7141106741114f7a09a3ae4a0bea3ab4cb702 100644 (file)
@@ -1 +1,2 @@
 add_project_arguments('-DHAVE_CONFIG_H', language: ['c', 'cpp'])
+conf.set_quoted('PDNS_CONFIG_ARGS', meson.build_options(), description: 'Build options')
index d07a5aaf0013b7659d2dacf8c13e0140764ade7a..8065817c88eed3878ae81c99bf4eccaed77a81f4 100644 (file)
@@ -5,9 +5,8 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
-#ifdef PDNS_CONFIG_ARGS
+#ifdef RECURSOR
 #include "logger.hh"
-#define WE_ARE_RECURSOR
 #else
 #include "dolog.hh"
 #endif
@@ -132,7 +131,7 @@ bool RemoteLogger::reconnect()
     }
   }
   catch (const std::exception& e) {
-#ifdef WE_ARE_RECURSOR
+#ifdef RECURSOR
     SLOG(g_log<<Logger::Warning<<"Error connecting to remote logger "<<d_remote.toStringWithPort()<<": "<<e.what()<<std::endl,
          g_slog->withName("protobuf")->error(Logr::Error, e.what(), "Exception while connecting to remote logger", "address", Logging::Loggable(d_remote)));
 #else
@@ -190,7 +189,7 @@ RemoteLoggerInterface::Result RemoteLogger::queueData(const std::string& data)
 void RemoteLogger::maintenanceThread() 
 {
   try {
-#ifdef WE_ARE_RECURSOR
+#ifdef RECURSOR
     string threadName = "rec/remlog";
 #else
     string threadName = "dnsdist/remLog";