From 3572925dc500fc656ddc0dd3a919a5adb47ed448 Mon Sep 17 00:00:00 2001 From: fuzzard Date: Tue, 17 Aug 2021 19:02:33 +1000 Subject: [tools/depends][target] python3 Move crypt.h include from public header backport https://github.com/python/cpython/pull/27394 to 3.9.6 Android Pycryptodome builds fail due to crypt.h inclusion (not respecting undef HAVE_CRYPT_H) --- .../target/python3/01-GH-27394-move-crypt-h.patch | 34 ++++++++++++++++++++++ tools/depends/target/python3/Makefile | 3 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 tools/depends/target/python3/01-GH-27394-move-crypt-h.patch (limited to 'tools/depends/target/python3') diff --git a/tools/depends/target/python3/01-GH-27394-move-crypt-h.patch b/tools/depends/target/python3/01-GH-27394-move-crypt-h.patch new file mode 100644 index 0000000000..352eaa48cd --- /dev/null +++ b/tools/depends/target/python3/01-GH-27394-move-crypt-h.patch @@ -0,0 +1,34 @@ +--- a/Include/Python.h ++++ b/Include/Python.h +@@ -35,19 +35,6 @@ + #ifndef MS_WINDOWS + #include + #endif +-#ifdef HAVE_CRYPT_H +-#if defined(HAVE_CRYPT_R) && !defined(_GNU_SOURCE) +-/* Required for glibc to expose the crypt_r() function prototype. */ +-# define _GNU_SOURCE +-# define _Py_GNU_SOURCE_FOR_CRYPT +-#endif +-#include +-#ifdef _Py_GNU_SOURCE_FOR_CRYPT +-/* Don't leak the _GNU_SOURCE define to other headers. */ +-# undef _GNU_SOURCE +-# undef _Py_GNU_SOURCE_FOR_CRYPT +-#endif +-#endif + + /* For size_t? */ + #ifdef HAVE_STDDEF_H +--- a/Modules/_cryptmodule.c ++++ b/Modules/_cryptmodule.c +@@ -4,6 +4,9 @@ + #include "Python.h" + + #include ++#ifdef HAVE_CRYPT_H ++#include ++#endif + + /* Module crypt */ + diff --git a/tools/depends/target/python3/Makefile b/tools/depends/target/python3/Makefile index 0d9b683c15..bd5c5466fc 100644 --- a/tools/depends/target/python3/Makefile +++ b/tools/depends/target/python3/Makefile @@ -1,6 +1,6 @@ include ../../Makefile.include DEPS= ../../Makefile.include Makefile apple.patch crosscompile.patch android.patch \ - modules.setup darwin_embedded.patch + modules.setup darwin_embedded.patch 01-GH-27394-move-crypt-h.patch # lib name, version LIBNAME=Python @@ -47,6 +47,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) cd $(PLATFORM); patch -p1 -i ../crosscompile.patch cd $(PLATFORM); patch -p1 -i ../android.patch cd $(PLATFORM); patch -p1 -i ../apple.patch + cd $(PLATFORM); patch -p1 -i ../01-GH-27394-move-crypt-h.patch ifeq ($(OS),darwin_embedded) cd $(PLATFORM); patch -p1 -i ../darwin_embedded.patch endif -- cgit v1.2.3