Skip to content

Commit

Permalink
dnsdist: Disable SONAME support in Quiche
Browse files Browse the repository at this point in the history
We are going to install it as libdnsdist-quiche anyway, so no-one
else should use it, and the SONAME makes it harder for us to package
it properly.
  • Loading branch information
rgacogne committed Jul 26, 2024
1 parent 55e2387 commit d07aaa4
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 17 deletions.
3 changes: 1 addition & 2 deletions Dockerfile-dnsdist
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ RUN mkdir /build && \
make $MAKEFLAGS install DESTDIR=/build && make clean && \
strip /build/usr/local/bin/* &&\
mkdir -p /build/usr/lib/ && \
cp -rf /usr/lib/libdnsdist-quiche.so /build/usr/lib/ && \
ln -s /build/usr/lib/libdnsdist-quiche.so /build/usr/lib/libdnsdist-quiche.so.0
cp -rf /usr/lib/libdnsdist-quiche.so /build/usr/lib/

RUN cd /tmp && mkdir /build/tmp/ && mkdir debian && \
echo 'Source: docker-deps-for-pdns' > debian/control && \
Expand Down
1 change: 0 additions & 1 deletion builder-support/debian/dnsdist/debian-bookworm/rules
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ override_dh_auto_build-arch:
override_dh_install:
dh_auto_install
install -Dm644 /usr/lib/libdnsdist-quiche.so debian/dnsdist/usr/lib/libdnsdist-quiche.so
ln -s debian/dnsdist/usr/lib/libdnsdist-quiche.so debian/dnsdist/usr/lib/libdnsdist-quiche.so.0
ifeq ($(DEB_HOST_ARCH_BITS),32)
echo RestrictAddressFamilies is broken on 32bit, removing it from service file
perl -ni -e 'print unless /RestrictAddressFamilies/' debian/dnsdist/lib/systemd/system/*.service
Expand Down
1 change: 0 additions & 1 deletion builder-support/debian/dnsdist/debian-buster/rules
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ override_dh_auto_build-arch:
override_dh_install:
dh_auto_install
install -Dm644 /usr/lib/libdnsdist-quiche.so debian/dnsdist/usr/lib/libdnsdist-quiche.so
ln -s debian/dnsdist/usr/lib/libdnsdist-quiche.so debian/dnsdist/usr/lib/libdnsdist-quiche.so.0
ifeq ($(DEB_HOST_ARCH_BITS),32)
echo RestrictAddressFamilies is broken on 32bit, removing it from service file
perl -ni -e 'print unless /RestrictAddressFamilies/' debian/dnsdist/lib/systemd/system/*.service
Expand Down
14 changes: 6 additions & 8 deletions builder-support/helpers/install_quiche.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,16 @@ echo $0: Checking that the hash of ${QUICHE_TARBALL} is ${QUICHE_TARBALL_HASH}
echo "${QUICHE_TARBALL_HASH}" "${QUICHE_TARBALL}" | sha256sum -c -
tar xf "${QUICHE_TARBALL}"
cd "quiche-${QUICHE_VERSION}"
mv quiche dnsdist-quiche
RUST_BACKTRACE=1 cargo build --release --no-default-features --features ffi,boringssl-boring-crate --package dnsdist-quiche
# Disable SONAME in the quiche shared library, we do not intend this library to be used by anyone else and it makes things more complicated since we rename it to libdnsdist-quiche
sed -i 's/ffi = \["dep:cdylib-link-lines"\]/ffi = \[\]/' quiche/Cargo.toml
sed -i 's,cdylib_link_lines::metabuild();,//cdylib_link_lines::metabuild();,' quiche/src/build.rs
RUST_BACKTRACE=1 cargo build --release --no-default-features --features ffi,boringssl-boring-crate --package quiche

install -m644 dnsdist-quiche/include/quiche.h "${INSTALL_PREFIX}"/include
install -m644 target/release/libdnsdist-quiche.${SOEXT} "${INSTALL_PREFIX}"/lib/libdnsdist-quiche.${SOEXT}
install -m644 quiche/include/quiche.h "${INSTALL_PREFIX}"/include
install -m644 target/release/libquiche.${SOEXT} "${INSTALL_PREFIX}"/lib/libdnsdist-quiche.${SOEXT}

if [ $(uname) = Darwin ]; then
ln -s "${INSTALL_PREFIX}"/lib/libdnsdist-quiche.${SOEXT} "${INSTALL_PREFIX}"/lib/libdnsdist-quiche.0.${SOEXT}
install_name_tool -id "${INSTALL_PREFIX}"/lib/libdnsdist-quiche.${SOEXT} "${INSTALL_PREFIX}"/lib/libdnsdist-quiche.${SOEXT}
install_name_tool -id "${INSTALL_PREFIX}"/lib/libdnsdist-quiche.0.${SOEXT} "${INSTALL_PREFIX}"/lib/libdnsdist-quiche.0.${SOEXT}
else
ln -s "${INSTALL_PREFIX}"/lib/libdnsdist-quiche.${SOEXT} "${INSTALL_PREFIX}"/lib/libdnsdist-quiche.${SOEXT}.0
fi

if [ ! -d "${INSTALL_PREFIX}"/lib/pkgconfig/ ]; then
Expand Down
4 changes: 1 addition & 3 deletions builder-support/specs/dnsdist.spec
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ make %{?_smp_mflags} check || (cat test-suite.log && false)
install -d %{buildroot}/%{_sysconfdir}/dnsdist
%if 0%{?rhel} >= 8 || 0%{?amzn} == 2023
install -Dm644 /usr/lib/libdnsdist-quiche.so %{buildroot}/%{_libdir}/libdnsdist-quiche.so
ln -rs %{buildroot}/%{_libdir}/libdnsdist-quiche.so %{buildroot}/%{_libdir}/libdnsdist-quiche.so.0
%endif
%{__mv} %{buildroot}%{_sysconfdir}/dnsdist/dnsdist.conf-dist %{buildroot}%{_sysconfdir}/dnsdist/dnsdist.conf
chmod 0640 %{buildroot}/%{_sysconfdir}/dnsdist/dnsdist.conf
Expand Down Expand Up @@ -171,9 +170,8 @@ systemctl daemon-reload ||:
%doc README.md
%{_bindir}/*
%if 0%{?rhel} >= 8 || 0%{?amzn} == 2023
%define __requires_exclude libdnsdist-quiche\\.so*
%define __requires_exclude libdnsdist-quiche\\.so
%{_libdir}/libdnsdist-quiche.so
%{_libdir}/libdnsdist-quiche.so.0
%endif
%{_mandir}/man1/*
%dir %{_sysconfdir}/dnsdist
Expand Down
5 changes: 3 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,13 +1059,14 @@ def ci_build_and_install_quiche(c, repo):
c.run(f'echo {quiche_hash}" "quiche-{quiche_version}.tar.gz | sha256sum -c -')
c.run(f'tar xf quiche-{quiche_version}.tar.gz')
with c.cd(f'quiche-{quiche_version}'):
# Disable SONAME in the quiche shared library, we do not intend this library to be used by anyone else and it makes things more complicated since we rename it to libdnsdist-quiche
c.run('sed -i \'s/ffi = \["dep:cdylib-link-lines"\]/ffi = \[\]/\' quiche/Cargo.toml')
c.run('sed -i \'s,cdylib_link_lines::metabuild();,//cdylib_link_lines::metabuild();,\' quiche/src/build.rs')
c.run('cargo build --release --no-default-features --features ffi,boringssl-boring-crate --package quiche')
# cannot use c.sudo() inside a cd() context, see https://github.com/pyinvoke/invoke/issues/687
c.run('sudo install -Dm644 quiche/include/quiche.h /usr/include')
c.run('sudo install -Dm644 target/release/libquiche.so /usr/lib')
c.run('sudo ln -s /usr/lib/libquiche.so /usr/lib/libquiche.so.0')
c.run('install -D target/release/libquiche.so /opt/dnsdist/lib/libquiche.so')
c.run('sudo ln -s /opt/dnsdist/lib/libquiche.so /opt/dnsdist/lib/libquiche.so.0')
c.run(f"""sudo install -Dm644 /dev/stdin /usr/lib/pkgconfig/quiche.pc <<PC
# quiche
Name: quiche
Expand Down

0 comments on commit d07aaa4

Please sign in to comment.