Merge cherrypicks of [1592971] into sparse-7070116-L82600000815924205

Change-Id: I06b57f3c6da55ed01c1f7b1698d39ee0a0bb1412
diff --git a/android/darwin_x86_64/pyconfig/pyconfig.h b/android/darwin_x86_64/pyconfig/pyconfig.h
index 2c9f57e..fbd9a4c 100644
--- a/android/darwin_x86_64/pyconfig/pyconfig.h
+++ b/android/darwin_x86_64/pyconfig/pyconfig.h
@@ -425,7 +425,7 @@
 #define HAVE_GETC_UNLOCKED 1
 
 /* Define to 1 if you have the `getentropy' function. */
-#define HAVE_GETENTROPY 1
+/* #undef HAVE_GETENTROPY */
 
 /* Define to 1 if you have the `getgrgid_r' function. */
 #define HAVE_GETGRGID_R 1
diff --git a/android/regen.sh b/android/regen.sh
index e4fe45b..c359d17 100755
--- a/android/regen.sh
+++ b/android/regen.sh
@@ -39,6 +39,8 @@
 ../../../configure
 
 if [ $DIR == "darwin_x86_64" ]; then
+  # getentropy is not safe on <10.12, which we still target
+  sed -ibak "s%#define HAVE_GETENTROPY 1%/* #undef HAVE_GETENTROPY */%" pyconfig.h
   # utimensat and futimens are not safe on <10.13, which we still target
   sed -ibak "s%#define HAVE_UTIMENSAT 1%/* #undef HAVE_UTIMENSAT */%" pyconfig.h
   sed -ibak "s%#define HAVE_FUTIMENS 1%/* #undef HAVE_FUTIMENS */%" pyconfig.h