mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-24 07:20:37 +00:00
Improve reliability of Android build system
* .gitignore: Add new files. * INSTALL.android: New file. * Makefile.in (clean_dirs): Clean xcompile as well. * admin/merge-gnulib (avoided_flags): Import gnulib into Android directory as well. * doc/emacs/android.texi (Android): * doc/emacs/emacs.texi (Top): New node `Android'. * java/org/gnu/emacs/EmacsThread.java (run): Use right executable name. * lib/Makefile.in (ANDROID_CFLAGS): Use better way to refer to /src. (vpath): Delete ugly block of vpath statements. (mostlyclean): Remove Makefile.android. * lib/fpending.c (__fpending): * lib/open.c: * lib/unistd.c (_GL_UNISTD_INLINE): Revert changes to gnulib in lib/. * src/android.h: * src/androidterm.c: Fix build. * xcompile/Makefile.in (LIB_SRCDIR): (LIBSRC_BINARIES, src/verbose.mk): (PRE_BUILD_DEPS, PHONY): Use gnulib in xcompile/lib/ as opposed to lib/. * xcompile/README: Adjust README.
This commit is contained in:
parent
a441ac5527
commit
28a9baccd4
27
.gitignore
vendored
27
.gitignore
vendored
@ -54,6 +54,7 @@ src/emacs-module.h
|
||||
|
||||
# Built by recursive call to `configure'.
|
||||
*.android
|
||||
!INSTALL.android
|
||||
|
||||
# Built by `java'.
|
||||
java/install_temp/*
|
||||
@ -94,7 +95,31 @@ src/lisp.mk
|
||||
src/verbose.mk
|
||||
|
||||
# Stuff built during cross compilation
|
||||
xcompile/lib/*
|
||||
xcompile/lib/alloca.h
|
||||
xcompile/lib/assert.h
|
||||
xcompile/lib/byteswap.h
|
||||
xcompile/lib/dirent.h
|
||||
xcompile/lib/errno.h
|
||||
xcompile/lib/execinfo.h
|
||||
xcompile/lib/fcntl.h
|
||||
xcompile/lib/getopt.h
|
||||
xcompile/lib/getopt-cdefs.h
|
||||
xcompile/lib/gmp.h
|
||||
xcompile/lib/ieee754.h
|
||||
xcompile/lib/inttypes.h
|
||||
xcompile/lib/libgnu.a
|
||||
xcompile/lib/limits.h
|
||||
xcompile/lib/malloc/*.gl.h
|
||||
xcompile/lib/signal.h
|
||||
xcompile/lib/std*.h
|
||||
xcompile/!lib/std*.in.h
|
||||
xcompile/!lib/stdio-impl.h
|
||||
xcompile/lib/string.h
|
||||
xcompile/lib/sys/
|
||||
xcompile/lib/time.h
|
||||
xcompile/lib/unistd.h
|
||||
xcompile/lib/config.h
|
||||
xcompile/lib/gnulib.mk
|
||||
xcompile/src/*
|
||||
xcompile/lib-src/*
|
||||
xcompile/sys/*
|
||||
|
76
INSTALL.android
Normal file
76
INSTALL.android
Normal file
@ -0,0 +1,76 @@
|
||||
Installation instructions for Android
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
See the end of the file for license conditions.
|
||||
|
||||
Please read the entirety of this file before attempting to build Emacs
|
||||
as an application package which can run on Android devices.
|
||||
|
||||
When building from the source repository, make sure to read
|
||||
INSTALL.REPO as well.
|
||||
|
||||
|
||||
|
||||
Android is an unusual operating system in that program binaries cannot
|
||||
be produced on computers running Android themselves. Instead, they
|
||||
must be built on some other computer using a set of tools known as the
|
||||
``Android SDK'' (Software Development Kit) and the ``Android NDK''
|
||||
(Native Development Kit). Appropriate versions of both must be
|
||||
obtained to build GNU Emacs; after being built, the generated binaries
|
||||
will work on almost all Android devices. This document does not
|
||||
elaborate on how both sets of tools can be obtained. However, for
|
||||
your freedom's sake, you should use the Android SDK provided by the
|
||||
Debian project.
|
||||
|
||||
In addition to the Android SDK and Android NDK, Emacs also requires
|
||||
the Java compiler from OpenJDK 1.7.0 to be installed on your system.
|
||||
|
||||
Once all of those tools are obtained, you may invoke the `configure'
|
||||
script like so:
|
||||
|
||||
./configure --with-android=/path/to/android.jar \
|
||||
ANDROID_CC=/path/to/android/ndk/cc \
|
||||
SDK_BUILD_TOOLS=/path/to/sdk/build/tools
|
||||
|
||||
Replacing the paths in the command line above with:
|
||||
|
||||
- the path to the `android.jar' headers which come with the Android
|
||||
SDK. They must correspond to Android version 13 or later.
|
||||
|
||||
- the path to the C compiler in the Android NDK, for the machine you
|
||||
are building Emacs to run on.
|
||||
|
||||
- the path to the directory in the Android SDK containing binaries
|
||||
such as `aapt' and `d8'. These are used to build the application
|
||||
package.
|
||||
|
||||
After the configuration process completes, you may run:
|
||||
|
||||
make all
|
||||
|
||||
Once `make' finishes, there should be a file in the `java' directory
|
||||
named along the lines of:
|
||||
|
||||
emacs-<version>-<api-version>-<abi>.apk
|
||||
|
||||
where <api-version> is the oldest version of Android that the package
|
||||
will run on, and <abi> is the type of Android machine the package was
|
||||
built for.
|
||||
|
||||
The generated package can be uploaded onto an SD card (or similar
|
||||
medium) and installed on-device.
|
||||
|
||||
|
||||
This file is part of GNU Emacs.
|
||||
|
||||
GNU Emacs is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GNU Emacs is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
@ -1012,7 +1012,8 @@ mostlyclean: $(mostlyclean_dirs:=_mostlyclean)
|
||||
### with them.
|
||||
###
|
||||
### Delete '.dvi' files here if they are not part of the distribution.
|
||||
clean_dirs = $(mostlyclean_dirs) java nextstep admin/charsets admin/unidata
|
||||
clean_dirs = $(mostlyclean_dirs) java xcompile nextstep admin/charsets \
|
||||
admin/unidata
|
||||
|
||||
$(foreach dir,$(clean_dirs),$(eval $(call submake_template,$(dir),clean)))
|
||||
|
||||
|
@ -114,6 +114,11 @@ for module in $AVOIDED_MODULES; do
|
||||
avoided_flags="$avoided_flags --avoid=$module"
|
||||
done
|
||||
|
||||
# Clean the lib directory as well.
|
||||
if [ -e "$src"/lib/Makefile ]; then
|
||||
make -C "$src"/lib maintainer-clean
|
||||
fi
|
||||
|
||||
"$gnulib_srcdir"/gnulib-tool --dir="$src" $GNULIB_TOOL_FLAGS \
|
||||
$avoided_flags $GNULIB_MODULES &&
|
||||
rm -- "$src"lib/gl_openssl.h \
|
||||
@ -135,4 +140,8 @@ cp -- "$gnulib_srcdir"/lib/af_alg.h \
|
||||
{ test -z "$src" || cd "$src"; } &&
|
||||
./autogen.sh
|
||||
|
||||
echo "Please update the block of vpath statements in lib/Makefile.in"
|
||||
# Finally, update the files in lib/ to xcompile/lib.
|
||||
rsync "$src"/lib "$src"/xcompile
|
||||
|
||||
# Remove unnecessary files.
|
||||
rm -f "$src"/xcompile/lib/*.mk.in "$src"/xcompile/lib/Makefile.in
|
||||
|
297
doc/emacs/android.texi
Normal file
297
doc/emacs/android.texi
Normal file
@ -0,0 +1,297 @@
|
||||
@c This is part of the Emacs manual.
|
||||
@c Copyright (C) 2021--2023 Free Software Foundation, Inc.
|
||||
@c See file emacs.texi for copying conditions.
|
||||
@node Android
|
||||
@appendix Emacs and Android
|
||||
@cindex Android
|
||||
|
||||
Android is a mobile operating system developed by the Open Handset
|
||||
Alliance. This section describes the peculiarities of using Emacs on
|
||||
an Android device running Android 2.2 or later.
|
||||
|
||||
@menu
|
||||
* What is Android?:: Preamble.
|
||||
* Android Startup:: Starting up Emacs on Android.
|
||||
* Android File System:: The Android file system.
|
||||
* Android Environment:: Running Emacs under Android.
|
||||
@end menu
|
||||
|
||||
@node What is Android?
|
||||
@section Android history
|
||||
|
||||
Android is an operating system for mobile devices developed by the
|
||||
Open Handset Alliance, a group of companies interested in developing
|
||||
handsets that can run a common set of software. It is supposedly free
|
||||
software.
|
||||
|
||||
Like the X Consortium of times past, the Open Handset Alliance
|
||||
believes that ``openness'' (namely, the regular release of the Android
|
||||
source code) is simply a tool to increase the popularity of the
|
||||
Android platform. Computer companies normally produce proprietary
|
||||
software. The companies in the Open Handset Alliance are no different
|
||||
-- most versions of Android installed on devices are proprietary, by
|
||||
virtue of containing proprietary components, that often cannot even be
|
||||
replaced by the user.
|
||||
|
||||
Android is not designed to respect users' freedom. Almost all
|
||||
versions of Android (including some which are supposedly free
|
||||
software) include support for Digital Restrictions Management,
|
||||
technology that is designed to limit users' ability to copy media to
|
||||
and from their own devices. Most Android devices also come with
|
||||
proprietary Google applications which are required to run the system,
|
||||
and many other Android applications.
|
||||
|
||||
Thus, it must be necessary to consider Android proprietary software
|
||||
from a practical standpoint. That is an injustice. If you use
|
||||
Android, we urge you to switch to a free operating system, if only for
|
||||
your freedom's sake.
|
||||
|
||||
We support GNU Emacs on proprietary operating systems because we
|
||||
hope this taste of freedom will inspire users to escape from them.
|
||||
|
||||
@node Android Startup
|
||||
@section Starting up Emacs on Android
|
||||
|
||||
Emacs is not installed on Android devices from source code, or by a
|
||||
package manager. Instead, Emacs is compiled for Android on a
|
||||
different operating system, with the resulting binaries packaged into
|
||||
an archive, that is then transferred to the device and unpacked.
|
||||
|
||||
After being unpacked, Emacs instructs the system to display an
|
||||
application icon on the desktop. Emacs then starts up once the
|
||||
application icon is clicked.
|
||||
|
||||
@cindex ``adb logcat''
|
||||
|
||||
During startup, Emacs will display messages in the system log buffer;
|
||||
reading that buffer requires the Android Debug Bridge (@code{adb})
|
||||
utility to be installed on another computer; it cannot be read on the
|
||||
computer running Android itself.
|
||||
|
||||
After enabling the ``USB Debugging'' feature on the Android system,
|
||||
and connecting it via USB to another system with the @code{adb}
|
||||
utility installed, the log can be viewed by running the following
|
||||
command on that other system:
|
||||
|
||||
@example
|
||||
$ adb logcat | grep -E "(android_run_debug_thread|[Ee]macs)"
|
||||
@end example
|
||||
|
||||
@node Android File System
|
||||
@section What files Emacs can access under Android
|
||||
@cindex /assets directory, android
|
||||
|
||||
Emacs exposes a special directory on Android systems: the name of
|
||||
the directory is @file{/assets}, and it contains the @file{etc},
|
||||
@file{lisp} and @file{info} directories which are normally installed
|
||||
in @file{/usr/share/emacs} directory on GNU and Unix systems.
|
||||
|
||||
@cindex limitations of the /assets directory
|
||||
|
||||
This directory exists because Android does not extract the contents of
|
||||
application packages on to the file system while unpacking them, but
|
||||
instead requires programs like Emacs to access its contents using a
|
||||
special ``asset manager'' interface. Here are the peculiarities that
|
||||
result from such an implementation:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Subprocesses (such as @command{ls}) can not run from the
|
||||
@file{/assets} directory, so Dired, and functions such as
|
||||
@code{list-directory} do not work.
|
||||
|
||||
@item
|
||||
There are no @file{.} and @file{..} directories inside the
|
||||
@file{/assets} directory.
|
||||
|
||||
@item
|
||||
Files in the @file{/assets} directory are always read only, and have
|
||||
to be completely read in to memory each time they are opened.
|
||||
|
||||
@item
|
||||
@code{directory-files} does not return a useful value on the
|
||||
@file{/assets} directory itself, and does not return subdirectories
|
||||
inside subdirectories of the @file{/assets} directory.
|
||||
@end itemize
|
||||
|
||||
Aside from the @file{/assets} directory, Android programs normally
|
||||
have access to three other directories. They are:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
The @dfn{app data} directory. This also serves as the home directory
|
||||
for Emacs, and is always accessible read-write.
|
||||
|
||||
@item
|
||||
The @dfn{app library} directory. This is automatically appended to
|
||||
@code{exec-path} upon startup.
|
||||
|
||||
@item
|
||||
The @dfn{external storage} directory. This is accessible to Emacs
|
||||
when the user grants the @code{Files and media} permission to Emacs
|
||||
via system settings.
|
||||
@end itemize
|
||||
|
||||
The external storage directory is found at @file{/sdcard}; the other
|
||||
directories are not found at any fixed location.
|
||||
|
||||
@node Android Environment
|
||||
@section Running Emacs under Android
|
||||
|
||||
From the perspective of users, Android is mostly a single user
|
||||
operating system; however, from the perspective of applications and
|
||||
Emacs, the system has an overwhelming number of users!
|
||||
|
||||
Each application runs in its own user, with his own home directory,
|
||||
which is the app data directory (@pxref{Android File System}.)
|
||||
|
||||
Each application is also prohibited from accessing system
|
||||
directories, and the app data directories of other applications. In
|
||||
recent versions of Android, the system also prohibits, for security
|
||||
reasons, even Emacs itself from running executables inside the app
|
||||
data directory!
|
||||
|
||||
Emacs comes with several binaries. While being executable files,
|
||||
they are packaged as libraries in the library directory, because
|
||||
otherwise the system will not unpack them while Emacs is being
|
||||
installed. This means, instead of specifying @code{ctags} or
|
||||
@code{emacsclient} in a subprocess, Lisp code must specify
|
||||
@code{libctags.so} or @code{libemacsclient.so} on the commnd line
|
||||
instead when starting either of those programs in a subprocess.
|
||||
|
||||
@c TODO: remove this limitation.
|
||||
In addition, the @file{/assets} directory containing Emacs start-up
|
||||
files is inaccessible to processes not directly created by
|
||||
@code{zygote}, the system service responsible for starting
|
||||
applications. This makes it impossible to run Emacs in a subprocess
|
||||
within itself.
|
||||
|
||||
@section Running Emacs in the background
|
||||
@cindex emacs killed, android
|
||||
@cindex emacs in the background, android
|
||||
|
||||
Application processes are treated as disposable entities by the
|
||||
system. When all Emacs frames move to the background, Emacs is liable
|
||||
to be killed by the system at any time, for the purpose of saving
|
||||
resources. There is currently no easy way to bypass these
|
||||
restrictions, aside from keeping Emacs constantly running in the
|
||||
foreground.
|
||||
|
||||
@section Android permissions
|
||||
@cindex external storage, android
|
||||
|
||||
Android also defines a permissions system that determines what
|
||||
system services Emacs is allowed to access. Programs must specify
|
||||
what permissions they want; what then happens depends on the version
|
||||
of Android being used:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
On Android 5.1 and earlier, Emacs automatically receives the following
|
||||
permissions it has requested upon being installed:
|
||||
|
||||
@itemize @minus
|
||||
@item
|
||||
@code{android.permission.READ_CONTACTS}
|
||||
@item
|
||||
@code{android.permission.WRITE_CONTACTS}
|
||||
@item
|
||||
@code{android.permission.VIBRATE}
|
||||
@item
|
||||
@code{android.permission.ACCESS_COARSE_LOCATION}
|
||||
@item
|
||||
@code{android.permission.INTERNET}
|
||||
@item
|
||||
@code{android.permission.SET_WALLPAPER}
|
||||
@item
|
||||
@code{android.permission.WRITE_EXTERNAL_STORAGE}
|
||||
@item
|
||||
@code{android.permission.SEND_SMS}
|
||||
@item
|
||||
@code{android.permission.RECEIVE_SMS}
|
||||
@item
|
||||
@code{android.permission.RECEIVE_MMS}
|
||||
@item
|
||||
@code{android.permission.WRITE_SMS}
|
||||
@item
|
||||
@code{android.permission.READ_SMS}
|
||||
@item
|
||||
@code{android.permission.NFC}
|
||||
@item
|
||||
@code{android.permission.TRANSMIT_IR}
|
||||
@item
|
||||
@code{android.permission.READ_PHONE_STATE}
|
||||
@item
|
||||
@code{android.permission.WAKE_LOCK}
|
||||
@item
|
||||
@code{android.permission.FOREGROUND_SEVICE}
|
||||
@item
|
||||
@code{android.permission.REQUEST_INSTALL_PACKAGES}
|
||||
@item
|
||||
@code{android.permission.REQUEST_DELETE_PACKAGES}
|
||||
@item
|
||||
@code{android.permission.SYSTEM_ALERT_WINDOW}
|
||||
@item
|
||||
@code{android.permission.RECORD_AUDIO}
|
||||
@item
|
||||
@code{android.permission.CAMERA}
|
||||
@end itemize
|
||||
|
||||
While most of these permissions are left unused by Emacs itself, they
|
||||
are declared by Emacs as they could be useful for other programs; for
|
||||
example, the permission to access contacts may be useful for EUDC.
|
||||
|
||||
@item
|
||||
On Android 6.0 and later, Emacs only receives the following
|
||||
permissions upon installation:
|
||||
|
||||
@itemize @minus
|
||||
@item
|
||||
@code{android.permission.VIBRATE}
|
||||
@item
|
||||
@code{android.permission.INTERNET}
|
||||
@item
|
||||
@code{android.permission.SET_WALLPAPER}
|
||||
@item
|
||||
@code{android.permission.NFC}
|
||||
@item
|
||||
@code{android.permission.TRANSMIT_IR}
|
||||
@item
|
||||
@code{android.permission.WAKE_LOCK}
|
||||
@end itemize
|
||||
|
||||
Other permissions must be granted by the user through the system
|
||||
settings application. Consult the manufacturer of your device for
|
||||
more details, as how to do this varies by device.
|
||||
@end itemize
|
||||
|
||||
@section Android windowing
|
||||
|
||||
Android has an unusual window system; there, all windows are
|
||||
maximized or full-screen, and only one window can be displayed at a
|
||||
time. On larger devices, the system allows up to four windows to be
|
||||
tiled on the screen at any time.
|
||||
|
||||
Windows on Android do not continue to exist indefinitely after they
|
||||
are created. Instead, the system may choose to terminate windows that
|
||||
are not on screen in order to save memory, with the assumption that
|
||||
the program will save its contents to disk and restore them later,
|
||||
when the user asks to open it again. As this is obvious not possible
|
||||
with Emacs, Emacs separates a frame from a system window.
|
||||
|
||||
Each system window created (including the initial window created
|
||||
during Emacs startup) is appended to a list of windows that do not
|
||||
have associated frames. When a frame is created, Emacs looks up any
|
||||
window within that list, and displays the contents of the frame
|
||||
within; if there is no window at all, then one is created. Likewise,
|
||||
when a new window is created by the system, Emacs places the contents
|
||||
of any frame that is not already displayed within a window inside.
|
||||
When a frame is closed, the corresponding system window is also
|
||||
closed.
|
||||
|
||||
This strategy works as long as one window is in the foreground.
|
||||
Otherwise, Emacs can only run in the background for a limited amount
|
||||
of time before the process is killed completely.
|
||||
|
||||
@c TODO: write more documentation here about what is supported and
|
||||
@c what is not, and fonts.
|
@ -1256,6 +1256,13 @@ Emacs and Haiku
|
||||
* Haiku Basics:: Basic Emacs usage and installation under Haiku.
|
||||
* Haiku Fonts:: The various options for displaying fonts on Haiku.
|
||||
|
||||
Emacs and Android
|
||||
|
||||
* What is Android?:: Preamble.
|
||||
* Android Startup:: Starting up Emacs on Android.
|
||||
* Android File System:: The Android file system.
|
||||
* Android Environment:: Running Emacs under Android.
|
||||
|
||||
Emacs and Microsoft Windows/MS-DOS
|
||||
|
||||
* Windows Startup:: How to start Emacs on Windows.
|
||||
@ -1626,6 +1633,7 @@ Lisp programming.
|
||||
@include anti.texi
|
||||
@include macos.texi
|
||||
@include haiku.texi
|
||||
@include android.texi
|
||||
@c Includes msdos-xtra.
|
||||
@include msdos.texi
|
||||
@include gnu.texi
|
||||
|
@ -36,7 +36,7 @@ public class EmacsThread extends Thread
|
||||
{
|
||||
String args[];
|
||||
|
||||
args = new String[] { "android-emacs", };
|
||||
args = new String[] { "libandroid-emacs.so", };
|
||||
|
||||
/* Run the native code now. */
|
||||
EmacsNative.initEmacs (args);
|
||||
|
121
lib/Makefile.in
121
lib/Makefile.in
@ -29,121 +29,6 @@ XCONFIGURE = @XCONFIGURE@
|
||||
# counterparts.
|
||||
ANDROID_CFLAGS = @ANDROID_CFLAGS@
|
||||
|
||||
ifneq ($(XCONFIGURE),)
|
||||
|
||||
# Set vpath. Only look for C files and some headers in srcdir:
|
||||
# Headers that are generated by gnulib must be spared, or otherwise
|
||||
# the versions previously built on the host will be used, if builddir
|
||||
# is the same as srcdir. Following this is a list of files in lib/
|
||||
# that are not generated during the gnulib build process. Please keep
|
||||
# it up to date!
|
||||
|
||||
vpath _Noreturn.h $(srcdir)
|
||||
vpath acl-internal.h $(srcdir)
|
||||
vpath acl.h $(srcdir)
|
||||
vpath af_alg.h $(srcdir)
|
||||
vpath alloca.in.h $(srcdir)
|
||||
vpath allocator.h $(srcdir)
|
||||
vpath arg-nonnull.h $(srcdir)
|
||||
vpath assert.in.h $(srcdir)
|
||||
vpath attribute.h $(srcdir)
|
||||
vpath binary-io.h $(srcdir)
|
||||
vpath byteswap.in.h $(srcdir)
|
||||
vpath c++defs.h $(srcdir)
|
||||
vpath c-ctype.h $(srcdir)
|
||||
vpath c-strcase.h $(srcdir)
|
||||
vpath careadlinkat.h $(srcdir)
|
||||
vpath cdefs.h $(srcdir)
|
||||
vpath cloexec.h $(srcdir)
|
||||
vpath close-stream.h $(srcdir)
|
||||
vpath count-leading-zeros.h $(srcdir)
|
||||
vpath count-one-bits.h $(srcdir)
|
||||
vpath count-trailing-zeros.h $(srcdir)
|
||||
vpath diffseq.h $(srcdir)
|
||||
vpath dirent.h $(srcdir)
|
||||
vpath dirent.in.h $(srcdir)
|
||||
vpath dynarray.h $(srcdir)
|
||||
vpath eloop-threshold.h $(srcdir)
|
||||
vpath errno.in.h $(srcdir)
|
||||
vpath execinfo.in.h $(srcdir)
|
||||
vpath fcntl.in.h $(srcdir)
|
||||
vpath filemode.h $(srcdir)
|
||||
vpath filename.h $(srcdir)
|
||||
vpath filevercmp.h $(srcdir)
|
||||
vpath fingerprint.h $(srcdir)
|
||||
vpath flexmember.h $(srcdir)
|
||||
vpath fpending.h $(srcdir)
|
||||
vpath fsusage.h $(srcdir)
|
||||
vpath ftoastr.h $(srcdir)
|
||||
vpath getopt-cdefs.in.h $(srcdir)
|
||||
vpath getopt-core.h $(srcdir)
|
||||
vpath getopt-ext.h $(srcdir)
|
||||
vpath getopt-pfx-core.h $(srcdir)
|
||||
vpath getopt-pfx-ext.h $(srcdir)
|
||||
vpath getopt.in.h $(srcdir)
|
||||
vpath getopt_int.h $(srcdir)
|
||||
vpath gettext.h $(srcdir)
|
||||
vpath idx.h $(srcdir)
|
||||
vpath ieee754.in.h $(srcdir)
|
||||
vpath ignore-value.h $(srcdir)
|
||||
vpath intprops-internal.h $(srcdir)
|
||||
vpath intprops.h $(srcdir)
|
||||
vpath inttypes.in.h $(srcdir)
|
||||
vpath libc-config.h $(srcdir)
|
||||
vpath limits.in.h $(srcdir)
|
||||
vpath malloc/dynarray.h $(srcdir)
|
||||
vpath malloc/scratch_buffer.h $(srcdir)
|
||||
vpath md5.h $(srcdir)
|
||||
vpath min-max.h $(srcdir)
|
||||
vpath mini-gmp.h $(srcdir)
|
||||
vpath minmax.h $(srcdir)
|
||||
vpath mktime-internal.h $(srcdir)
|
||||
vpath nproc.h $(srcdir)
|
||||
vpath openat-priv.h $(srcdir)
|
||||
vpath openat.h $(srcdir)
|
||||
vpath pathmax.h $(srcdir)
|
||||
vpath regex.h $(srcdir)
|
||||
vpath regex_internal.h $(srcdir)
|
||||
vpath root-uid.h $(srcdir)
|
||||
vpath save-cwd.h $(srcdir)
|
||||
vpath scratch_buffer.h $(srcdir)
|
||||
vpath sha1.h $(srcdir)
|
||||
vpath sha256.h $(srcdir)
|
||||
vpath sha512.h $(srcdir)
|
||||
vpath sig2str.h $(srcdir)
|
||||
vpath signal.in.h $(srcdir)
|
||||
vpath stat-time.h $(srcdir)
|
||||
vpath stdalign.in.h $(srcdir)
|
||||
vpath stdckdint.in.h $(srcdir)
|
||||
vpath stddef.in.h $(srcdir)
|
||||
vpath stdint.in.h $(srcdir)
|
||||
vpath stdio-impl.h $(srcdir)
|
||||
vpath stdio.h $(srcdir)
|
||||
vpath stdio.in.h $(srcdir)
|
||||
vpath stdlib.in.h $(srcdir)
|
||||
vpath str-two-way.h $(srcdir)
|
||||
vpath strftime.h $(srcdir)
|
||||
vpath string.in.h $(srcdir)
|
||||
vpath sys_random.in.h $(srcdir)
|
||||
vpath sys_select.in.h $(srcdir)
|
||||
vpath sys_stat.in.h $(srcdir)
|
||||
vpath sys_time.in.h $(srcdir)
|
||||
vpath sys_types.in.h $(srcdir)
|
||||
vpath tempname.h $(srcdir)
|
||||
vpath time-internal.h $(srcdir)
|
||||
vpath time.in.h $(srcdir)
|
||||
vpath timespec.h $(srcdir)
|
||||
vpath u64.h $(srcdir)
|
||||
vpath unistd.in.h $(srcdir)
|
||||
vpath unlocked-io.h $(srcdir)
|
||||
vpath utimens.h $(srcdir)
|
||||
vpath verify.h $(srcdir)
|
||||
vpath vla.h $(srcdir)
|
||||
vpath warn-on-use.h $(srcdir)
|
||||
vpath xalloc-oversized.h $(srcdir)
|
||||
vpath %.c $(srcdir)
|
||||
endif
|
||||
|
||||
# Variables substituted by 'configure', and not autogenerated in gnulib.mk,
|
||||
# or needed before gnulib.mk is included.
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
@ -160,7 +45,7 @@ HAVE_NATIVE_COMP = @HAVE_NATIVE_COMP@
|
||||
ALL_CFLAGS = \
|
||||
$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) $(DEPFLAGS) \
|
||||
$(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS) $(PROFILING_CFLAGS) $(CFLAGS) \
|
||||
-I. -I../src -I$(srcdir) -I$(srcdir)/../src \
|
||||
-I. -I../src -I$(srcdir) -I$(top_srcdir)/src \
|
||||
$(if $(patsubst e-%,,$(notdir $<)),,-Demacs) $(ANDROID_CFLAGS)
|
||||
|
||||
ifeq ($(HAVE_NATIVE_COMP),yes)
|
||||
@ -244,10 +129,10 @@ clean:
|
||||
mostlyclean: clean
|
||||
rm -f $(filter-out %-t,$(MOSTLYCLEANFILES))
|
||||
distclean bootstrap-clean: mostlyclean
|
||||
rm -f Makefile
|
||||
rm -f Makefile Makefile.android
|
||||
rm -fr $(DEPDIR)
|
||||
maintainer-clean: distclean
|
||||
rm -f TAGS gnulib.mk
|
||||
rm -f TAGS gnulib.mk gnulib.mk.android
|
||||
-rmdir malloc sys 2>/dev/null || true
|
||||
|
||||
.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean
|
||||
|
@ -33,15 +33,13 @@
|
||||
size_t
|
||||
__fpending (FILE *fp)
|
||||
{
|
||||
#if defined __ANDROID__
|
||||
return 0;
|
||||
/* Most systems provide FILE as a struct and the necessary bitmask in
|
||||
<stdio.h>, because they need it for implementing getc() and putc() as
|
||||
fast macros. */
|
||||
#elif defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
|
||||
#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
|
||||
/* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
return fp->_IO_write_ptr - fp->_IO_write_base;
|
||||
#elif defined __sferror || defined __DragonFly__
|
||||
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
|
||||
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */
|
||||
return fp->_p - fp->_bf._base;
|
||||
#elif defined __EMX__ /* emx+gcc */
|
||||
|
@ -40,11 +40,7 @@ orig_open (const char *filename, int flags, mode_t mode)
|
||||
/* Specification. */
|
||||
/* Write "fcntl.h" here, not <fcntl.h>, otherwise OSF/1 5.1 DTK cc eliminates
|
||||
this include because of the preliminary #include <fcntl.h> above. */
|
||||
#ifdef __ANDROID__
|
||||
#include <fnctl.h>
|
||||
#else
|
||||
#include "fcntl.h"
|
||||
#endif
|
||||
|
||||
#include "cloexec.h"
|
||||
|
||||
|
@ -18,5 +18,5 @@
|
||||
#include <config.h>
|
||||
|
||||
#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE
|
||||
#include <unistd.h>
|
||||
#include "unistd.h"
|
||||
typedef int dummy;
|
||||
|
@ -30,6 +30,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <android/bitmap.h>
|
||||
|
||||
|
@ -270,7 +270,7 @@ android_flush_dirty_back_buffer_on (struct frame *f)
|
||||
/* If the frame is not already up to date, do not flush buffers
|
||||
on input, as that will result in flicker. */
|
||||
|| !FRAME_ANDROID_COMPLETE_P (f)
|
||||
&& FRAME_ANDROID_NEED_BUFFER_FLIP (f))
|
||||
|| !FRAME_ANDROID_NEED_BUFFER_FLIP (f))
|
||||
return;
|
||||
|
||||
show_back_buffer (f);
|
||||
|
@ -38,7 +38,7 @@ top_builddir = @top_builddir@
|
||||
|
||||
# This is possibly the ugliest Makefile ever written!
|
||||
|
||||
LIB_SRCDIR = $(realpath $(top_srcdir)/lib)
|
||||
LIB_SRCDIR = $(realpath ./lib)
|
||||
LIB_TOP_SRCDIR = $(realpath $(top_srcdir))
|
||||
|
||||
SRC_SRCDIR = $(realpath $(top_srcdir)/src)
|
||||
@ -52,7 +52,7 @@ LIB_SRC_TOP_SRCDIR = $(realpath $(top_src))
|
||||
LIBSRC_BINARIES = lib-src/etags lib-src/ctags lib-src/emacsclient \
|
||||
lib-src/ebrowse lib-src/hexl lib-src/movemail
|
||||
|
||||
CLEAN_SUBDIRS=lib src lib-src
|
||||
CLEAN_SUBDIRS=src lib-src
|
||||
|
||||
.PHONY: all
|
||||
all: lib/libgnu.a src/libemacs.so src/android-emacs $(LIBSRC_BINARIES)
|
||||
@ -68,12 +68,6 @@ src/verbose.mk: verbose.mk.android
|
||||
mkdir -p src
|
||||
cp -f verbose.mk.android src/verbose.mk
|
||||
|
||||
UGLY_HOST_HEADERS = dirent.h stdlib.h sys/random.h limits.h \
|
||||
string.h signal.h time.h inttypes.h assert.h \
|
||||
stdint.h unistd.h stdlib.h sys/types.h sys/time.h \
|
||||
sys/stat.h getopt.h fcntl.h sys/select.h alloca.h \
|
||||
stdio.h sys/random.h
|
||||
|
||||
# Gnulib, make-fingerprint and make-docfile must be built before
|
||||
# entering any of the rules below, or they will get the Android
|
||||
# versions of many headers.
|
||||
@ -94,38 +88,26 @@ PRE_BUILD_DEPS=$(top_builddir)/lib/libgnu.a \
|
||||
$(top_builddir)/lib-src/make-fingerprint \
|
||||
$(top_builddir)/lib-src/make-docfile
|
||||
|
||||
.PHONY: lib/libgnu.a
|
||||
lib/libgnu.a: src/verbose.mk config.status $(PRE_BUILD_DEPS)
|
||||
mkdir -p lib/deps lib/deps/malloc
|
||||
# Temporarily move config.h to config.h.bak and config.h.android to
|
||||
# config.h
|
||||
lib/config.h: $(top_builddir)/src/config.h.android
|
||||
cp -f -p $(top_builddir)/src/config.h.android lib/config.h
|
||||
# And the Makefiles.
|
||||
|
||||
lib/gnulib.mk: $(top_builddir)/lib/gnulib.mk.android
|
||||
cp -f -p $(top_builddir)/lib/gnulib.mk.android lib/gnulib.mk
|
||||
sed -i 's/srcdir =.*$$/srcdir = $(subst /,\/,$(LIB_SRCDIR))/g' \
|
||||
lib/gnulib.mk
|
||||
|
||||
lib/Makefile: $(top_builddir)/lib/Makefile.android
|
||||
cp -f -p $(top_builddir)/lib/Makefile.android lib/Makefile
|
||||
# Next, move srcdir and top_srcdir in the Makefiles copied.
|
||||
sed -i 's/srcdir =.*$$/srcdir = $(subst /,\/,$(LIB_SRCDIR))/g' lib/Makefile
|
||||
sed -i 's/top_srcdir =.*$$/top_srcdir = $(subst /,\/,$(LIB_TOP_SRCDIR))/g' \
|
||||
lib/Makefile
|
||||
sed -i 's/srcdir =.*$$/srcdir = $(subst /,\/,$(LIB_SRCDIR))/g' lib/gnulib.mk
|
||||
# Ugly hack: hide some troublesome headers in $(top_builddir)/lib
|
||||
# while building lib. Otherwise, they will end up overriding the
|
||||
# system headers used on Android through #include_next and cause
|
||||
# trouble.
|
||||
mkdir -p sys
|
||||
for ugly_header in $(UGLY_HOST_HEADERS); do \
|
||||
if [ -e "$(top_builddir)/lib/$$ugly_header" ]; then \
|
||||
mv -f $(top_builddir)/lib/$$ugly_header $$ugly_header.bak; \
|
||||
fi \
|
||||
done
|
||||
# And make libgnu.a. Restore config.h if it fails.
|
||||
-make -C lib libgnu.a
|
||||
# Move the hiden headers back
|
||||
for ugly_header in $(UGLY_HOST_HEADERS); do \
|
||||
if [ -e "$$ugly_header.bak" ]; then \
|
||||
mv -f $$ugly_header.bak $(top_builddir)/lib/$$ugly_header; \
|
||||
fi \
|
||||
done
|
||||
|
||||
# What is needed to build gnulib.
|
||||
LIB_DEPS = lib/config.h lib/gnulib.mk lib/Makefile
|
||||
|
||||
.PHONY: lib/libgnu.a
|
||||
lib/libgnu.a: src/verbose.mk config.status $(LIB_DEPS) $(PRE_BUILD_DEPS)
|
||||
mkdir -p lib/deps lib/deps/malloc
|
||||
+make -C lib libgnu.a
|
||||
|
||||
src/Makefile src/config.h &: $(top_builddir)/src/config.h.android \
|
||||
$(top_builddir)/src/Makefile.android $(PRE_BUILD_DEPS)
|
||||
@ -145,32 +127,19 @@ src/Makefile src/config.h &: $(top_builddir)/src/config.h.android \
|
||||
# that src/Makefile uses the binaries there, instead of any
|
||||
# cross-compiled binaries at ./lib-src.
|
||||
sed -i 's/libsrc =.*$$/libsrc = \.\.\/\.\.\/lib-src/g' src/Makefile
|
||||
# Edit out anything saying -I($(top_srcdir)/lib); that should be
|
||||
# covered by -I$(lib)
|
||||
sed -i 's/-I\$$(top_srcdir)\/lib//g' src/Makefile
|
||||
|
||||
.PHONY: src/android-emacs src/libemacs.so
|
||||
src/android-emacs src/libemacs.so &: src/Makefile src/config.h \
|
||||
src/verbose.mk lib/libgnu.a $(PRE_BUILD_DEPS)
|
||||
# Ugly hack: hide some troublesome headers in $(top_builddir)/lib
|
||||
# while building lib. Otherwise, they will end up overriding the
|
||||
# system headers used on Android through #include_next and cause
|
||||
# trouble.
|
||||
mkdir -p sys
|
||||
for ugly_header in $(UGLY_HOST_HEADERS); do \
|
||||
if [ -e "$(top_builddir)/lib/$$ugly_header" ]; then \
|
||||
mv -f $(top_builddir)/lib/$$ugly_header $$ugly_header.bak; \
|
||||
fi \
|
||||
done
|
||||
# Finally, go into src and make
|
||||
+make -C src android-emacs libemacs.so
|
||||
# Move the hidden headers back
|
||||
for ugly_header in $(UGLY_HOST_HEADERS); do \
|
||||
if [ -e "$$ugly_header.bak" ]; then \
|
||||
mv -f $$ugly_header.bak $(top_builddir)/lib/$$ugly_header; \
|
||||
fi \
|
||||
done
|
||||
|
||||
lib-src/Makefile: $(top_builddir)/lib-src/Makefile.android
|
||||
mkdir -p lib-src
|
||||
cp -f -p $< $@
|
||||
sed -i 's/-I\$${srcdir}\/\.\.\/lib//g' lib-src/Makefile
|
||||
|
||||
.PHONY: $(LIBSRC_BINARIES)
|
||||
$(LIBSRC_BINARIES) &: src/verbose.mk $(top_builddir)/$@ lib/libgnu.a \
|
||||
@ -183,27 +152,18 @@ $(LIBSRC_BINARIES) &: src/verbose.mk $(top_builddir)/$@ lib/libgnu.a \
|
||||
lib-src/Makefile
|
||||
# Edit out SCRIPTS, it interferes with the build.
|
||||
sed -i 's/^SCRIPTS=.*$$/SCRIPTS=/g' lib-src/Makefile
|
||||
# Ugly hack: hide some troublesome headers in $(top_builddir)/lib
|
||||
# while building lib. Otherwise, they will end up overriding the
|
||||
# system headers used on Android through #include_next and cause
|
||||
# trouble.
|
||||
mkdir -p sys
|
||||
for ugly_header in $(UGLY_HOST_HEADERS); do \
|
||||
if [ -e "$(top_builddir)/lib/$$ugly_header" ]; then \
|
||||
mv -f $(top_builddir)/lib/$$ugly_header $$ugly_header.bak; \
|
||||
fi \
|
||||
done
|
||||
# Finally, go into lib-src and make everything being built
|
||||
+make -C lib-src $(foreach bin,$(LIBSRC_BINARIES),$(notdir $(bin)))
|
||||
# Move the hidden headers back
|
||||
for ugly_header in $(UGLY_HOST_HEADERS); do \
|
||||
if [ -e "$$ugly_header.bak" ]; then \
|
||||
mv -f $$ugly_header.bak $(top_builddir)/lib/$$ugly_header; \
|
||||
fi \
|
||||
done
|
||||
|
||||
.PHONY: clean maintainer-clean
|
||||
clean:
|
||||
rm -rf $(CLEAN_SUBDIRS) *.bak sys
|
||||
if [ -e lib/Makefile ]; then \
|
||||
make -C lib clean; \
|
||||
fi
|
||||
rm -rf lib/gnulib.mk lib/Makefile lib/config.h
|
||||
|
||||
maintainer-clean: clean
|
||||
if [ -e lib/Makefile ]; then \
|
||||
make -C lib maintainer-clean; \
|
||||
fi
|
||||
|
@ -1,7 +1,3 @@
|
||||
This directory holds Makefiles and other required assets to build an
|
||||
Emacs binary independently for another toolchain, which is currently
|
||||
required when building for Android.
|
||||
|
||||
The files here are extremely ugly, and contain rules that cannot be
|
||||
interrupted without leaving the build tree in an unsafe state. At
|
||||
some point that should be fixed!
|
||||
Emacs binary independently for another toolchain. It also holds
|
||||
another copy of gnulib that may be modified to work on Android.
|
||||
|
Loading…
Reference in New Issue
Block a user