summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@google.com>2022-05-27 17:04:10 -0400
committerGravatar Benjamin Barenblat <bbaren@google.com>2022-05-27 17:04:10 -0400
commit2d23a3e16abfcf8f22ba850d67e972cc77e98874 (patch)
tree20c84476b1477645b82ea6265508e8faedf3daa9
parent99c09d4332c1c5e2e6233cc2e72ac10e345cfc6d (diff)
Correct pkg-config file generation20210324.2-4
Backport a patch from upstream to make CMake generate pkg-config files correctly. Add an autopkgtest to ensure this doesn’t regress.
-rw-r--r--debian/changelog8
-rw-r--r--debian/copyright2
-rw-r--r--debian/patches/pkg-config-libs-generation.diff36
-rw-r--r--debian/patches/series1
-rwxr-xr-xdebian/tests/bug101129424
-rw-r--r--debian/tests/control3
6 files changed, 73 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 296ed36f..22d44a71 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+abseil (0~20210324.2-4) unstable; urgency=medium
+
+ * Fix "spurious -Wl flag in some pkg-config entries" by backporting a
+ patch from upstream that corrects CMake pkg-config generation.
+ (Closes: #1011294)
+
+ -- Benjamin Barenblat <bbaren@debian.org> Fri, 27 May 2022 16:58:38 -0400
+
abseil (0~20210324.2-3) unstable; urgency=medium
* Backport an upstream patch to disable a problematic unit test.
diff --git a/debian/copyright b/debian/copyright
index 986a4261..260a1b8e 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -12,7 +12,7 @@ Copyright:
License: Apache-2.0
Files: debian/*
-Copyright: 2020 Google LLC
+Copyright: 2020-2022 Google LLC
License: Apache-2.0
License: Apache-2.0
diff --git a/debian/patches/pkg-config-libs-generation.diff b/debian/patches/pkg-config-libs-generation.diff
new file mode 100644
index 00000000..5f217765
--- /dev/null
+++ b/debian/patches/pkg-config-libs-generation.diff
@@ -0,0 +1,36 @@
+From: Benjamin Barenblat <bbaren@google.com>
+Subject: Check printf format strings in str_format_convert_test
+Forwarded: yes
+Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/1963f10ae5cb32a7ea6d96b928f69d3c7fba0139
+Bug-Debian: https://bugs.debian.org/1011294
+
+Don’t use generator expression to build .pc Libs lines
+
+When building pkg-config files, compute linker flags with a string
+substitution rather than the JOIN generator expression. This ensures
+that commas in linker flags don’t get treated as argument separators in
+JOIN.
+
+The author works at Google. Upstream applied this patch as Piper
+revision 450675966 and exported it to GitHub; the Applied-Upstream URL
+above points to the exported commit.
+
+--- a/CMake/AbseilHelpers.cmake
++++ b/CMake/AbseilHelpers.cmake
+@@ -167,6 +167,7 @@
+ set(PC_CFLAGS "${PC_CFLAGS} ${cflag}")
+ endif()
+ endforeach()
++ string(REPLACE ";" " " PC_LINKOPTS "${ABSL_CC_LIB_LINKOPTS}")
+ FILE(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/lib/pkgconfig/absl_${_NAME}.pc" CONTENT "\
+ prefix=${CMAKE_INSTALL_PREFIX}\n\
+ exec_prefix=\${prefix}\n\
+@@ -178,7 +179,7 @@
+ URL: https://abseil.io/\n\
+ Version: ${PC_VERSION}\n\
+ Requires:${PC_DEPS}\n\
+-Libs: -L\${libdir} $<JOIN:${ABSL_CC_LIB_LINKOPTS}, > $<$<NOT:$<BOOL:${ABSL_CC_LIB_IS_INTERFACE}>>:-labsl_${_NAME}>\n\
++Libs: -L\${libdir} ${PC_LINKOPTS} $<$<NOT:$<BOOL:${ABSL_CC_LIB_IS_INTERFACE}>>:-labsl_${_NAME}>\n\
+ Cflags: -I\${includedir}${PC_CFLAGS}\n")
+ INSTALL(FILES "${CMAKE_BINARY_DIR}/lib/pkgconfig/absl_${_NAME}.pc"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
diff --git a/debian/patches/series b/debian/patches/series
index f4bed7f4..f335570e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -16,3 +16,4 @@ big-endian-random4.diff
disable-nominalcpufrequency-test.diff
hppa-symbolize.diff
str-format-convert-test-printf.diff
+pkg-config-libs-generation.diff
diff --git a/debian/tests/bug1011294 b/debian/tests/bug1011294
new file mode 100755
index 00000000..302bcf73
--- /dev/null
+++ b/debian/tests/bug1011294
@@ -0,0 +1,24 @@
+#!/bin/sh
+# Copyright 2022 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+set -eu
+
+readonly TMP="$(mktemp -d)"
+trap "rm -rf \"$TMP\"" EXIT
+cd "$TMP"
+
+echo 'int main() {}' >noop.cc
+
+g++ -o noop noop.cc $(pkg-config --cflags absl_base) $(pkg-config --libs absl_base)
diff --git a/debian/tests/control b/debian/tests/control
index 43dc87cb..161ef695 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -17,3 +17,6 @@ Depends: @, g++, libgtest-dev
Tests: cmake
Depends: @, cmake (>= 3.5), g++, make
+
+Tests: bug1011294
+Depends: @, g++, pkg-config