Update Android port

* configure.ac: Test for getpwent using gl_CHECK_FUNCS_ANDROID.
(bug#65319)

* etc/MACHINES (Android): Mention that a non-GUI build is also
possible on Android.

* lisp/loadup.el: Provide for regular builds on Android.
(bug#65339)

* lisp/wid-edit.el (widget-event-start): Remove function, since
event-start now does the same thing.
(widget-button--check-and-call-button, widget-button-click):
Adjust correspondingly.  Reported by Stefan Monnier
<monnier@iro.umontreal.ca>.

* src/sysdep.c (close_output_streams): Apply workarounds for the
file descriptor sanitizer on all builds where __ANDROID__ is
defined, not just Android port builds.  (bug#65340)
This commit is contained in:
Po Lu 2023-08-16 20:32:04 +08:00
parent 22d031f644
commit f2f2e6a082
5 changed files with 28 additions and 20 deletions

View file

@ -5846,11 +5846,14 @@ getrlimit setrlimit shutdown \
pthread_sigmask strsignal setitimer \
sendto recvfrom getsockname getifaddrs freeifaddrs \
gai_strerror sync \
getpwent endpwent getgrent endgrent \
endpwent getgrent endgrent \
renameat2 \
cfmakeraw cfsetspeed __executable_start log2 pthread_setname_np \
pthread_set_name_np])
# getpwent is not present in older versions of Android. (bug#65319)
gl_CHECK_FUNCS_ANDROID([getpwent], [[#include <pwd.h>]])
if test "$ac_cv_func_cfmakeraw" != "yes"; then
# On some systems (Android), cfmakeraw is inline, so AC_CHECK_FUNCS
# cannot find it. Check if some code including termios.h and using

View file

@ -143,6 +143,12 @@ the list at the end of this file.
See the file java/INSTALL for detailed installation instructions.
It is also possible to build Emacs for Android systems without using
GUI capabilities provided by the Android port. We do not know
exactly which configurations this works on, but the installation
instructions for such a build should be the same as for any Unix
system.
* Obsolete platforms

View file

@ -566,7 +566,8 @@ lost after dumping")))
(if (eq system-type 'android)
(if (and (eq system-type 'android)
(featurep 'android))
(progn
;; Dumping Emacs on Android works slightly differently from
;; everywhere else. The first time Emacs starts, Emacs dumps
@ -631,7 +632,11 @@ lost after dumping")))
;; There's no point keeping old dumps around for
;; the binary used to build Lisp on the build
;; machine.
(featurep 'android)
(or (featurep 'android)
;; And if this branch is reached with
;; `system-type' set to Android, this is a
;; regular Emacs TTY build. (bug#65339)
(eq system-type 'android))
;; Don't bother adding another name if we're just
;; building bootstrap-emacs.
(member dump-mode '("pbootstrap" "bootstrap"))))

View file

@ -1084,15 +1084,6 @@ Note that such modes will need to require wid-edit.")
"If non-nil, `widget-button-click' moves point to a button after invoking it.
If nil, point returns to its original position after invoking a button.")
(defun widget-event-start (event)
"Return the start of EVENT.
If EVENT is not a touchscreen event, simply return its
`event-start'. Otherwise, it is a touchscreen event, so return
the posn of its touchpoint."
(if (eq (car event) 'touchscreen-begin)
(cdadr event)
(event-start event)))
(defun widget-button--check-and-call-button (event button)
"Call BUTTON if BUTTON is a widget and EVENT is correct for it.
EVENT can either be a mouse event or a touchscreen-begin event.
@ -1106,9 +1097,9 @@ If nothing was called, return non-nil."
;; in a save-excursion so that the click on the button
;; doesn't change point.
(save-selected-window
(select-window (posn-window (widget-event-start event)))
(select-window (posn-window (event-start event)))
(save-excursion
(goto-char (posn-point (widget-event-start event)))
(goto-char (posn-point (event-start event)))
(let* ((overlay (widget-get button :button-overlay))
(pressed-face (or (widget-get button :pressed-face)
widget-button-pressed-face))
@ -1179,7 +1170,7 @@ If nothing was called, return non-nil."
(if (widget-event-point event)
(let* ((mouse-1 (memq (event-basic-type event) '(mouse-1 down-mouse-1)))
(pos (widget-event-point event))
(start (widget-event-start event))
(start (event-start event))
(button (get-char-property
pos 'button (and (windowp (posn-window start))
(window-buffer (posn-window start))))))

View file

@ -2972,14 +2972,16 @@ void
close_output_streams (void)
{
/* Android comes with some kind of ``file descriptor sanitizer''
that aborts when stdout or stderr is closed. */
that aborts when stdout or stderr is closed. (bug#65340)
#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY
Perform this unconditionally as long as __ANDROID__ is defined,
since the file descriptor sanitizer also applies to regular TTY
builds under Android. */
#ifdef __ANDROID__
fflush (stderr);
fflush (stdout);
return;
#endif
#else /* !__ANDROID__ */
if (close_stream (stdout) != 0)
{
emacs_perror ("Write error to standard output");
@ -2993,6 +2995,7 @@ close_output_streams (void)
? fflush (stderr) != 0 || ferror (stderr)
: close_stream (stderr) != 0))
_exit (EXIT_FAILURE);
#endif /* __ANDROID__ */
}
#ifndef DOS_NT