]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: build dist tarball and el-x packages using meson
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 26 May 2025 08:38:43 +0000 (10:38 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 2 Jun 2025 10:17:37 +0000 (12:17 +0200)
builder-support/dockerfiles/Dockerfile.recursor
builder-support/dockerfiles/Dockerfile.rpmbuild
builder-support/dockerfiles/Dockerfile.rpmtest
builder-support/dockerfiles/Dockerfile.target.el-9
builder-support/dockerfiles/Dockerfile.target.sdist
builder-support/specs/pdns-recursor.spec
pdns/recursordist/meson.build

index 6a2a3f0143dc64f9606825717f28f9911aa1b7dc..3533a7ef04aae5dcf1ffbdc21c8615be91a64e1f 100644 (file)
@@ -1,26 +1,23 @@
-FROM alpine:3.18 as pdns-recursor
+FROM alpine:3.21 AS pdns-recursor
 ARG BUILDER_CACHE_BUSTER=
 
 RUN apk add --no-cache gcc g++ make tar autoconf automake protobuf-dev lua-dev \
                        libtool file boost-dev curl openssl-dev ragel python3 \
-                       flex bison git bash jq
+                       flex bison git bash jq meson
 
-ADD COPYING NOTICE /pdns-recursor/
-@EXEC sdist_dirs=(build-aux m4 pdns ext docs)
-@EXEC for d in ${sdist_dirs[@]} ; do echo "COPY $d/ /pdns-recursor/$d/" ; done
-ADD builder/helpers/set-configure-ac-version.sh /pdns-recursor/builder/helpers/
-ADD builder-support/gen-version /pdns-recursor/pdns/recursordist/builder-support/gen-version
-WORKDIR /pdns-recursor/pdns/recursordist
+COPY . /pdns-recursor
+WORKDIR /pdns-recursor
 
-ADD builder-support/helpers/ /pdns/builder-support/helpers/
-RUN cd /pdns/builder-support/helpers/ && \
+#ADD builder-support/helpers/ /pdns/builder-support/helpers/
+RUN cd /pdns-recursor/builder-support/helpers/ && \
     ./install_rust.sh
 
 RUN mkdir /sdist
 
 ARG BUILDER_VERSION
-RUN /pdns-recursor/builder/helpers/set-configure-ac-version.sh && \
-     autoreconf -v -i --force && \
-    ./configure --disable-dependency-tracking && \
-    make dist
-RUN cp pdns-recursor-${BUILDER_VERSION}.tar.bz2 /sdist/
+
+RUN cd /pdns-recursor/pdns/recursordist && \
+    meson setup /tmp/rec-meson-dist-build && \
+    meson dist -C /tmp/rec-meson-dist-build --no-tests
+
+RUN cp /tmp/rec-meson-dist-build/meson-dist/pdns-recursor-${BUILDER_VERSION}.tar.xz /sdist/
index f233c2cbc717e29a80a802178c2948e5ce567ec8..82cd02d4354fc913383ed9eead89c53831713344 100644 (file)
@@ -1,4 +1,4 @@
-FROM dist-base as package-builder
+FROM dist-base AS package-builder
 RUN if $(grep -q 'release 8' /etc/redhat-release); then \
       yum upgrade -y && \
       yum install --allowerasing -y rpm-build rpmdevtools python3.12 curl jq "@Development Tools" ninja-build hostname python3.12-pip python3.12-yaml ; \
@@ -17,7 +17,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 cd /pdns/builder-support/helpers/ && ./install_rust.sh && \
+    yum install -y git cmake clang
+RUN cd /pdns/builder-support/helpers/ && ./install_meson.sh
 @ENDIF
 
 @IF [ -n "$M_dnsdist$M_all" ]
index e398ffcf46c3a06a8e0305b2f908fe7cc5f035b6..68d9f6d014f97525b86f95de31230770c7a7a061 100644 (file)
@@ -1,5 +1,5 @@
 # Install the built rpms and test them
-FROM dist-base as dist
+FROM dist-base AS dist
 
 # If you want to install extra packages or do generic configuration,
 # do it before the COPY. Either here, or in the dist-base layer.
index 5aca4059a21b480aa30924de80a0a1fc8a4a0726..f7a4e50bbe6dd00cc681470b0bc97e3f9a429f5d 100644 (file)
@@ -3,7 +3,7 @@
 
 # This defines the distribution base layer
 # Put only the bare minimum of common commands here, without dev tools
-FROM oraclelinux:9 as dist-base
+FROM oraclelinux:9 AS dist-base
 
 ARG BUILDER_CACHE_BUSTER=
 RUN touch /var/lib/rpm/* && dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
index 919fb6ebac64f98a9dfee7fff6b4a8417983a000..0d220eb426d1dcd90ec27fae8534e09b8c0a449b 100644 (file)
@@ -10,7 +10,7 @@
 @INCLUDE Dockerfile.dnsdist
 @ENDIF
 
-FROM alpine:3.18 as sdist
+FROM alpine:3.18 AS sdist
 ARG BUILDER_CACHE_BUSTER=
 
 @IF [ -z "$M_authoritative$M_recursor$M_dnsdist$M_all" ]
index 8559a551f0567152bdf89bdcf0120609306b2f63..19986238c618c77ce1f99fcd4fb3d28dcdfe6d66 100644 (file)
@@ -6,19 +6,24 @@ Group: System Environment/Daemons
 License: GPLv2
 Vendor: PowerDNS.COM BV
 URL: https://powerdns.com
-Source0: %{name}-%{getenv:BUILDER_VERSION}.tar.bz2
+Source0: %{name}-%{getenv:BUILDER_VERSION}.tar.xz
 
 Provides: powerdns-recursor = %{version}-%{release}
 
+BuildRequires: clang
+BuildRequires: lld
+
 BuildRequires: boost-devel
-BuildRequires: libcap-devel
-BuildRequires: systemd
-BuildRequires: systemd-devel
-BuildRequires: openssl-devel
 BuildRequires: fstrm-devel
+BuildRequires: hostname
+BuildRequires: libcap-devel
 BuildRequires: libcurl-devel
-BuildRequires: net-snmp-devel
 BuildRequires: libsodium-devel
+BuildRequires: net-snmp-devel
+BuildRequires: ninja-build
+BuildRequires: openssl-devel
+BuildRequires: systemd
+BuildRequires: systemd-devel
 
 %ifarch aarch64
 BuildRequires: lua-devel
@@ -43,30 +48,58 @@ package if you need a dns cache for your network.
 %prep
 %autosetup -p1 -n %{name}-%{getenv:BUILDER_VERSION}
 
+%if 0%{?rhel} >= 9
+%global toolchain clang
+%else
+# we need to disable the hardened flags because they are GCC-only
+%undefine _hardened_build
+%endif
+
 %build
+# We need to build with LLVM/clang to be able to use LTO, since we are linking against a static Rust library built with LLVM
+export CC=clang
+export CXX=clang++
+# build-id SHA1 prevents an issue with the debug symbols ("export: `-Wl,--build-id=sha1': not a valid identifier")
+export LDFLAGS="-fuse-ld=lld -Wl,--build-id=sha1"
+
+%if 0%{?rhel} < 9
+# starting with EL-9 we get these hardening settings for free by just setting the right toolchain (see above)
+%ifarch aarch64
+%define cf_protection %{nil}
+%else
+%define cf_protection -fcf-protection
+%endif
+%if "%{_arch}" == "aarch64" && 0%{?amzn2023}
+%define stack_clash_protection %{nil}
+%else
+%define stack_clash_protection -fstack-clash-protection
+%endif
+export CFLAGS="-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -gdwarf-4"
+export CXXFLAGS="-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -gdwarf-4"
+%endif
 
-%configure \
-    --enable-option-checking=fatal \
+# Note that the RPM meson macro "helpfully" sets
+# --auto-features=enabled so our auto-detection is broken
+%meson \
     --sysconfdir=%{_sysconfdir}/%{name} \
-    --disable-silent-rules \
-    --disable-static \
-    --enable-unit-tests \
-    --enable-dns-over-tls \
-    --enable-dnstap \
-    --with-libcap \
-    --with-lua=%{lua_implementation} \
-    --with-libsodium \
-    --with-net-snmp \
-    --enable-systemd --with-systemd=%{_unitdir} \
-    --enable-nod
-
-make %{?_smp_mflags}
+    -Dunit-tests=true \
+    -Db_lto=true \
+    -Db_lto_mode=thin \
+    -Db_pie=true \
+    -Ddns-over-tls=enabled \
+    -Ddnstap=enabled \
+    -Dlibcap=enabled \
+    -Dlua=%{lua_implementation} \
+    -Dsigners-libsodium=enabled \
+    -Dsnmp=enabled \
+    -Dnod=enabled
+%meson_build
 
 %check
-make %{?_smp_mflags} check || (cat test-suite.log && false)
+%meson_test
 
 %install
-make install DESTDIR=%{buildroot}
+%meson_install
 
 %{__mkdir} %{buildroot}%{_sysconfdir}/%{name}/recursor.d
 
index 40da702aa80eb14d1d00c3b53eeedef488edd528..b466a5ad12aeefa9a0fbefbc0dfc97f5917c0838 100644 (file)
@@ -609,6 +609,11 @@ if python.found()
       foreach man_page: info['manpages']
         if not fs.is_file(man_page)
           generated_man_pages += man_page
+        else
+          install_man(
+            man_page,
+            install_dir: join_paths(get_option('mandir'), 'man1'),
+          )
         endif
       endforeach
     endif