mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 18:37:33 +00:00
* .gitignore: Update with new files. Do not ignore std*.in.h. * INSTALL.android: Explain how to build Emacs with external dependencies. * Makefile.in (xcompile, cross): Rename to `cross'. (clean_dirs): Clean cross, not xcompile. * README: Document new directories. * build-aux/ndk-build-helper-1.mk (build_kind, NDK_SO_NAMES): * build-aux/ndk-build-helper-2.mk (build_kind, NDK_SO_NAMES): * build-aux/ndk-build-helper-3.mk (build_kind): * build-aux/ndk-build-helper-4.mk: * build-aux/ndk-build-helper.mk (NDK_BUILD_DIR, my-dir): * build-aux/ndk-module-extract.awk: New files. * configure.ac: Set up libgif, libwebp, and libpng for ndk-build. * cross/ndk-build/Makefile.in (srcdir, NDK_BUILD_ANDROID_MK): * cross/ndk-build/ndk-build-executable.mk: * cross/ndk-build/ndk-build-shared-library.mk (eq, objname): * cross/ndk-build/ndk-build-static-library.mk (eq, objname): * cross/ndk-build/ndk-build.in (NDK_BUILD_MODULES): * cross/ndk-build/ndk-build.mk.in (NDK_BUILD_MODULES) (NDK_BUILD_SHARED): * cross/ndk-build/ndk-clear-vars.mk: * cross/ndk-build/ndk-prebuilt-shared-library.mk: * cross/ndk-build/ndk-prebuilt-static-library.mk: New files. * doc/emacs/android.texi (Android, Android Environment): Document clipboard support on Android. * doc/emacs/emacs.texi (Top): Update menus. * etc/MACHINES: Document Android. * java/AndroidManifest.xml.in: Respect new `--with-android-debug' option. * java/Makefile.in (CROSS_BINS, CROSS_LIBS): Adjust for rename. Include ndk-build.mk.:(emacs.apk-in): Depend on shared libraries. Then, package shared libraries. * java/org/gnu/emacs/EmacsClipboard.java (EmacsClipboard): New class. * java/org/gnu/emacs/EmacsFontDriver.java: Update comment to say this is unused. * java/org/gnu/emacs/EmacsNative.java (EmacsNative): New function `sendExpose'. * java/org/gnu/emacs/EmacsSdk11Clipboard.java (EmacsSdk11Clipboard): * java/org/gnu/emacs/EmacsSdk8Clipboard.java (EmacsSdk8Clipboard): New classes. * java/org/gnu/emacs/EmacsView.java (EmacsView, handleDirtyBitmap) (onDetachedFromWindow): When window is reattached, expose the frame. * lib/Makefile.in (VPATH): (ALL_CFLAGS): Adjust for rename. * lisp/term/android-win.el (android-clipboard-exists-p) (android-get-clipboard, android-set-clipboard) (android-clipboard-owner-p, android-primary-selection) (android-get-clipboard-1, android-get-primary) (android-selection-bounds, android-encode-select-string) (gui-backend-get-selection, gui-backend-selection-exists-p) (gui-backend-selection-owner-p, gui-backend-set-selection): New functions. * m4/ndk-build.m4: New file. * src/Makefile.in (GIF_CFLAGS, ANDROID_LDFLAGS): New variables. (EMACS_CFLAGS): Add GIF_CFLAGS. Include ndk-build.mk. (libemacs.so): Depend on and link with required libraries. * src/android.c (android_check_compressed_file): New function. (android_open): Work around Android platform bug. (sendExpose): New function. (android_readdir): Set d_type if this is a directory. * src/androidgui.h (enum android_event_type) (struct android_expose_event, union android_event): Add expose events. * src/androidselect.c (struct android_emacs_clipboard) (android_init_emacs_clipboard, Fandroid_clipboard_owner_p) (Fandroid_set_clipboard, Fandroid_get_clipboard) (Fandroid_clipboard_exists_p, init_androidselect) (syms_of_androidselect): New file. * src/androidterm.c (handle_one_android_event): Handle exposures. * src/androidterm.h: Update prototypes. * src/emacs.c (android_emacs_init): Initialize androidselect.
204 lines
6.6 KiB
Makefile
204 lines
6.6 KiB
Makefile
### @configure_input@
|
|
|
|
# Copyright (C) 2023 Free Software Foundation, Inc.
|
|
|
|
# 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/>.
|
|
|
|
top_builddir = @top_builddir@
|
|
top_srcdir = @top_srcdir@
|
|
version = @version@
|
|
|
|
# This is the host lib-src and lib, not the cross compiler's lib-src.
|
|
libsrc = ../lib-src
|
|
EXEEXT = @EXEEXT@
|
|
|
|
-include ${top_builddir}/src/verbose.mk
|
|
|
|
SHELL = @SHELL@
|
|
JAVAC = @JAVAC@
|
|
AAPT = @AAPT@
|
|
D8 = @D8@
|
|
ZIPALIGN = @ZIPALIGN@
|
|
JARSIGNER = @JARSIGNER@
|
|
JARSIGNER_FLAGS =
|
|
ANDROID_JAR = @ANDROID_JAR@
|
|
ANDROID_ABI = @ANDROID_ABI@
|
|
ANDROID_SDK_18_OR_EARLIER = @ANDROID_SDK_18_OR_EARLIER@
|
|
|
|
WARN_JAVAFLAGS = -Xlint:deprecation
|
|
JAVAFLAGS = -classpath "$(ANDROID_JAR):." -target 1.7 -source 1.7 \
|
|
$(WARN_JAVAFLAGS)
|
|
|
|
# Android 4.3 and earlier require Emacs to be signed with a different
|
|
# digital signature algorithm.
|
|
|
|
ifneq (,$(ANDROID_SDK_18_OR_EARLIER))
|
|
JARSIGNER_FLAGS = -sigalg MD5withRSA -digestalg SHA1
|
|
else
|
|
JARSIGNER_FLAGS =
|
|
endif
|
|
|
|
SIGN_EMACS = -keystore emacs.keystore -storepass emacs1 $(JARSIGNER_FLAGS)
|
|
|
|
JAVA_FILES = $(shell find . -type f -name *.java)
|
|
CLASS_FILES = $(foreach file,$(JAVA_FILES),$(basename $(file)).class)
|
|
|
|
# Compute the name for the Emacs application package. This should be:
|
|
# emacs-<version>-<min-sdk>-<abi>.apk
|
|
|
|
ANDROID_MIN_SDK = @ANDROID_MIN_SDK@
|
|
APK_NAME = emacs-$(version)-$(ANDROID_MIN_SDK)-$(ANDROID_ABI).apk
|
|
|
|
# How this stuff works.
|
|
|
|
# emacs.apk depends on emacs.apk-in, which is simply a ZIP archive
|
|
# containing the following files:
|
|
# lib/$(ANDROID_ABI)/libemacs.so
|
|
# lib/$(ANDROID_ABI)/libandroid-emacs.so
|
|
# lib/$(ANDROID_ABI)/libctags.so
|
|
# lib/$(ANDROID_ABI)/libhexl.so
|
|
# lib/$(ANDROID_ABI)/libmovemail.so
|
|
# lib/$(ANDROID_ABI)/librcs2log.so
|
|
# lib/$(ANDROID_ABI)/libebrowse.so
|
|
# assets/info/
|
|
# assets/etc/
|
|
# assets/lisp/
|
|
|
|
.PHONY: emacs.apk-in all
|
|
all: $(APK_NAME)
|
|
|
|
# Binaries to cross-compile.
|
|
CROSS_BINS = ../cross/src/android-emacs ../cross/lib-src/ctags \
|
|
../cross/lib-src/hexl ../cross/lib-src/movemail \
|
|
../cross/lib-src/ebrowse ../cross/lib-src/emacsclient
|
|
|
|
# Libraries to cross-compile.
|
|
CROSS_LIBS = ../cross/src/libemacs.so
|
|
|
|
# Third party libraries to compile.
|
|
include $(top_builddir)/cross/ndk-build/ndk-build.mk
|
|
|
|
.PHONY: $(CROSS_BINS) $(CROSS_LIBS)
|
|
|
|
../cross/src/android-emacs ../cross/src/libemacs.so:
|
|
make -C ../cross src/$(notdir $@)
|
|
|
|
../cross/lib-src/hexl ../cross/lib-src/movemail \
|
|
../cross/lib-src/ctags ../cross/lib-src/ebrowse &:
|
|
make -C ../cross lib-src/$(notdir $@)
|
|
|
|
# This is needed to generate the ``.directory-tree'' file used by the
|
|
# Android emulations of readdir and faccessat.
|
|
|
|
$(libsrc)/asset-directory-tool:
|
|
$(MAKE) -C $(libsrc) $(notdir $@)
|
|
|
|
emacs.apk-in: $(CROSS_BINS) $(CROSS_LIBS) $(libsrc)/asset-directory-tool \
|
|
AndroidManifest.xml $(NDK_BUILD_SHARED)
|
|
# Make the working directory for this stuff
|
|
rm -rf install_temp
|
|
mkdir -p install_temp/lib/$(ANDROID_ABI)
|
|
mkdir -p install_temp/assets/etc
|
|
mkdir -p install_temp/assets/lisp
|
|
mkdir -p install_temp/assets/info
|
|
# Install architecture independents to assets/etc and assets/lisp
|
|
cp -r $(top_builddir)/lisp install_temp/assets
|
|
cp -r $(top_builddir)/etc install_temp/assets
|
|
cp -r $(top_builddir)/info install_temp/assets
|
|
# Remove undesirable files from those directories.
|
|
for subdir in `find install_temp -type d -print`; do \
|
|
chmod a+rx $${subdir} ; \
|
|
rm -rf $${subdir}/.gitignore ; \
|
|
rm -rf $${subdir}/.DS_Store ; \
|
|
rm -rf $${subdir}/#* ; \
|
|
rm -rf $${subdir}/.#* ; \
|
|
rm -rf $${subdir}/*~ ; \
|
|
rm -rf $${subdir}/*.orig ; \
|
|
rm -rf $${subdir}/ChangeLog* ; \
|
|
rm -rf $${subdir}/[mM]akefile*[.-]in ; \
|
|
rm -rf $${subdir}/Makefile; \
|
|
done
|
|
# Generate the directory tree for those directories.
|
|
$(libsrc)/asset-directory-tool install_temp/assets \
|
|
install_temp/assets/directory-tree
|
|
# Install architecture dependents to lib/$(ANDROID_ABI). This
|
|
# perculiar naming scheme is required to make Android preserve these
|
|
# binaries upon installation.
|
|
for file in $(CROSS_BINS); do \
|
|
if [ -x $$file ]; then \
|
|
filename=`basename $$file`; \
|
|
cp -f $$file install_temp/lib/$(ANDROID_ABI)/lib$${filename}.so; \
|
|
fi \
|
|
done
|
|
for file in $(CROSS_LIBS); do \
|
|
if [ -x $$file ]; then \
|
|
cp -f $$file install_temp/lib/$(ANDROID_ABI); \
|
|
fi \
|
|
done
|
|
$(foreach module,$(NDK_BUILD_SHARED), \
|
|
cp -f $(module) install_temp/lib/$(ANDROID_ABI))
|
|
# Package everything. Specifying the assets on this command line is
|
|
# necessary for AAssetManager_getNextFileName to work on old versions
|
|
# of Android.
|
|
$(AAPT) package -I "$(ANDROID_JAR)" -F $@ -f \
|
|
-M AndroidManifest.xml -A install_temp/assets
|
|
pushd install_temp; $(AAPT) add ../$@ `find lib -type f`; popd
|
|
rm -rf install_temp
|
|
|
|
# Makefile itself.
|
|
.PRECIOUS: ../config.status Makefile
|
|
../config.status: $(top_srcdir)/configure.ac $(top_srcdir)/m4/*.m4
|
|
$(MAKE) -C $(dir $@) $(notdir $@)
|
|
Makefile: ../config.status $(top_builddir)/java/Makefile.in
|
|
$(MAKE) -C .. java/$@
|
|
|
|
# AndroidManifest.xml:
|
|
AndroidManifest.xml: $(top_srcdir)/configure.ac $(top_srcdir)/m4/*.m4 \
|
|
AndroidManifest.xml.in
|
|
pushd ..; ./config.status java/AndroidManifest.xml; popd
|
|
|
|
.SUFFIXES: .java .class
|
|
.java.class &:
|
|
$(AM_V_JAVAC) $(JAVAC) $(JAVAFLAGS) $<
|
|
|
|
# N.B. that find must be called all over again in case javac generated
|
|
# nested classes.
|
|
|
|
classes.dex: $(CLASS_FILES)
|
|
$(AM_V_D8) $(D8) --classpath $(ANDROID_JAR) \
|
|
$(subst $$,\$$,$(shell find . -type f -name *.class))
|
|
|
|
# When emacs.keystore expires, regenerate it with:
|
|
#
|
|
# keytool -genkey -v -keystore emacs.keystore -alias "Emacs keystore" \
|
|
# -keyalg RSA -sigalg SHA1withRSA -keysize 2048 -validity 100000
|
|
|
|
.PHONY: clean maintainer-clean
|
|
|
|
$(APK_NAME): classes.dex emacs.apk-in emacs.keystore
|
|
cp -f emacs.apk-in $@.unaligned
|
|
$(AAPT) add $@.unaligned classes.dex
|
|
$(JARSIGNER) $(SIGN_EMACS) $@.unaligned "Emacs keystore"
|
|
$(ZIPALIGN) -f 4 $@.unaligned $@
|
|
rm -f $@.unaligned
|
|
|
|
clean:
|
|
rm -f *.apk emacs.apk-in *.dex *.unaligned *.class
|
|
rm -rf install-temp
|
|
find . -name '*.class' -delete
|
|
|
|
maintainer-clean distclean bootstrap-clean: clean
|
|
rm -f Makefile ndk-build.mk
|