Merge pull request #10779 from lazka/abseil-fix
abseil-cpp: import patches from grpc package
This commit is contained in:
107
mingw-w64-abseil-cpp/0001-abseil-Fix-compiler-warnings.patch
Normal file
107
mingw-w64-abseil-cpp/0001-abseil-Fix-compiler-warnings.patch
Normal file
@@ -0,0 +1,107 @@
|
||||
--- a/absl/base/attributes.h
|
||||
+++ b/absl/base/attributes.h
|
||||
@@ -138,7 +138,7 @@
|
||||
// step, presumably because Windows doesn't use ELF binaries.
|
||||
#if (ABSL_HAVE_ATTRIBUTE(weak) || \
|
||||
(defined(__GNUC__) && !defined(__clang__))) && \
|
||||
- (!defined(_WIN32) || __clang_major__ < 9) && !defined(__MINGW32__)
|
||||
+ (!defined(_WIN32) || defined(__clang_major__) && __clang_major__ < 9) && !defined(__MINGW32__)
|
||||
#undef ABSL_ATTRIBUTE_WEAK
|
||||
#define ABSL_ATTRIBUTE_WEAK __attribute__((weak))
|
||||
#define ABSL_HAVE_ATTRIBUTE_WEAK 1
|
||||
--- a/absl/base/internal/direct_mmap.h
|
||||
+++ b/absl/base/internal/direct_mmap.h
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "absl/base/config.h"
|
||||
|
||||
-#if ABSL_HAVE_MMAP
|
||||
+#ifdef ABSL_HAVE_MMAP
|
||||
|
||||
#include <sys/mman.h>
|
||||
|
||||
--- a/absl/base/internal/sysinfo.cc
|
||||
+++ b/absl/base/internal/sysinfo.cc
|
||||
@@ -77,7 +77,9 @@
|
||||
// 0 if the number of processors is not available or can not be computed.
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getlogicalprocessorinformation
|
||||
int Win32NumCPUs() {
|
||||
+#ifdef _MSC_VER
|
||||
#pragma comment(lib, "kernel32.lib")
|
||||
+#endif
|
||||
using Info = SYSTEM_LOGICAL_PROCESSOR_INFORMATION;
|
||||
|
||||
DWORD info_size = sizeof(Info);
|
||||
@@ -150,7 +152,9 @@
|
||||
// API informing about CPU nominal frequency.
|
||||
return 1.0;
|
||||
#else
|
||||
+#ifdef _MSC_VER
|
||||
#pragma comment(lib, "advapi32.lib") // For Reg* functions.
|
||||
+#endif
|
||||
HKEY key;
|
||||
// Use the Reg* functions rather than the SH functions because shlwapi.dll
|
||||
// pulls in gdi32.dll which makes process destruction much more costly.
|
||||
--- a/absl/debugging/symbolize_win32.inc
|
||||
+++ b/absl/debugging/symbolize_win32.inc
|
||||
@@ -18,12 +18,16 @@
|
||||
#include <windows.h>
|
||||
|
||||
// MSVC header dbghelp.h has a warning for an ignored typedef.
|
||||
+#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4091)
|
||||
#include <dbghelp.h>
|
||||
#pragma warning(pop)
|
||||
|
||||
#pragma comment(lib, "dbghelp.lib")
|
||||
+#else
|
||||
+#include <dbghelp.h>
|
||||
+#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
--- a/absl/random/internal/randen_detect.cc
|
||||
+++ b/absl/random/internal/randen_detect.cc
|
||||
@@ -40,7 +40,9 @@
|
||||
#if defined(ABSL_INTERNAL_USE_X86_CPUID)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <intrin.h> // NOLINT(build/include_order)
|
||||
+#ifdef _MSC_VER
|
||||
#pragma intrinsic(__cpuid)
|
||||
+#endif
|
||||
#else
|
||||
// MSVC-equivalent __cpuid intrinsic function.
|
||||
static void __cpuid(int cpu_info[4], int info_type) {
|
||||
--- a/absl/random/internal/seed_material.cc
|
||||
+++ b/absl/random/internal/seed_material.cc
|
||||
@@ -44,7 +44,9 @@
|
||||
|
||||
#include <windows.h>
|
||||
#define ABSL_RANDOM_USE_BCRYPT 1
|
||||
+#ifdef _MSC_VER
|
||||
#pragma comment(lib, "bcrypt.lib")
|
||||
+#endif
|
||||
|
||||
#elif defined(__Fuchsia__)
|
||||
#include <zircon/syscalls.h>
|
||||
--- a/absl/time/internal/cctz/src/time_zone_format.cc
|
||||
+++ b/absl/time/internal/cctz/src/time_zone_format.cc
|
||||
@@ -40,7 +40,7 @@
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
-#if !HAS_STRPTIME
|
||||
+#ifndef HAS_STRPTIME
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#endif
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
-#if !HAS_STRPTIME
|
||||
+#ifndef HAS_STRPTIME
|
||||
// Build a strptime() using C++11's std::get_time().
|
||||
char* strptime(const char* s, const char* fmt, std::tm* tm) {
|
||||
std::istringstream input(s);
|
||||
10
mingw-w64-abseil-cpp/0002-abseil-Remove-librt-library.patch
Normal file
10
mingw-w64-abseil-cpp/0002-abseil-Remove-librt-library.patch
Normal file
@@ -0,0 +1,10 @@
|
||||
--- a/absl/base/CMakeLists.txt
|
||||
+++ b/absl/base/CMakeLists.txt
|
||||
@@ -191,7 +191,6 @@
|
||||
${ABSL_DEFAULT_COPTS}
|
||||
LINKOPTS
|
||||
${ABSL_DEFAULT_LINKOPTS}
|
||||
- $<$<BOOL:${LIBRT}>:-lrt>
|
||||
$<$<BOOL:${MINGW}>:"advapi32">
|
||||
DEPS
|
||||
absl::atomic_hook
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/absl/base/internal/thread_identity.cc
|
||||
+++ b/absl/base/internal/thread_identity.cc
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "absl/base/internal/thread_identity.h"
|
||||
|
||||
-#ifndef _WIN32
|
||||
+#if !defined(_WIN32) || defined(__MINGW32__)
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
@@ -4,7 +4,7 @@ _realname=abseil-cpp
|
||||
pkgbase=mingw-w64-${_realname}
|
||||
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
|
||||
pkgver=20211102.0
|
||||
pkgrel=1
|
||||
pkgrel=2
|
||||
pkgdesc="A collection of open source C++ libraries taken from the most fundamental pieces of Google’s internal codebase, designed to extend the standard C ++ library. (mingw-w64)"
|
||||
arch=('any')
|
||||
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
|
||||
@@ -13,19 +13,35 @@ license=('spdx:Apache-2.0')
|
||||
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
|
||||
"${MINGW_PACKAGE_PREFIX}-ninja"
|
||||
"${MINGW_PACKAGE_PREFIX}-cc")
|
||||
source=("https://github.com/abseil/abseil-cpp/archive/$pkgver/$_realname-$pkgver.tar.gz")
|
||||
sha256sums=('dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4')
|
||||
source=("https://github.com/abseil/abseil-cpp/archive/$pkgver/$_realname-$pkgver.tar.gz"
|
||||
"0001-abseil-Fix-compiler-warnings.patch"
|
||||
"0002-abseil-Remove-librt-library.patch"
|
||||
"0003-abseil-Include-pthread-header.patch")
|
||||
sha256sums=('dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4'
|
||||
'd273d7fa05f912edc8d91c0c8ba6f1f0576d0d98714bc4bd9b624e148f7aad19'
|
||||
'd3ecabcebf64c2211b40e07f376de028ad1b101051cba7e69d77f6074217238d'
|
||||
'66bf9f2919aed3a4f71bba6b6809078dd6cb22faef763e63c3f813d3f54782c9')
|
||||
|
||||
prepare() {
|
||||
cd "${_realname}-${pkgver}"
|
||||
|
||||
patch -Np1 -i "${srcdir}/0001-abseil-Fix-compiler-warnings.patch"
|
||||
patch -Np1 -i "${srcdir}/0002-abseil-Remove-librt-library.patch"
|
||||
patch -Np1 -i "${srcdir}/0003-abseil-Include-pthread-header.patch"
|
||||
}
|
||||
|
||||
build() {
|
||||
[[ -d "${srcdir}/build-${MSYSTEM}" ]] && rm -rf "${srcdir}/build-${MSYSTEM}"
|
||||
mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"
|
||||
|
||||
# clang fails, see https://github.com/msys2/MINGW-packages/pull/8653#issuecomment-999640833
|
||||
|
||||
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
|
||||
${MINGW_PREFIX}/bin/cmake \
|
||||
-GNinja \
|
||||
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_CXX_STANDARD=17 \
|
||||
-DCMAKE_CXX_STANDARD=17 \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
../${_realname}-${pkgver}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user