gh-71052: Add Android build script and instructions (#116426)

This commit is contained in:
Malcolm Smith 2024-03-21 23:52:29 +00:00 committed by GitHub
parent 50f9b0b1e0
commit 3ec57307e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 401 additions and 17 deletions

View file

@ -4934,13 +4934,21 @@ fi
if test "$ac_sys_system" = "Linux-android"; then
# When these functions are used in an unprivileged process, they crash rather
# than returning an error.
privileged_funcs="chroot initgroups setegid seteuid setgid setregid setresgid
setresuid setreuid setuid"
blocked_funcs="chroot initgroups setegid seteuid setgid sethostname
setregid setresgid setresuid setreuid setuid"
# These functions are unimplemented and always return an error.
unimplemented_funcs="sem_open sem_unlink"
# These functions are unimplemented and always return an error
# (https://android.googlesource.com/platform/system/sepolicy/+/refs/heads/android13-release/public/domain.te#1044)
blocked_funcs="$blocked_funcs sem_open sem_unlink"
for name in $privileged_funcs $unimplemented_funcs; do
# Before API level 23, when fchmodat is called with the unimplemented flag
# AT_SYMLINK_NOFOLLOW, instead of returning ENOTSUP as it should, it actually
# follows the symlink.
if test "$ANDROID_API_LEVEL" -lt 23; then
blocked_funcs="$blocked_funcs fchmodat"
fi
for name in $blocked_funcs; do
AS_VAR_PUSHDEF([func_var], [ac_cv_func_$name])
AS_VAR_SET([func_var], [no])
AS_VAR_POPDEF([func_var])
@ -5303,11 +5311,16 @@ then
])
fi
AC_CHECK_FUNCS([clock_nanosleep], [], [
AC_CHECK_LIB([rt], [clock_nanosleep], [
AC_DEFINE([HAVE_CLOCK_NANOSLEEP], [1])
])
])
# On Android before API level 23, clock_nanosleep returns the wrong value when
# interrupted by a signal (https://issuetracker.google.com/issues/216495770).
if ! { test "$ac_sys_system" = "Linux-android" &&
test "$ANDROID_API_LEVEL" -lt 23; }; then
AC_CHECK_FUNCS([clock_nanosleep], [], [
AC_CHECK_LIB([rt], [clock_nanosleep], [
AC_DEFINE([HAVE_CLOCK_NANOSLEEP], [1])
])
])
fi
AC_CHECK_FUNCS([nanosleep], [], [
AC_CHECK_LIB([rt], [nanosleep], [