From 92e4b99ade6c4e2f64644deb4c85520e3d096adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Fri, 8 Mar 2024 01:53:10 +0100 Subject: [PATCH] DEB libcarddav: Change the library package name in case of incompatible ABI for 64-bit time_t. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- .../dependencies/libcarddav/debian/rules | 44 +++++++++++++++++++ .../dependencies/libcarddav/debian/rules | 44 +++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/debian/_base/dependencies/libcarddav/debian/rules b/debian/_base/dependencies/libcarddav/debian/rules index e898aa6d2..22b8c9e32 100755 --- a/debian/_base/dependencies/libcarddav/debian/rules +++ b/debian/_base/dependencies/libcarddav/debian/rules @@ -4,6 +4,14 @@ include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/cmake.mk include debian/cdbs/debian-tde.mk +DEB_TIME64_API = $(shell echo | cc $(dpkg-buildflags --get CPPFLAGS) -dM -E -x c++ - | grep -q "_TIME_BITS 64" && echo true || false) +ifeq ($(DEB_TIME64_API),true) +DEB_TIME64_SUFFIX = 0t64 +else +DEB_TIME64_SUFFIX = +endif + + ifdef DEB_HOST_MULTIARCH CMAKE_INSTALL_LIBDIR = lib/$(DEB_HOST_MULTIARCH) else @@ -18,3 +26,39 @@ DEB_CMAKE_EXTRA_FLAGS := \ -DCMAKE_INSTALL_LIBDIR=$(CMAKE_INSTALL_LIBDIR) \ -DWITH_ALL_OPTIONS="ON" \ -DBUILD_ALL="ON" + +post-patches:: + dh_testdir +ifeq ($(DEB_TIME64_API),true) + # update library package name for TIME64 ABI + ls -d debian/* | \ + grep -E "/libcarddav\." | \ + grep -v "\.t64$$" | \ + while read a; do \ + [ -d $$a ] || [ -f $$a.t64 ] || \ + (cp -a $$a debian/libcarddav$(DEB_TIME64_SUFFIX).$${a##*.} && mv $$a $$a.t64); \ + done + [ -f debian/control.t64 ] || \ + sed -i.t64 \ + -e "s/^Package: \\(libcarddav\\)$$/Package: \\1$(DEB_TIME64_SUFFIX)\\nReplaces: \\1\\nBreaks: \\1/" \ + -e "s/\\(libcarddav\\) (=/\\1$(DEB_TIME64_SUFFIX) (=/" \ + debian/control +endif + +clean:: + dh_testdir + dh_clean + +ifeq ($(DEB_TIME64_API),true) + # revert library package name for TIME64 ABI + ls -d debian/* | \ + grep -E "\.t64$$" | \ + while read a; do \ + mv $$a $${a%.t64}; \ + done + ls -d debian/* | \ + grep -E "/libcarddav$(DEB_TIME64_SUFFIX)\." | \ + xargs -r rm + [ ! -f debian/control.t64 ] || \ + mv debian/control.t64 debian/control +endif diff --git a/ubuntu/_base/dependencies/libcarddav/debian/rules b/ubuntu/_base/dependencies/libcarddav/debian/rules index e898aa6d2..22b8c9e32 100755 --- a/ubuntu/_base/dependencies/libcarddav/debian/rules +++ b/ubuntu/_base/dependencies/libcarddav/debian/rules @@ -4,6 +4,14 @@ include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/cmake.mk include debian/cdbs/debian-tde.mk +DEB_TIME64_API = $(shell echo | cc $(dpkg-buildflags --get CPPFLAGS) -dM -E -x c++ - | grep -q "_TIME_BITS 64" && echo true || false) +ifeq ($(DEB_TIME64_API),true) +DEB_TIME64_SUFFIX = 0t64 +else +DEB_TIME64_SUFFIX = +endif + + ifdef DEB_HOST_MULTIARCH CMAKE_INSTALL_LIBDIR = lib/$(DEB_HOST_MULTIARCH) else @@ -18,3 +26,39 @@ DEB_CMAKE_EXTRA_FLAGS := \ -DCMAKE_INSTALL_LIBDIR=$(CMAKE_INSTALL_LIBDIR) \ -DWITH_ALL_OPTIONS="ON" \ -DBUILD_ALL="ON" + +post-patches:: + dh_testdir +ifeq ($(DEB_TIME64_API),true) + # update library package name for TIME64 ABI + ls -d debian/* | \ + grep -E "/libcarddav\." | \ + grep -v "\.t64$$" | \ + while read a; do \ + [ -d $$a ] || [ -f $$a.t64 ] || \ + (cp -a $$a debian/libcarddav$(DEB_TIME64_SUFFIX).$${a##*.} && mv $$a $$a.t64); \ + done + [ -f debian/control.t64 ] || \ + sed -i.t64 \ + -e "s/^Package: \\(libcarddav\\)$$/Package: \\1$(DEB_TIME64_SUFFIX)\\nReplaces: \\1\\nBreaks: \\1/" \ + -e "s/\\(libcarddav\\) (=/\\1$(DEB_TIME64_SUFFIX) (=/" \ + debian/control +endif + +clean:: + dh_testdir + dh_clean + +ifeq ($(DEB_TIME64_API),true) + # revert library package name for TIME64 ABI + ls -d debian/* | \ + grep -E "\.t64$$" | \ + while read a; do \ + mv $$a $${a%.t64}; \ + done + ls -d debian/* | \ + grep -E "/libcarddav$(DEB_TIME64_SUFFIX)\." | \ + xargs -r rm + [ ! -f debian/control.t64 ] || \ + mv debian/control.t64 debian/control +endif