]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Rec debian/ubuntu packges using meson
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 26 May 2025 13:08:18 +0000 (15:08 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 2 Jun 2025 10:17:37 +0000 (12:17 +0200)
13 files changed:
builder-support/debian/recursor/debian-buster/control
builder-support/debian/recursor/debian-buster/rules
builder-support/dockerfiles/Dockerfile.authoritative
builder-support/dockerfiles/Dockerfile.debbuild-prepare
builder-support/dockerfiles/Dockerfile.dnsdist
builder-support/dockerfiles/Dockerfile.target.debian-bookworm
builder-support/dockerfiles/Dockerfile.target.debian-bullseye
builder-support/dockerfiles/Dockerfile.target.debian-trixie
builder-support/dockerfiles/Dockerfile.target.sdist
builder-support/dockerfiles/Dockerfile.target.ubuntu-jammy
builder-support/dockerfiles/Dockerfile.target.ubuntu-noble
builder-support/dockerfiles/Dockerfile.target.ubuntu-oracular
pdns/recursordist/meson.build

index db119a1c6977d005ecd7efac3d9a6d091e0df22b..81d067f2ee78ccd077082b6c1d435213ab2ad659 100644 (file)
@@ -5,6 +5,7 @@ Priority: optional
 Standards-Version: 4.5.1
 Build-Depends: debhelper (>= 10),
                dh-autoreconf,
+               clang,
                libboost-context-dev,
                libboost-dev,
                libboost-filesystem-dev,
@@ -21,6 +22,7 @@ Build-Depends: debhelper (>= 10),
                libsodium-dev,
                libssl-dev,
                libsystemd-dev,
+               lld,
                pkgconf | pkg-config,
                protobuf-compiler,
                ragel,
index 36503a365efaf4256b71fa5f2ff8bd9d0bd69f55..87d979e8faa5305cc55bed651e59d87b79af864e 100755 (executable)
@@ -1,41 +1,61 @@
 #!/usr/bin/make -f
+include /usr/share/dpkg/architecture.mk
+include /usr/share/dpkg/pkg-info.mk
 
 # Turn on all hardening flags, as we're a networked daemon.
 # Note: blhc (build log hardening check) will find these false positives: CPPFLAGS 2 missing, LDFLAGS 1 missing
-export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow,+pie optimize=-lto
 # see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
 DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/default.mk
 
-CONFIGURE_ARGS =
+# Only enable systemd integration on Linux operating systems
+ifeq ($(DEB_HOST_ARCH_OS),linux)
+MESON_ARGS += -Dsystemd-service=enabled
+DH_ARGS += --with systemd
+else
+MESON_ARGS += -Dsystemd-service=disabled
+endif
 
-# Workaround for debbug #1078413 https://github.com/PowerDNS/pdns/issues/14084
-CONFIGURE_ARGS += --with-libcrypto=/usr
+# Only disable luajit on arm64
+#ifneq ($(DEB_HOST_ARCH),arm64)
+#MESON_ARGS += -Dlua=luajit
+#else
+MESON_ARGS += -Dlua=auto
+#endif
 
 %:
-       dh $@
+       dh $@ --buildsystem=meson \
+         $(DH_ARGS)
 
 override_dh_auto_clean:
        dh_auto_clean
        rm -f dnslabeltext.cc
        chmod +x mkpubsuffixcc || true
 
+# We need clang (LLVM) to link the Rust static library and the C++ code with LTO enabled
+# build-id SHA1 prevents an issue with the debug symbols ("export: `-Wl,--build-id=sha1': not a valid identifier")
+
 override_dh_auto_configure:
-       PATH=debian/configure-helpers/:$$PATH dh_auto_configure -- \
-               --sysconfdir=/etc/powerdns \
-               --enable-systemd --with-systemd=/lib/systemd/system \
-               --enable-unit-tests \
-               --disable-silent-rules \
-               --with-service-user=pdns \
-               --with-service-group=pdns \
-               --with-libcap \
-               --with-libsodium \
-               --with-lua \
-               --with-net-snmp \
-               --enable-dns-over-tls \
-               --enable-dnstap \
-               --enable-nod \
-               $(CONFIGURE_ARGS)
+       LDFLAGS="-latomic -fuse-ld=lld -Wl,--build-id=sha1" \
+       CC=clang \
+       CXX=clang++ \
+       PKG_CONFIG_PATH=/opt/lib/pkgconfig dh_auto_configure -- \
+       --sysconfdir=%{_sysconfdir}/%{name} \
+       -Db_lto=true \
+       -Db_lto_mode=thin \
+       -Db_pie=true \
+       -Dunit-tests=true \
+       -Ddns-over-tls=enabled \
+       -Ddnstap=enabled \
+       -Dlibcap=enabled \
+       -Dsigners-libsodium=enabled \
+       -Dsnmp=enabled \
+       -Dnod=enabled \
+       $(MESON_ARGS)
+
+override_dh_auto_build-arch:
+       dh_auto_build
 
 # Stop installing the Lua config files once we fully moved to YAML configuration
 override_dh_auto_install:
index b9318faa85f912eee034e132f1c09715c8a584a2..93aed050288e19a603a735f04d2b3d97a8816e01 100644 (file)
@@ -1,4 +1,4 @@
-FROM alpine:3.18 as pdns-authoritative
+FROM alpine:3.21 AS pdns-authoritative
 ARG BUILDER_CACHE_BUSTER=
 
 RUN apk add --no-cache gcc g++ make tar autoconf automake protobuf-dev lua-dev \
index bd84111fb3bc6ca2ad06662d7f657280f925ce94..3f4a0810a6f89bcbe48b1b6c03cbd3b1b2e75935 100644 (file)
@@ -1,4 +1,4 @@
-FROM dist-base as package-builder
+FROM dist-base AS package-builder
 ARG APT_URL
 RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends devscripts dpkg-dev build-essential python3-venv equivs curl jq
 
@@ -11,6 +11,9 @@ ADD builder-support/helpers/ /pdns/builder-support/helpers/
 @IF [ -n "$M_recursor$M_all" ]
 COPY --from=pdns-recursor /tmp/rust* /tmp
 RUN cd /pdns/builder-support/helpers/ && ./install_rust.sh
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends git cmake clang
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends python3-pip ninja-build
+RUN cd /pdns/builder-support/helpers/ && ./install_meson.sh
 @ENDIF
 
 @IF [ -n "$M_dnsdist$M_all" ]
@@ -36,9 +39,9 @@ RUN cp /sdist/pdns-${BUILDER_VERSION}.tar.bz2 pdns_${BUILDER_VERSION}.orig.tar.b
 @ENDIF
 
 @IF [ -n "$M_recursor$M_all" ]
-RUN tar xvf /sdist/pdns-recursor-${BUILDER_VERSION}.tar.bz2
+RUN tar xvf /sdist/pdns-recursor-${BUILDER_VERSION}.tar.xz
 # create copy of source tarball with name that dpkg-source requires
-RUN cp /sdist/pdns-recursor-${BUILDER_VERSION}.tar.bz2 pdns-recursor_${BUILDER_VERSION}.orig.tar.bz2
+RUN cp /sdist/pdns-recursor-${BUILDER_VERSION}.tar.xz pdns-recursor_${BUILDER_VERSION}.orig.tar.xz
 @ENDIF
 
 @IF [ -n "$M_dnsdist$M_all" ]
index 4c5f7ac568b75ca4ad2b856603072aac08bcbdda..0c39b90afb9e67dc90c9b3d11e72b29233a2b872 100644 (file)
@@ -1,4 +1,4 @@
-FROM alpine:3.21 as dnsdist
+FROM alpine:3.21 AS dnsdist
 ARG BUILDER_CACHE_BUSTER=
 
 RUN apk add --no-cache gcc g++ make tar autoconf automake protobuf-dev lua-dev \
index d134ec07398a59ff28d4d525f102ccd271ccb263..c087b9940dbee002c630be62deaf0a2ad7b97e1f 100644 (file)
@@ -1,7 +1,7 @@
 # First do the source builds
 @INCLUDE Dockerfile.target.sdist
 
-FROM debian:bookworm as dist-base
+FROM debian:bookworm AS dist-base
 
 ARG BUILDER_CACHE_BUSTER=
 ARG APT_URL
index af6d17f241fa04d8d5ca8469c5c6aab3d15a3f6a..be9ee6570ada103538cdf22d62c7e7255d2d0353 100644 (file)
@@ -1,7 +1,7 @@
 # First do the source builds
 @INCLUDE Dockerfile.target.sdist
 
-FROM debian:bullseye as dist-base
+FROM debian:bullseye AS dist-base
 
 ARG BUILDER_CACHE_BUSTER=
 ARG APT_URL
index 21759e0b618b7fd4e4575661123df9d24cfd208e..117ac53fa49b58500833bf91fa1a73a8de92bb5e 100644 (file)
@@ -1,7 +1,7 @@
 # First do the source builds
 @INCLUDE Dockerfile.target.sdist
 
-FROM debian:trixie as dist-base
+FROM debian:trixie AS dist-base
 
 ARG BUILDER_CACHE_BUSTER=
 ARG APT_URL
index 0d220eb426d1dcd90ec27fae8534e09b8c0a449b..45fe6630d011dae85bae59779eb2719ce83c468a 100644 (file)
@@ -10,7 +10,7 @@
 @INCLUDE Dockerfile.dnsdist
 @ENDIF
 
-FROM alpine:3.18 AS sdist
+FROM alpine:3.21 AS sdist
 ARG BUILDER_CACHE_BUSTER=
 
 @IF [ -z "$M_authoritative$M_recursor$M_dnsdist$M_all" ]
index ef53fbfa392898510ac1bac2634f507e222f3644..656b66a770d62e9bdaf89e1db9dac4b3c88cb740 100644 (file)
@@ -1,7 +1,7 @@
 # First do the source builds
 @INCLUDE Dockerfile.target.sdist
 
-FROM ubuntu:jammy as dist-base
+FROM ubuntu:jammy AS dist-base
 
 ARG BUILDER_CACHE_BUSTER=
 ARG APT_URL
index bc1b8dcd71254604fbdf89a2889db68be85f159d..84b97333ff250acaa580c0fe4d04f8dff6573df4 100644 (file)
@@ -1,7 +1,7 @@
 # First do the source builds
 @INCLUDE Dockerfile.target.sdist
 
-FROM ubuntu:noble as dist-base
+FROM ubuntu:noble AS dist-base
 
 ARG BUILDER_CACHE_BUSTER=
 ARG APT_URL
index 4734567e21ff4c9d7fcc59e3f6aa081f864d0f66..2af8721dc710eaae55405f5a446c65d4fefaf2c9 100644 (file)
@@ -1,7 +1,7 @@
 # First do the source builds
 @INCLUDE Dockerfile.target.sdist
 
-FROM ubuntu:oracular as dist-base
+FROM ubuntu:oracular AS dist-base
 
 ARG BUILDER_CACHE_BUSTER=
 ARG APT_URL
index b466a5ad12aeefa9a0fbefbc0dfc97f5917c0838..4e8401acc56c4dfed0b262500357cd61e6ec40c7 100644 (file)
@@ -78,6 +78,7 @@ subdir('meson' / 'libresolv')               # res_query
 subdir('meson' / 'dnstap')                  # DNSTAP through libfstream
 subdir('meson' / 'libcurl')                 # Curl
 subdir('meson' / 'libcap')                  # Capabilities
+subdir('meson' / 'dlopen')                  # our Rust static library needs dlopen
 
 subdir('rec-rust-lib')
 
@@ -306,6 +307,7 @@ deps = [
   dep_pdns,
   dep_no_config_in_source,
   dep_rust_recrust,
+  dep_dlopen,
   dep_boost,
   dep_boost_context,
   dep_threads,