diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-11-27 15:57:46 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-11-28 10:59:18 +0100 |
commit | 8b04bc1d6bf39bf569975617bfbbc8ef7eb31973 (patch) | |
tree | 86902c3784631dc0fb1a41c4022346568e0a6e32 | |
parent | 7f58b57b47e6642cb9a7aeac48915b30148042d2 (diff) |
external/zxing: Backport my upstream fix for android build w/ NDK 26
Upstream issue/PR/commit:
https://github.com/zxing-cpp/zxing-cpp/issues/673
https://github.com/zxing-cpp/zxing-cpp/pull/674
https://github.com/zxing-cpp/zxing-cpp/commit/295b193b0105e68bb24747aefbff2653df892b4c
Change-Id: I47586e0e54b3661e4ca1b5c071f6595fd000cc70
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159999
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r-- | external/zxing/0001-android-Fix-build-with-NDK-26.patch | 64 | ||||
-rw-r--r-- | external/zxing/UnpackedTarball_zxing.mk | 3 |
2 files changed, 67 insertions, 0 deletions
diff --git a/external/zxing/0001-android-Fix-build-with-NDK-26.patch b/external/zxing/0001-android-Fix-build-with-NDK-26.patch new file mode 100644 index 000000000000..ad1269b4165c --- /dev/null +++ b/external/zxing/0001-android-Fix-build-with-NDK-26.patch @@ -0,0 +1,64 @@ +From 295b193b0105e68bb24747aefbff2653df892b4c Mon Sep 17 00:00:00 2001 +From: Michael Weghorn <m.weghorn@posteo.de> +Date: Mon, 27 Nov 2023 14:28:34 +0100 +Subject: [PATCH] android: Fix build with NDK 26 + +While the workarounds added in + + commit df0b9213017a136bf7253ea1d4aba5677c52d45c + Author: axxel <awagger@gmail.com> + Date: Thu Dec 15 20:43:48 2022 +0100 + + android: work around limitations of c++-20 support in NDK + +may be necessary for NDK 25, they are no longer for NDK 26, +and even break the build with NDK 26: + + C/C++: .../zxing-cpp/core/src/Generator.h:103:7: error: reference to 'default_sentinel_t' is ambiguous + C/C++: std::default_sentinel_t end() { return {}; } + C/C++: ^ + C/C++: .../Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__iterator/default_sentinel.h:23:8: note: candidate found by name lookup is 'std::__ndk1::default_sentinel_t' + C/C++: struct default_sentinel_t { }; + C/C++: ^ + C/C++: .../zxing-cpp/core/src/Generator.h:15:9: note: candidate found by name lookup is 'std::default_sentinel_t' + C/C++: struct default_sentinel_t {}; + C/C++: ^ + C/C++: 2 errors generated. + +Restrict the workaround to NDK version < 26 to fix this. + +Fixes: #673 +--- + core/src/Generator.h | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/core/src/Generator.h b/core/src/Generator.h +index 7a1fd179..a5083e9d 100644 +--- a/core/src/Generator.h ++++ b/core/src/Generator.h +@@ -5,8 +5,12 @@ + + #pragma once + +-#ifdef __cpp_impl_coroutine + #ifdef __ANDROID__ ++#include <android/ndk-version.h> ++#endif ++ ++#ifdef __cpp_impl_coroutine ++#if defined __ANDROID__ && __NDK_MAJOR__ < 26 + // NDK 25.1.8937393 can compile this code with c++20 but needs a few tweaks: + #include <experimental/coroutine> + namespace std { +@@ -25,7 +29,7 @@ namespace std { + // this code is based on https://en.cppreference.com/w/cpp/coroutine/coroutine_handle#Example + // but modified trying to prevent accidental copying of generated objects + +-#ifdef __ANDROID__ ++#if defined __ANDROID__ && __NDK_MAJOR__ < 26 + template <class T> + #else + template <std::movable T> +-- +2.42.0 + diff --git a/external/zxing/UnpackedTarball_zxing.mk b/external/zxing/UnpackedTarball_zxing.mk index fcdc303880c9..0a81505463c0 100644 --- a/external/zxing/UnpackedTarball_zxing.mk +++ b/external/zxing/UnpackedTarball_zxing.mk @@ -13,7 +13,10 @@ $(eval $(call gb_UnpackedTarball_set_tarball,zxing,$(ZXING_TARBALL))) $(eval $(call gb_UnpackedTarball_set_patchlevel,zxing,1)) +# patch 0001-android-Fix-build-with-NDK-26.patch is backport of +# upstream commit https://github.com/zxing-cpp/zxing-cpp/commit/295b193b0105e68bb24747aefbff2653df892b4c $(eval $(call gb_UnpackedTarball_add_patches,zxing, \ + external/zxing/0001-android-Fix-build-with-NDK-26.patch \ )) # vim: set noet sw=4 ts=4: |