Skip to content

Commit fb9b9ed

Browse files
author
fuzzard
committed
[tools/depends][target] python3 Move crypt.h include from public header
backport python/cpython#27394 to 3.9.6 Android Pycryptodome builds fail due to crypt.h inclusion (not respecting undef HAVE_CRYPT_H)
1 parent 3c6468f commit fb9b9ed

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
--- a/Include/Python.h
2+
+++ b/Include/Python.h
3+
@@ -35,19 +35,6 @@
4+
#ifndef MS_WINDOWS
5+
#include <unistd.h>
6+
#endif
7+
-#ifdef HAVE_CRYPT_H
8+
-#if defined(HAVE_CRYPT_R) && !defined(_GNU_SOURCE)
9+
-/* Required for glibc to expose the crypt_r() function prototype. */
10+
-# define _GNU_SOURCE
11+
-# define _Py_GNU_SOURCE_FOR_CRYPT
12+
-#endif
13+
-#include <crypt.h>
14+
-#ifdef _Py_GNU_SOURCE_FOR_CRYPT
15+
-/* Don't leak the _GNU_SOURCE define to other headers. */
16+
-# undef _GNU_SOURCE
17+
-# undef _Py_GNU_SOURCE_FOR_CRYPT
18+
-#endif
19+
-#endif
20+
21+
/* For size_t? */
22+
#ifdef HAVE_STDDEF_H
23+
--- a/Modules/_cryptmodule.c
24+
+++ b/Modules/_cryptmodule.c
25+
@@ -4,6 +4,9 @@
26+
#include "Python.h"
27+
28+
#include <sys/types.h>
29+
+#ifdef HAVE_CRYPT_H
30+
+#include <crypt.h>
31+
+#endif
32+
33+
/* Module crypt */
34+

tools/depends/target/python3/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
include ../../Makefile.include
22
DEPS= ../../Makefile.include Makefile apple.patch crosscompile.patch android.patch \
3-
modules.setup darwin_embedded.patch
3+
modules.setup darwin_embedded.patch 01-GH-27394-move-crypt-h.patch
44

55
# lib name, version
66
LIBNAME=Python
@@ -47,6 +47,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
4747
cd $(PLATFORM); patch -p1 -i ../crosscompile.patch
4848
cd $(PLATFORM); patch -p1 -i ../android.patch
4949
cd $(PLATFORM); patch -p1 -i ../apple.patch
50+
cd $(PLATFORM); patch -p1 -i ../01-GH-27394-move-crypt-h.patch
5051
ifeq ($(OS),darwin_embedded)
5152
cd $(PLATFORM); patch -p1 -i ../darwin_embedded.patch
5253
endif

0 commit comments

Comments
 (0)