1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-02 13:41:30 -08:00
emacs/java/Makefile.in
Po Lu 2b87ab7b27 Update Android port
* java/Makefile.in (clean): Fix distclean and bootstrap-clean rules.
* java/debug.sh (jdb_port):
(attach_existing):
(num_pids):
(line): Add new options to upload a gdbserver binary to the device.

* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity): Make
focusedActivities public.
* java/org/gnu/emacs/EmacsContextMenu.java (EmacsContextMenu):
New class.
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform): Fix
bounds computation.
* java/org/gnu/emacs/EmacsGC.java (markDirty): Set stroke width
explicitly.
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(getLocationOnScreen, nameKeysym): New functions.
* java/org/gnu/emacs/EmacsView.java (EmacsView): Disable focus
highlight.
(onCreateContextMenu, popupMenu, cancelPopupMenu): New
functions.
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow): Implement a
kind of ``override redirect'' window for tooltips.
* src/android.c (struct android_emacs_service): New method
`name_keysym'.
(android_run_select_thread, android_init_events):
(android_select): Release select thread on semaphores instead of
signals to avoid one nasty race on SIGUSR2 delivery.
(android_init_emacs_service): Initialize new method.
(android_create_window): Handle CW_OVERRIDE_REDIRECT.
(android_move_resize_window, android_map_raised)
(android_translate_coordinates, android_get_keysym_name)
(android_build_string, android_exception_check): New functions.
* src/android.h: Update prototypes.

* src/androidfns.c (android_set_parent_frame, Fx_create_frame)
(unwind_create_tip_frame, android_create_tip_frame)
(android_hide_tip, compute_tip_xy, Fx_show_tip, Fx_hide_tip)
(syms_of_androidfns): Implement tooltips and iconification
reporting.

* src/androidgui.h (enum android_window_value_mask): Add
CWOverrideRedirect.
(struct android_set_window_attributes): Add `override_redirect'.
(ANDROID_IS_MODIFIER_KEY): Recognize Caps Lock.

* src/androidmenu.c (struct android_emacs_context_menu): New
struct.
(android_init_emacs_context_menu, android_unwind_local_frame)
(android_push_local_frame, android_menu_show, init_androidmenu):
New functions.

* src/androidterm.c (handle_one_android_event): Fix NULL pointer
dereference.
(android_fullscreen_hook): Handle fullscreen correctly.
(android_draw_box_rect): Fix top line.
(get_keysym_name): Implement function.
(android_create_terminal): Remove scroll bar stubs and add menu
hook.

* src/androidterm.h: Update prototypes.
* src/emacs.c (android_emacs_init): Initialize androidmenu.c.
* xcompile/Makefile.in: Fix clean rules.
2023-01-14 22:12:16 +08:00

171 lines
5.5 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@
-include ${top_builddir}/src/verbose.mk
SHELL = @SHELL@
JAVAC = @JAVAC@
AAPT = @AAPT@
D8 = @D8@
ZIPALIGN = @ZIPALIGN@
JARSIGNER = @JARSIGNER@
ANDROID_JAR = @ANDROID_JAR@
ANDROID_ABI = @ANDROID_ABI@
WARN_JAVAFLAGS = -Xlint:deprecation
JAVAFLAGS = -classpath "$(ANDROID_JAR):." -target 1.7 -source 1.7 \
$(WARN_JAVAFLAGS)
SIGN_EMACS = -keystore emacs.keystore -storepass emacs1
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 = ../xcompile/src/android-emacs ../xcompile/lib-src/ctags \
../xcompile/lib-src/hexl ../xcompile/lib-src/movemail \
../xcompile/lib-src/ebrowse ../xcompile/lib-src/emacsclient
# Libraries to cross-compile.
CROSS_LIBS = ../xcompile/src/libemacs.so
.PHONY: $(CROSS_BINS) $(CROSS_LIBS)
../xcompile/src/android-emacs ../xcompile/src/libemacs.so:
make -C ../xcompile src/$(notdir $@)
../xcompile/lib-src/hexl ../xcompile/lib-src/movemail \
../xcompile/lib-src/ctags ../xcompile/lib-src/ebrowse &:
make -C ../xcompile lib-src/$(notdir $@)
emacs.apk-in: $(CROSS_BINS) $(CROSS_LIBS) AndroidManifest.xml
# 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
# 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
# Package everything.
$(AAPT) package -I "$(ANDROID_JAR)" -F $@ -f -M AndroidManifest.xml
pushd install_temp; $(AAPT) add ../$@ `find lib -type f`; popd
pushd install_temp; $(AAPT) add ../$@ `find assets -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