diff options
author | Benjamin Barenblat <bbaren@google.com> | 2020-05-12 18:20:27 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbaren@google.com> | 2020-05-18 15:05:59 -0400 |
commit | e05aa44e16cc9c47c8285b920415ac0f4763657a (patch) | |
tree | 56af9c85a801d93d1beb720bfee1928db672490f /debian/patches | |
parent | c51510d1d87ebce8615ae1752fd5aca912f6cf4c (diff) |
Start packaging Abseil
Create basic packaging for Abseil. There’s still work to be done –
there are no autopkgtests, and this package doesn’t install Abseil’s
CMake integration. However, you can install the binary packages and
build programs that link the libraries.
Diffstat (limited to 'debian/patches')
-rw-r--r-- | debian/patches/configure.diff | 71 | ||||
-rw-r--r-- | debian/patches/license.diff | 59 | ||||
-rw-r--r-- | debian/patches/series | 4 | ||||
-rw-r--r-- | debian/patches/use_local_gtest.diff | 130 | ||||
-rw-r--r-- | debian/patches/use_local_gtest2.diff | 21 |
5 files changed, 285 insertions, 0 deletions
diff --git a/debian/patches/configure.diff b/debian/patches/configure.diff new file mode 100644 index 00000000..fd29fa59 --- /dev/null +++ b/debian/patches/configure.diff @@ -0,0 +1,71 @@ +From: Benjamin Barenblat <bbaren@google.com> +Subject: Set package configuration options +Forwarded: not-needed + +Configure Abseil for Debian. + + - Set the SONAME appropriately. + + - To minimize the possibility of future ABI breakage, treat absl::any, + absl::optional, absl::string_view, and absl::variant as their own types + (rather than aliases for the std:: versions), and compile everything in an + inline namespace. + +--- a/CMake/AbseilHelpers.cmake ++++ b/CMake/AbseilHelpers.cmake +@@ -215,6 +215,9 @@ + OUTPUT_NAME "absl_${_NAME}" + ) + endif() ++ ++ set_property(TARGET ${_NAME} PROPERTY SOVERSION 20200225) ++ set_property(TARGET ${_NAME} PROPERTY VERSION "20200225.0.2") + else() + # Generating header-only library + add_library(${_NAME} INTERFACE) +--- a/absl/base/options.h ++++ b/absl/base/options.h +@@ -100,7 +100,7 @@ ABSL_OPTION_USE_STD_ANY + // User code should not inspect this macro. To check in the preprocessor if + // absl::any is a typedef of std::any, use the feature macro ABSL_USES_STD_ANY. + +-#define ABSL_OPTION_USE_STD_ANY 2 ++#define ABSL_OPTION_USE_STD_ANY 0 + + + // ABSL_OPTION_USE_STD_OPTIONAL +@@ -127,7 +127,7 @@ ABSL_OPTION_USE_STD_OPTIONAL + // absl::optional is a typedef of std::optional, use the feature macro + // ABSL_USES_STD_OPTIONAL. + +-#define ABSL_OPTION_USE_STD_OPTIONAL 2 ++#define ABSL_OPTION_USE_STD_OPTIONAL 0 + + + // ABSL_OPTION_USE_STD_STRING_VIEW +@@ -154,7 +154,7 @@ ABSL_OPTION_USE_STD_STRING_VIEW + // absl::string_view is a typedef of std::string_view, use the feature macro + // ABSL_USES_STD_STRING_VIEW. + +-#define ABSL_OPTION_USE_STD_STRING_VIEW 2 ++#define ABSL_OPTION_USE_STD_STRING_VIEW 0 + + // ABSL_OPTION_USE_STD_VARIANT + // +@@ -180,7 +180,7 @@ ABSL_OPTION_USE_STD_VARIANT + // absl::variant is a typedef of std::variant, use the feature macro + // ABSL_USES_STD_VARIANT. + +-#define ABSL_OPTION_USE_STD_VARIANT 2 ++#define ABSL_OPTION_USE_STD_VARIANT 0 + + + // ABSL_OPTION_USE_INLINE_NAMESPACE +@@ -206,6 +206,6 @@ ABSL_OPTION_INLINE_NAMESPACE_NAME + // allowed. + + #define ABSL_OPTION_USE_INLINE_NAMESPACE 1 +-#define ABSL_OPTION_INLINE_NAMESPACE_NAME lts_2020_02_25 ++#define ABSL_OPTION_INLINE_NAMESPACE_NAME debian0 + + #endif // ABSL_BASE_OPTIONS_H_ diff --git a/debian/patches/license.diff b/debian/patches/license.diff new file mode 100644 index 00000000..08f315e4 --- /dev/null +++ b/debian/patches/license.diff @@ -0,0 +1,59 @@ +From: Benjamin Barenblat <bbaren@google.com> +Subject: Correct Apache license headers +Forwarded: yes +Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/bd317cae3bc2630d1b12c5f1d77036e937d1d725 + +This repository has always been licensed under the Apache license, but some +files lacked headers to locally indicate that fact. Add the appropriate headers. + +The author works at Google. Upstream applied this patch as Piper revision +310223650 and exported it to GitHub; the Applied-Upstream URL above points to +the exported commit. + +--- a/absl/debugging/internal/stacktrace_arm-inl.inc ++++ b/absl/debugging/internal/stacktrace_arm-inl.inc +@@ -1,9 +1,18 @@ +-// Copyright 2011 and onwards Google Inc. +-// All rights reserved. ++// Copyright 2017 The Abseil Authors. ++// ++// 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. + // +-// Author: Doug Kwan + // This is inspired by Craig Silverstein's PowerPC stacktrace code. +-// + + #ifndef ABSL_DEBUGGING_INTERNAL_STACKTRACE_ARM_INL_H_ + #define ABSL_DEBUGGING_INTERNAL_STACKTRACE_ARM_INL_H_ +--- a/absl/debugging/internal/stacktrace_generic-inl.inc ++++ b/absl/debugging/internal/stacktrace_generic-inl.inc +@@ -1,7 +1,16 @@ +-// Copyright 2000 - 2007 Google Inc. +-// All rights reserved. ++// Copyright 2017 The Abseil Authors. + // +-// Author: Sanjay Ghemawat ++// 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. + // + // Portable implementation - just use glibc + // diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 00000000..0d0ecdd4 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,4 @@ +license.diff +use_local_gtest.diff +use_local_gtest2.diff +configure.diff diff --git a/debian/patches/use_local_gtest.diff b/debian/patches/use_local_gtest.diff new file mode 100644 index 00000000..9ccd2316 --- /dev/null +++ b/debian/patches/use_local_gtest.diff @@ -0,0 +1,130 @@ +From: Benjamin Barenblat <bbaren@google.com> +Subject: Support testing with a local googletest checkout +Forwarded: yes +Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/bcefbdcdf6ad85046ccacee0aeffba5404d3e528 + +Debian likes doing dependency management manually, so add support for +testing against a local googletest checkout rather than one downloaded +from GitHub. Add an ABSL_LOCAL_GOOGLETEST_DIR variable that can be used +in conjunction with -DABSL_RUN_TESTS=ON -DABSL_USE_GOOGLETEST_HEAD=OFF +to specify the googletest location manually, and do a bit of related +cleanup. + +This patch was originally submitted as +https://github.com/abseil/abseil-cpp/pull/628. Since the author works at +Google, upstream requested that he submit it internally. It was applied +as Piper revision 297677173 and exported to GitHub; the Applied-Upstream +URL above points to the exported commit. + +--- a/CMake/Googletest/CMakeLists.txt.in ++++ b/CMake/Googletest/CMakeLists.txt.in +@@ -1,15 +1,26 @@ + cmake_minimum_required(VERSION 2.8.2) + +-project(googletest-download NONE) ++project(googletest-external NONE) + + include(ExternalProject) +-ExternalProject_Add(googletest +- GIT_REPOSITORY https://github.com/google/googletest.git +- GIT_TAG master +- SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src" +- BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build" +- CONFIGURE_COMMAND "" +- BUILD_COMMAND "" +- INSTALL_COMMAND "" +- TEST_COMMAND "" +-) +\ No newline at end of file ++if(${ABSL_USE_GOOGLETEST_HEAD}) ++ ExternalProject_Add(googletest ++ GIT_REPOSITORY https://github.com/google/googletest.git ++ GIT_TAG master ++ SOURCE_DIR "${absl_gtest_src_dir}" ++ BINARY_DIR "${absl_gtest_build_dir}" ++ CONFIGURE_COMMAND "" ++ BUILD_COMMAND "" ++ INSTALL_COMMAND "" ++ TEST_COMMAND "" ++ ) ++else() ++ ExternalProject_Add(googletest ++ SOURCE_DIR "${absl_gtest_src_dir}" ++ BINARY_DIR "${absl_gtest_build_dir}" ++ CONFIGURE_COMMAND "" ++ BUILD_COMMAND "" ++ INSTALL_COMMAND "" ++ TEST_COMMAND "" ++ ) ++endif() +\ No newline at end of file +--- a/CMake/Googletest/DownloadGTest.cmake ++++ b/CMake/Googletest/DownloadGTest.cmake +@@ -1,10 +1,11 @@ +-# Downloads and unpacks googletest at configure time. Based on the instructions +-# at https://github.com/google/googletest/tree/master/googletest#incorporating-into-an-existing-cmake-project ++# Integrates googletest at configure time. Based on the instructions at ++# https://github.com/google/googletest/tree/master/googletest#incorporating-into-an-existing-cmake-project + +-# Download the latest googletest from Github master ++# Set up the external googletest project, downloading the latest from Github ++# master if requested. + configure_file( + ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in +- ${CMAKE_BINARY_DIR}/googletest-download/CMakeLists.txt ++ ${CMAKE_BINARY_DIR}/googletest-external/CMakeLists.txt + ) + + set(ABSL_SAVE_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) +@@ -14,17 +15,17 @@ if (BUILD_SHARED_LIBS) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_CREATE_SHARED_LIBRARY=1") + endif() + +-# Configure and build the downloaded googletest source ++# Configure and build the googletest source. + execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . + RESULT_VARIABLE result +- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download ) ++ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-external ) + if(result) + message(FATAL_ERROR "CMake step for googletest failed: ${result}") + endif() + + execute_process(COMMAND ${CMAKE_COMMAND} --build . + RESULT_VARIABLE result +- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download) ++ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-external) + if(result) + message(FATAL_ERROR "Build step for googletest failed: ${result}") + endif() +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fdfb2cf..74b5cd9 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -84,6 +84,10 @@ + option(ABSL_USE_GOOGLETEST_HEAD + "If ON, abseil will download HEAD from googletest at config time." OFF) + ++set(ABSL_LOCAL_GOOGLETEST_DIR "/usr/src/googletest" CACHE PATH ++ "If ABSL_USE_GOOGLETEST_HEAD is OFF, specifies the directory of a local googletest checkout." ++ ) ++ + option(ABSL_RUN_TESTS "If ON, Abseil tests will be run." OFF) + + if(${ABSL_RUN_TESTS}) +@@ -96,11 +100,13 @@ + ## check targets + if(BUILD_TESTING) + ++ set(absl_gtest_build_dir ${CMAKE_BINARY_DIR}/googletest-build) + if(${ABSL_USE_GOOGLETEST_HEAD}) +- include(CMake/Googletest/DownloadGTest.cmake) + set(absl_gtest_src_dir ${CMAKE_BINARY_DIR}/googletest-src) +- set(absl_gtest_build_dir ${CMAKE_BINARY_DIR}/googletest-build) ++ else() ++ set(absl_gtest_src_dir ${ABSL_LOCAL_GOOGLETEST_DIR}) + endif() ++ include(CMake/Googletest/DownloadGTest.cmake) + + check_target(gtest) + check_target(gtest_main) diff --git a/debian/patches/use_local_gtest2.diff b/debian/patches/use_local_gtest2.diff new file mode 100644 index 00000000..37f3e7d0 --- /dev/null +++ b/debian/patches/use_local_gtest2.diff @@ -0,0 +1,21 @@ +From: Benjamin Barenblat <bbaren@google.com> +Subject: Support testing with a local googletest checkout, part 2 +Forwarded: yes +Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/79e0dc11514df035a8d07a356f9ee1800fb2160c + +use_local_gtest.diff missed a necessary line; add it. + +The author works at Google. Upstream applied this patch as Piper revision +302947488 and exported it to GitHub; the Applied-Upstream URL above points to +the exported commit. + +--- a/CMake/Googletest/DownloadGTest.cmake ++++ b/CMake/Googletest/DownloadGTest.cmake +@@ -38,6 +38,4 @@ + + # Add googletest directly to our build. This defines the gtest and gtest_main + # targets. +-add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src +- ${CMAKE_BINARY_DIR}/googletest-build +- EXCLUDE_FROM_ALL) ++add_subdirectory(${absl_gtest_src_dir} ${absl_gtest_build_dir} EXCLUDE_FROM_ALL) |