From 73ea0ababad4845e211121bed2e046d96299116d Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Fri, 22 May 2020 15:01:50 -0400 Subject: Build static libraries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Build archives in addition to shared objects for Abseil code. Build the shared objects after the archives so that files autogenerated during the build (like CMake support files) reference the shared objects, not the archives. This ensures that users get shared objects by default; this is the common case in Debian, and it also helps prevent ODR violations caused by double-linking an archive. This patch is heavily based on one provided in by László Böszörményi (GCS) ; it’s available on the web at https://bugs.debian.org/888705#150. --- debian/libabsl-dev.install | 1 + debian/rules | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/debian/libabsl-dev.install b/debian/libabsl-dev.install index 6a5120e6..db5108c6 100644 --- a/debian/libabsl-dev.install +++ b/debian/libabsl-dev.install @@ -13,5 +13,6 @@ # the License. usr/include/absl +usr/lib/*/*.a usr/lib/*/*.so usr/lib/*/cmake diff --git a/debian/rules b/debian/rules index 4c276263..ed4e354a 100755 --- a/debian/rules +++ b/debian/rules @@ -18,9 +18,19 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow %: dh $@ +override_dh_auto_clean: + $(RM) -r $(CURDIR)/static + $(RM) -r $(CURDIR)/shared + override_dh_auto_configure: - dh_auto_configure -- -DCMAKE_CXX_STANDARD=14 -DBUILD_SHARED_LIBS=ON + dh_auto_configure -Bstatic -- -DCMAKE_CXX_STANDARD=14 -DBUILD_SHARED_LIBS=OFF + dh_auto_configure -Bshared -- -DCMAKE_CXX_STANDARD=14 -DBUILD_SHARED_LIBS=ON + +override_dh_auto_build: + dh_auto_build -Bstatic + dh_auto_build -Bshared override_dh_auto_install: - dh_auto_install + dh_auto_install -Bstatic + dh_auto_install -Bshared find debian/tmp -type d -empty -delete -- cgit v1.2.3