summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@google.com>2020-05-22 15:01:50 -0400
committerGravatar Benjamin Barenblat <bbaren@google.com>2020-05-22 15:01:50 -0400
commit73ea0ababad4845e211121bed2e046d96299116d (patch)
tree1df38f047c14835b286719b06f476a1715c47672
parent39a4eeaa163078ff988e63c0f83ae9611ed913de (diff)
Build static libraries
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 <CAKjSHr2qpxgDcnRVoYCptVytTy-QjXy38AM4ppSKv1noXOGjwg@mail.gmail.com> by László Böszörményi (GCS) <gcs@debian.org>; it’s available on the web at https://bugs.debian.org/888705#150.
-rw-r--r--debian/libabsl-dev.install1
-rwxr-xr-xdebian/rules14
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