]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix building Debian and Ubuntu packages with meson
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 20 Feb 2025 14:28:50 +0000 (15:28 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 7 Mar 2025 16:25:02 +0000 (17:25 +0100)
builder-support/debian/dnsdist/debian-bookworm/control
builder-support/debian/dnsdist/debian-bookworm/rules
builder-support/dockerfiles/Dockerfile.debbuild
builder-support/dockerfiles/Dockerfile.debbuild-prepare
builder-support/helpers/install_meson.sh

index 4796af9690910f7c2cdc0fb7618777462f500388..b132d6eccfa66ad95158e091393bd1596d9bf758 100644 (file)
@@ -24,6 +24,8 @@ Build-Depends: debhelper (>= 10),
                libwslay-dev,
                libxdp-dev [linux-any],
                lld,
+               meson,
+               ninja-build,
                pkg-config,
                python3-yaml,
                ragel,
index c02ed55e8004e10524eed0b6d66c05d26e0924a7..d6ab520fa4120dcbfa462f3c4e9cec637abe7d6e 100755 (executable)
@@ -8,79 +8,76 @@ export DEB_BUILD_MAINT_OPTIONS=hardening=+bindnow,+pie
 DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/default.mk
 
-# for atomic support on powerpc (automatic on mipsel)
-LDFLAGS += -latomic
-# 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")
-# and the --no-as-needed -ldl an issue with the dlsym not being found ("ld.lld: error: undefined symbol: dlsym eferenced by weak.rs:142 (library/std/src/sys/pal/unix/weak.rs:142) [...] in archive ./dnsdist-rust-lib/rust/libdnsdist_rust.a)
-LDFLAGS += -fuse-ld=lld -Wl,--build-id=sha1 -Wl,--no-as-needed -ldl
-CC=clang
-CXX=clang++
-
 # Only enable systemd integration on Linux operating systems
 ifeq ($(DEB_HOST_ARCH_OS),linux)
-CONFIGURE_ARGS += --enable-systemd --with-systemd=/lib/systemd/system
+MESON_ARGS += -Dsystemd=enabled
 DH_ARGS += --with systemd
 else
-CONFIGURE_ARGS += --disable-systemd
+MESON_ARGS += -Dsystemd=disabled
 endif
 
 # Only enable BPF/XDP on Linux operating systems
 ifeq ($(DEB_HOST_ARCH_OS),linux)
-CONFIGURE_ARGS += --with-xsk
+MESON_ARGS += -Dxsk=enabled
 else
-CONFIGURE_ARGS += --without-xsk
+MESON_ARGS += -Dxsk=disabled
 endif
 
 # Only disable luajit on arm64
 ifneq ($(DEB_HOST_ARCH),arm64)
-CONFIGURE_ARGS += --with-lua=luajit
+MESON_ARGS += -Dlua=luajit
 else
-CONFIGURE_ARGS += --with-lua=lua5.3
+MESON_ARGS += -Dlua=lua
 endif
 
 %:
-       dh $@ \
-         --with autoreconf \
+       dh $@ --buildsystem=meson \
          $(DH_ARGS)
 
 override_dh_auto_clean:
        rm -f dnslabeltext.cc
        dh_auto_clean
 
+# for atomic support on powerpc (automatic on mipsel)
+#LDFLAGS += -latomic
+# 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")
+# and the --no-as-needed -ldl an issue with the dlsym not being found ("ld.lld: error: undefined symbol: dlsym eferenced by weak.rs:142 (library/std/src/sys/pal/unix/weak.rs:142) [...] in archive ./dnsdist-rust-lib/rust/libdnsdist_rust.a)
+# LDFLAGS += -fuse-ld=lld -Wl,--build-id=sha1 -Wl,--no-as-needed -ldl
+# CC=clang
+# CXX=clang++
+
 override_dh_auto_configure:
-       ./configure \
-         --host=$(DEB_HOST_GNU_TYPE) \
-         --build=$(DEB_BUILD_GNU_TYPE) \
-         --prefix=/usr \
+       LDFLAGS="-latomic -fuse-ld=lld -Wl,--build-id=sha1 -Wl,--no-as-needed -ldl" \
+       CC=clang \
+       CXX=clang++ \
+       PKG_CONFIG_PATH=/opt/lib/pkgconfig dh_auto_configure -- \
          --sysconfdir=/etc/dnsdist \
-         --mandir=\$${prefix}/share/man \
-         --infodir=\$${prefix}/share/info \
-         --libdir='$${prefix}/lib/$(DEB_HOST_MULTIARCH)' \
-         --libexecdir='$${prefix}/lib' \
-         --enable-lto=thin \
-         --enable-dns-over-https \
-         --enable-dns-over-quic \
-         --enable-dns-over-http3 \
-         --enable-dns-over-tls \
-         --enable-dnscrypt \
-         --enable-dnstap \
-         --enable-yaml \
-         --with-ebpf \
-         --with-gnutls \
-         --with-h2o \
-         --with-net-snmp \
-         --with-libcap \
-         --with-libsodium \
-         --with-quiche \
-         --with-re2 \
-         --with-service-user='_dnsdist' \
-         --with-service-group='_dnsdist' \
-         $(CONFIGURE_ARGS) \
-         PKG_CONFIG_PATH=/opt/lib/pkgconfig
+         -Dunit-tests=true \
+          -Db_lto=true \
+         -Db_lto_mode=thin \
+         -Db_pie=true \
+         -Ddns-over-https=true \
+         -Ddns-over-quic=true \
+         -Ddns-over-http3=true \
+         -Ddns-over-tls=true \
+         -Ddnscrypt=enabled \
+         -Ddnstap=enabled \
+         -Dyaml=enabled \
+         -Debpf=enabled \
+         -Dyaml=enabled \
+         -Dtls-gnutls=enabled \
+         -Dsnmp=true \
+         -Dlibcap=enabled \
+         -Dlibsodium=enabled \
+         -Dquiche=enabled \
+         -Dre2=enabled \
+         -Dsystemd-service-user='_dnsdist' \
+         -Dsystemd-service-group='_dnsdist' \
+         $(MESON_ARGS)
 
 override_dh_auto_build-arch:
-       dh_auto_build -- V=1
+       dh_auto_build
 
 override_dh_install:
        dh_auto_install
index bbf65dc45a8f0965ae1b94022600902f41cc7561..46b315d74b0ac2e3cce51cc64759139ca819b9e4 100644 (file)
@@ -16,11 +16,6 @@ RUN mv pdns-recursor*.deb /dist; mv pdns-recursor*.ddeb /dist || true
 @ENDIF
 
 @IF [ -n "$M_dnsdist$M_all" ]
-RUN mkdir /libh2o && cd /libh2o && \
-      apt-get update && apt-get install -y cmake curl libssl-dev zlib1g-dev && \
-      cd /pdns/builder-support/helpers/ && \
-      ./install_h2o.sh
-
 RUN builder/helpers/build-debs.sh dnsdist-${BUILDER_VERSION}
 
 RUN mv dnsdist*.deb /dist; mv dnsdist*.ddeb /dist || true
index f88459354ff6683672414299d224751b3b13ef83..300720e5f014ac8cffc10d2db227e2ecb66fe19e 100644 (file)
@@ -15,8 +15,9 @@ RUN cd /pdns/builder-support/helpers/ && ./install_rust.sh
 
 @IF [ -n "$M_dnsdist$M_all" ]
 RUN cd /pdns/builder-support/helpers/ && ./install_rust.sh
-RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends git cmake clang ninja-build
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends git cmake clang
 RUN cd /pdns/builder-support/helpers/ && ./install_quiche.sh
+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
 
@@ -41,7 +42,7 @@ RUN cp /sdist/pdns-recursor-${BUILDER_VERSION}.tar.bz2 pdns-recursor_${BUILDER_V
 @ENDIF
 
 @IF [ -n "$M_dnsdist$M_all" ]
-RUN tar xvf /sdist/dnsdist-${BUILDER_VERSION}.tar.bz2
+RUN tar xvf /sdist/dnsdist-${BUILDER_VERSION}.tar.xz
 # create copy of source tarball with name that dpkg-source requires
-RUN cp /sdist/dnsdist-${BUILDER_VERSION}.tar.bz2 dnsdist_${BUILDER_VERSION}.orig.tar.bz2
+RUN cp /sdist/dnsdist-${BUILDER_VERSION}.tar.xz dnsdist_${BUILDER_VERSION}.orig.tar.zx
 @ENDIF
index b29b7cc7f005e7bc3e4e151c8024d6d4b7281497..5ab98de3dc44a6f21e70734a4ae519c57a1b7f9b 100755 (executable)
@@ -18,10 +18,16 @@ cd "meson-${MESON_VERSION}"
 
 install -Dpm0644 -t /usr/lib/rpm/macros.d/ data/macros.meson
 
-python3 -m pip install .
+python3 -m pip install . --break-system-packages || python3 -m pip install .
 ln -s /usr/local/bin/meson /usr/bin/meson
 PYVERS=$(python3 --version | sed 's/Python //' | cut -d. -f1,2)
-ln -s "/usr/local/lib/python${PYVERS}/site-packages/mesonbuild" /usr/lib/python${PYVERS}/site-packages/mesonbuild
+if [ -d "/usr/local/lib/python${PYVERS}/dist-packages/mesonbuild" ]; then
+    # thanks, Debian and Ubuntu, much appreciated..
+    mkdir -p "/usr/lib/python${PYVERS}/dist-packages/mesonbuild"
+    ln -s "/usr/local/lib/python${PYVERS}/dist-packages/mesonbuild" "/usr/lib/python${PYVERS}/dist-packages/mesonbuild"
+else
+    ln -s "/usr/local/lib/python${PYVERS}/site-packages/mesonbuild" "/usr/lib/python${PYVERS}/site-packages/mesonbuild"
+fi
 
 cd ..
 rm -rf "${MESON_TARBALL}" "meson-${MESON_VERSION}"