aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorPo Lu2023-03-02 18:31:35 +0800
committerPo Lu2023-03-02 18:31:35 +0800
commit960230d88d3c063ad51f91de076dd2b4a7b88ca1 (patch)
tree5a9c421aa3709a76e9351ba7c40ed0f52a2ab923 /java
parent951bdd021f51959649bf0bff9b16fde00c23f1a7 (diff)
downloademacs-960230d88d3c063ad51f91de076dd2b4a7b88ca1.tar.gz
emacs-960230d88d3c063ad51f91de076dd2b4a7b88ca1.zip
Summary: Update Android port
* INSTALL: Document where to find Android installation instructions. * configure.ac (CHECK_LISP_OBJECT_TYPE): Pacify -Wsuggest-attribute=noreturn only on Android. * cross/ndk-build/README: New file. * doc/emacs/android.texi (Android): * doc/emacs/emacs.texi (Top): * doc/emacs/input.texi (Other Input Devices): Untabify menus. * etc/NEWS: Move INSTALL.android to java/INSTALL. * java/INSTALL: New file. * java/README: * src/coding.c (from_unicode_buffer): Make Android specific code only build on Android.
Diffstat (limited to 'java')
-rw-r--r--java/INSTALL910
-rw-r--r--java/README3
2 files changed, 912 insertions, 1 deletions
diff --git a/java/INSTALL b/java/INSTALL
new file mode 100644
index 00000000000..bc5f4a70cd0
--- /dev/null
+++ b/java/INSTALL
@@ -0,0 +1,910 @@
1Installation instructions for Android
2Copyright (C) 2023 Free Software Foundation, Inc.
3See the end of the file for license conditions.
4
5Please read the entirety of this file before attempting to build Emacs
6as an application package which can run on Android devices.
7
8When building from the source repository, make sure to read
9INSTALL.REPO as well.
10
11
12
13Android is an unusual operating system in that program binaries cannot
14be produced on computers running Android themselves. Instead, they
15must be built on some other computer using a set of tools known as the
16``Android SDK'' (Software Development Kit) and the ``Android NDK''
17(Native Development Kit.) Appropriate versions of both must be
18obtained to build GNU Emacs; after being built, the generated binaries
19will work on almost all Android devices. This document does not
20elaborate on how both sets of tools can be obtained. However, for
21your freedom's sake, you should use the Android SDK provided by the
22Debian project.
23
24In addition to the Android SDK and Android NDK, Emacs also requires
25the Java compiler from OpenJDK 1.7.0 to be installed on your system.
26Building on GNU systems is all that is officially supported. We are
27told that Mac OS works too, and other Unix systems will likely work
28as well, but MS Windows and Cygwin will not.
29
30Once all of those tools are obtained, you may invoke the `configure'
31script like so:
32
33 ./configure --with-android=/path/to/android.jar \
34 ANDROID_CC=/path/to/android/ndk/cc \
35 SDK_BUILD_TOOLS=/path/to/sdk/build/tools
36
37Replacing the paths in the command line above with:
38
39 - the path to the `android.jar' headers which come with the Android
40 SDK. They must correspond to Android version 13 (API level 33) or
41 later.
42
43 - the path to the C compiler in the Android NDK, for the kind of CPU
44 you are building Emacs to run on.
45
46 - the path to the directory in the Android SDK containing binaries
47 such as `aapt', `apksigner', and `d8'. These are used to build
48 the application package.
49
50Where the type of CPU can either be `armeabi', `armv7*', `i686',
51`x86_64', `mips', or `mips64'.
52
53After the configuration process completes, you may run:
54
55 make all
56
57Once `make' finishes, there should be a file in the `java' directory
58named along the lines of:
59
60 emacs-<version>-<api-version>-<abi>.apk
61
62where <api-version> is the oldest version of Android that the package
63will run on, and <abi> is the type of Android machine the package was
64built for.
65
66The generated package can be uploaded onto an SD card (or similar
67medium) and installed on-device.
68
69
70BUILDING WITH OLD NDK VERSIONS
71
72Building Emacs with an old version of the Android NDK requires special
73setup. This is because there is no separate C compiler binary for
74each version of Android in those versions of the NDK.
75
76Before running `configure', you must identify three variables:
77
78 - What kind of Android system you are building Emacs for.
79
80 - The minimum API version of Android you want to build Emacs for.
81
82 - The locations of the system root and include files for that
83 version of Android in the NDK.
84
85That information must then be specified as arguments to the NDK C
86compiler. For example:
87
88 ./configure [...] \
89 ANDROID_CC="i686-linux-android-gcc \
90 --sysroot=/path/to/ndk/platforms/android-14/arch-x86/"
91 ANDROID_CFLAGS="-isystem /path/to/ndk/sysroot/usr/include \
92 -isystem /path/to/ndk/sysroot/usr/include/i686-linux-android \
93 -D__ANDROID_API__=14"
94
95Where __ANDROID_API__ and the version identifier in
96"platforms/android-14" defines the version of Android you are building
97for, and the include directories specify the paths to the relevant
98Android headers. In addition, it may be necessary to specify
99"-gdwarf-2", due to a bug in the Android NDK.
100
101Even older versions of the Android SDK do not require the extra
102`-isystem' directives.
103
104Emacs is known to run on Android 2.2 (API version 8) or later, with
105the NDK r10b or later. We wanted to make Emacs work on even older
106versions of Android, but they are missing the required JNI graphics
107library that allows Emacs to display text from C code.
108
109Due to an extremely nasty bug in the Android 2.2 system, the generated
110Emacs package cannot be compressed in builds for Android 2.2. As a
111result, the Emacs package will be approximately 100 megabytes larger
112than a compressed package for a newer version of Android.
113
114
115DEBUG AND RELEASE BUILDS
116
117Android makes a distinction between ``debug'' and ``release'' builds
118of applications. With ``release'' builds, the system will apply
119stronger optimizations to the application at the cost of being unable
120to debug them with the steps in etc/DEBUG.
121
122Emacs is built as a debuggable package by default, but:
123
124 ./configure --without-android-debug
125
126will create a release build of Emacs instead. This may be useful when
127running Emacs on resource constrained machines.
128
129If you are building an Emacs package for redistribution, we urge you
130to provide both debug and release versions.
131
132
133BUILDING WITH THIRD PARTY LIBRARIES
134
135The Android NDK does not support the usual ways of locating third
136party libraries, especially not via `pkg-config'. Instead, it uses
137its own system called `ndk-build'. The one exception to this rule is
138zlib, which is considered a part of the Android OS itself and is
139available on all devices running Android.
140
141Android also requires that each application include its own
142dependencies, as the system makes no guarantee about the existence of
143any particular library.
144
145Emacs is not built with the `ndk-build' system. Instead, it is built
146with Autoconf and Make.
147
148However, it supports building and including dependencies which use the
149similarly Make-based `ndk-build' system.
150
151To use dependencies built through `ndk-build', you must specify a list
152of directories within which Emacs will search for ``Android.mk''
153files, like so:
154
155 ./configure "--with-ndk-path=directory1 directory2"
156
157If `configure' complains about not being able to find
158``libc++_shared.so'', then you must locate that file in your copy of
159the NDK, and specify it like so:
160
161 ./configure --with-ndk-cxx-shared=/path/to/sysroot/libc++_shared.so
162
163Emacs will then read the ``Android.mk'' file in each directory, and
164automatically build and use those modules.
165
166When building for Intel systems, some ``ndk-build'' modules require
167the Netwide Assembler, usually installed under ``nasm'', to be present
168on the system that is building Emacs.
169
170Google, Inc. has adapted many common Emacs dependencies to use the
171`ndk-build' system. Here is a non-exhaustive list of what is known to
172work, along with what has to be patched to make them work:
173
174 libpng - https://android.googlesource.com/platform/external/libpng
175 libwebp - https://android.googlesource.com/platform/external/webp
176 (You must apply the patch at the end of this file for the resulting
177 binary to work on armv7 devices.)
178 giflib - https://android.googlesource.com/platform/external/giflib
179 (You must add LOCAL_EXPORT_CFLAGS := -I$(LOCAL_PATH) before
180 its Android.mk includes $(BUILD_STATIC_LIBRARY))
181 libjpeg-turbo - https://android.googlesource.com/platform/external/libjpeg-turbo
182 (You must add LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) before
183 its Android.mk includes $(BUILD_SHARED_LIBRARY))
184 libxml2 - https://android.googlesource.com/platform/external/libxml2/
185 (You must also place the dependency icu4c in ``--with-ndk-path'',
186 and apply the patch at the end of this file.)
187 icu4c - https://android.googlesource.com/platform/external/icu/
188 (You must apply the patch at the end of this file.)
189 sqlite3 - https://android.googlesource.com/platform/external/sqlite/
190 (You must apply the patch at the end of this file, and add the `dist'
191 directory to ``--with-ndk-path''.)
192 libselinux - https://android.googlesource.com/platform/external/libselinux
193 (You must apply the patches at the end of the file, and obtain
194 the following three dependencies.)
195 libpackagelistparser
196 https://android.googlesource.com/platform/system/core/+/refs/heads/nougat-mr1-dev/libpackagelistparser/
197 libpcre - https://android.googlesource.com/platform/external/pcre
198 libcrypto - https://android.googlesource.com/platform/external/boringssl
199 (You must apply the patch at the end of this file when building for
200 ARM systems.)
201
202Many of these dependencies have been migrated over to the
203``Android.bp'' build system now used to build Android itself.
204However, the old ``Android.mk'' Makefiles are still present in older
205branches, and can be easily adapte to newer versions.
206
207In addition, some Emacs dependencies provide `ndk-build' support
208themselves:
209
210 libjansson - https://github.com/akheron/jansson
211 (You must add LOCAL_EXPORT_INCLUDES := $(LOCAL_C_INCLUDES) before
212 its Android.mk includes $(BUILD_SHARED_LIBRARY), then copy
213 android/jansson_config.h to android/jansson_private_config.h.)
214
215Emacs developers have ported the following dependencies to ARM Android
216systems:
217
218 gnutls, gmp - https://sourceforge.net/projects/android-ports-for-gnu-emacs
219 (Please see the section GNUTLS near the end of this file.)
220 libtiff - https://sourceforge.net/projects/android-ports-for-gnu-emacs
221 (Extract and point ``--with-ndk-path'' to tiff-4.5.0-emacs.tar.gz.)
222 tree-sitter - https://sourceforge.net/projects/android-ports-for-gnu-emacs
223 (Please see the section TREE-SITTER near the end of this file.)
224
225And other developers have ported the following dependencies to Android
226systems:
227
228 ImageMagick, lcms2 - https://github.com/MolotovCherry/Android-ImageMagick7
229 (Please see the section IMAGEMAGICK near the end of this file.)
230
231We anticipate that most untested non-trivial ndk-build dependencies
232will need adjustments in Emacs to work, as the Emacs build system
233which emulates ndk-build is in an extremely early state.
234
235
236GNUTLS
237
238Modified copies of GnuTLS and its dependencies (such as libgmp,
239libtasn1, p11-kit) which can be built with the ndk-build system can be
240found at https://sourceforge.net/projects/android-ports-for-gnu-emacs.
241
242They have only been tested on arm64 Android systems running Android
2435.0 or later, and armv7l systems running Android 13 or later, so your
244mileage may vary, especially if you are trying to build Emacs for
245another kind of machine.
246
247To build Emacs with GnuTLS, you must unpack each of the following tar
248archives in that site:
249
250 gmp-6.2.1-emacs.tgz
251 gnutls-3.7.8-emacs.tar.gz
252 libtasn1-4.19.0-emacs.tar.gz
253 p11-kit-0.24.1-emacs.tar.gz
254 nettle-3.8-emacs.tar.gz
255
256and add the resulting folders to ``--with-ndk-path''. Note that you
257should not try to build these packages separately using any
258`configure' script or Makefiles inside.
259
260
261TREE-SITTER
262
263A copy of tree-sitter modified to build with the ndk-build system can
264also find that URL. To build Emacs with tree-sitter, you must unpack
265the following tar archive in that site:
266
267 tree-sitter-0.20.7-emacs.tar.gz
268
269and add the resulting folder to ``--with-ndk-build''.
270
271
272IMAGEMAGICK
273
274There is a third party port of ImageMagick to Android. Unfortunately,
275the port also uses its own patched versions of libpng, libjpeg,
276libtiff and libwebp, which conflict with those used by Emacs. Its
277Makefiles were also written for MS Windows, so you must also apply the
278patch at the end of this file.
279
280
281
282PATCH FOR LIBXML2
283
284This patch must be applied to the Android.mk in Google's version of
285libxml2 before it can be built for Emacs. In addition, you must also
286revert the commit `edb5870767fed8712a9b77ef34097209b61ab2db'.
287
288diff --git a/Android.mk b/Android.mk
289index 07c7b372..24f67e49 100644
290--- a/Android.mk
291+++ b/Android.mk
292@@ -80,6 +80,7 @@ LOCAL_SHARED_LIBRARIES := libicuuc
293 LOCAL_MODULE:= libxml2
294 LOCAL_CLANG := true
295 LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
296+LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH)
297 include $(BUILD_SHARED_LIBRARY)
298
299 # For the host
300@@ -94,3 +95,5 @@ LOCAL_MODULE := libxml2
301 LOCAL_CLANG := true
302 LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
303 include $(BUILD_HOST_STATIC_LIBRARY)
304+
305+$(call import-module,libicuuc)
306
307PATCH FOR ICU
308
309This patch must be applied to icu4j/Android.mk in Google's version of
310icu before it can be built for Emacs.
311
312diff --git a/icu4j/Android.mk b/icu4j/Android.mk
313index d1ab3d5..69eff81 100644
314--- a/icu4j/Android.mk
315+++ b/icu4j/Android.mk
316@@ -69,7 +69,7 @@ include $(BUILD_STATIC_JAVA_LIBRARY)
317 # Path to the ICU4C data files in the Android device file system:
318 icu4c_data := /system/usr/icu
319 icu4j_config_root := $(LOCAL_PATH)/main/classes/core/src
320-include external/icu/icu4j/adjust_icudt_path.mk
321+include $(LOCAL_PATH)/adjust_icudt_path.mk
322
323 include $(CLEAR_VARS)
324 LOCAL_SRC_FILES := $(icu4j_src_files)
325
326diff --git a/icu4c/source/common/Android.mk b/icu4c/source/common/Android.mk
327index 8e5f757..44bb130 100644
328--- a/icu4c/source/common/Android.mk
329+++ b/icu4c/source/common/Android.mk
330@@ -231,7 +231,7 @@ include $(CLEAR_VARS)
331 LOCAL_SRC_FILES += $(src_files)
332 LOCAL_C_INCLUDES += $(c_includes) $(optional_android_logging_includes)
333 LOCAL_CFLAGS += $(local_cflags) -DPIC -fPIC
334-LOCAL_SHARED_LIBRARIES += libdl $(optional_android_logging_libraries)
335+LOCAL_SHARED_LIBRARIES += libdl libstdc++ $(optional_android_logging_libraries)
336 LOCAL_MODULE_TAGS := optional
337 LOCAL_MODULE := libicuuc
338 LOCAL_RTTI_FLAG := -frtti
339
340PATCH FOR SQLITE3
341
342diff --git a/dist/Android.mk b/dist/Android.mk
343index bf277d2..36734d9 100644
344--- a/dist/Android.mk
345+++ b/dist/Android.mk
346@@ -141,6 +141,7 @@ include $(BUILD_HOST_EXECUTABLE)
347 include $(CLEAR_VARS)
348 LOCAL_SRC_FILES := $(common_src_files)
349 LOCAL_CFLAGS += $(minimal_sqlite_flags)
350+LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH)
351 LOCAL_MODULE:= libsqlite_static_minimal
352 LOCAL_SDK_VERSION := 23
353 include $(BUILD_STATIC_LIBRARY)
354
355diff --git a/dist/sqlite3.c b/dist/sqlite3.c
356index b0536a4..8fa1ee9 100644
357--- a/dist/sqlite3.c
358+++ b/dist/sqlite3.c
359@@ -26474,7 +26474,7 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
360 */
361 #if !defined(HAVE_POSIX_FALLOCATE) \
362 && (_XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L)
363-# define HAVE_POSIX_FALLOCATE 1
364+/* # define HAVE_POSIX_FALLOCATE 1 */
365 #endif
366
367 /*
368
369PATCH FOR WEBP
370
371diff --git a/Android.mk b/Android.mk
372index c7bcb0f5..d4da1704 100644
373--- a/Android.mk
374+++ b/Android.mk
375@@ -28,9 +28,10 @@ ifneq ($(findstring armeabi-v7a, $(TARGET_ARCH_ABI)),)
376 # Setting LOCAL_ARM_NEON will enable -mfpu=neon which may cause illegal
377 # instructions to be generated for armv7a code. Instead target the neon code
378 # specifically.
379- NEON := c.neon
380- USE_CPUFEATURES := yes
381- WEBP_CFLAGS += -DHAVE_CPU_FEATURES_H
382+ # NEON := c.neon
383+ # USE_CPUFEATURES := yes
384+ # WEBP_CFLAGS += -DHAVE_CPU_FEATURES_H
385+ NEON := c
386 else
387 NEON := c
388 endif
389
390PATCHES FOR SELINUX
391
392diff --git a/Android.mk b/Android.mk
393index 659232e..1e64fd6 100644
394--- a/Android.mk
395+++ b/Android.mk
396@@ -116,3 +116,7 @@ LOCAL_STATIC_LIBRARIES := libselinux
397 LOCAL_WHOLE_STATIC_LIBRARIES := libpcre
398 LOCAL_C_INCLUDES := external/pcre
399 include $(BUILD_HOST_EXECUTABLE)
400+
401+$(call import-module,libpcre)
402+$(call import-module,libpackagelistparser)
403+$(call import-module,libcrypto)
404
405diff --git a/src/android.c b/src/android.c
406index 5206a9f..b351ffc 100644
407--- a/src/android.c
408+++ b/src/android.c
409@@ -21,8 +21,7 @@
410 #include <selinux/label.h>
411 #include <selinux/avc.h>
412 #include <openssl/sha.h>
413-#include <private/android_filesystem_config.h>
414-#include <log/log.h>
415+#include <android/log.h>
416 #include "policy.h"
417 #include "callbacks.h"
418 #include "selinux_internal.h"
419@@ -686,6 +685,7 @@ static int seapp_context_lookup(enum seapp_kind kind,
420 seinfo = parsedseinfo;
421 }
422
423+#if 0
424 userid = uid / AID_USER;
425 isOwner = (userid == 0);
426 appid = uid % AID_USER;
427@@ -702,9 +702,13 @@ static int seapp_context_lookup(enum seapp_kind kind,
428 username = "_app";
429 appid -= AID_APP;
430 } else {
431+#endif
432 username = "_isolated";
433+ appid = 0;
434+#if 0
435 appid -= AID_ISOLATED_START;
436 }
437+#endif
438
439 if (appid >= CAT_MAPPING_MAX_ID || userid >= CAT_MAPPING_MAX_ID)
440 goto err;
441@@ -1662,8 +1666,10 @@ int selinux_log_callback(int type, const char *fmt, ...)
442
443 va_start(ap, fmt);
444 if (vasprintf(&strp, fmt, ap) != -1) {
445+#if 0
446 LOG_PRI(priority, "SELinux", "%s", strp);
447 LOG_EVENT_STRING(AUDITD_LOG_TAG, strp);
448+#endif
449 free(strp);
450 }
451 va_end(ap);
452
453PATCH FOR BORINGSSL
454
455diff --git a/Android.mk b/Android.mk
456index 3e3ef2a..277d4a9 100644
457--- a/Android.mk
458+++ b/Android.mk
459@@ -27,7 +27,9 @@ LOCAL_MODULE := libcrypto
460 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/src/include
461 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/crypto-sources.mk
462 LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -DOPENSSL_SMALL -Wno-unused-parameter
463+LOCAL_CFLAGS_arm = -DOPENSSL_STATIC_ARMCAP -DOPENSSL_NO_ASM
464 LOCAL_SDK_VERSION := 9
465+LOCAL_LDFLAGS = --no-undefined
466 # sha256-armv4.S does not compile with clang.
467 LOCAL_CLANG_ASFLAGS_arm += -no-integrated-as
468 LOCAL_CLANG_ASFLAGS_arm64 += -march=armv8-a+crypto
469diff --git a/sources.mk b/sources.mk
470index e82f3d5..be3a3c4 100644
471--- a/sources.mk
472+++ b/sources.mk
473@@ -337,20 +337,20 @@ linux_aarch64_sources := \
474 linux-aarch64/crypto/sha/sha256-armv8.S\
475 linux-aarch64/crypto/sha/sha512-armv8.S\
476
477-linux_arm_sources := \
478- linux-arm/crypto/aes/aes-armv4.S\
479- linux-arm/crypto/aes/aesv8-armx32.S\
480- linux-arm/crypto/aes/bsaes-armv7.S\
481- linux-arm/crypto/bn/armv4-mont.S\
482- linux-arm/crypto/modes/ghash-armv4.S\
483- linux-arm/crypto/modes/ghashv8-armx32.S\
484- linux-arm/crypto/sha/sha1-armv4-large.S\
485- linux-arm/crypto/sha/sha256-armv4.S\
486- linux-arm/crypto/sha/sha512-armv4.S\
487- src/crypto/chacha/chacha_vec_arm.S\
488- src/crypto/cpu-arm-asm.S\
489- src/crypto/curve25519/asm/x25519-asm-arm.S\
490- src/crypto/poly1305/poly1305_arm_asm.S\
491+# linux_arm_sources := \
492+# linux-arm/crypto/aes/aes-armv4.S\
493+# linux-arm/crypto/aes/aesv8-armx32.S\
494+# linux-arm/crypto/aes/bsaes-armv7.S\
495+# linux-arm/crypto/bn/armv4-mont.S\
496+# linux-arm/crypto/modes/ghash-armv4.S\
497+# linux-arm/crypto/modes/ghashv8-armx32.S\
498+# linux-arm/crypto/sha/sha1-armv4-large.S\
499+# linux-arm/crypto/sha/sha256-armv4.S\
500+# linux-arm/crypto/sha/sha512-armv4.S\
501+# src/crypto/chacha/chacha_vec_arm.S\
502+# src/crypto/cpu-arm-asm.S\
503+# src/crypto/curve25519/asm/x25519-asm-arm.S\
504+# src/crypto/poly1305/poly1305_arm_asm.S\
505
506 linux_x86_sources := \
507 linux-x86/crypto/aes/aes-586.S\
508
509PATCH FOR IMAGEMAGICK
510
511diff --git a/Android.mk b/Android.mk
512index 5ab6699..4441417 100644
513--- a/Android.mk
514+++ b/Android.mk
515@@ -52,6 +52,20 @@ LZMA_LIB_PATH := $(LOCAL_PATH)/xz-5.2.4
516 BZLIB_LIB_PATH := $(LOCAL_PATH)/bzip-1.0.8
517 LCMS_LIB_PATH := $(LOCAL_PATH)/liblcms2-2.9
518
519+LIBBZ2_ENABLED := true
520+LIBFFTW_ENABLED := true
521+LIBFREETYPE2_ENABLED := true
522+LIBJPEG_TURBO_ENABLED := true
523+LIBLZMA_ENABLED := true
524+LIBOPENJPEG_ENABLED := true
525+LIBPNG_ENABLED := true
526+LIBTIFF_ENABLED := true
527+LIBWEBP_ENABLED := true
528+LIBXML2_ENABLED := true
529+LIBZLIB_ENABLED := true
530+LIBLCMS2_ENABLED := true
531+BUILD_MAGICKWAND := true
532+
533 #-------------------------------------------------------------
534 # Include all modules
535 #-------------------------------------------------------------
536@@ -68,6 +82,9 @@ include $(MAKE_PATH)/libjpeg-turbo.mk
537 # libopenjpeg
538 include $(MAKE_PATH)/libopenjpeg.mk
539
540+# libwebp
541+include $(MAKE_PATH)/libwebp.mk
542+
543 # libtiff
544 include $(MAKE_PATH)/libtiff.mk
545
546@@ -77,9 +94,6 @@ include $(MAKE_PATH)/libpng.mk
547 # libfreetype2
548 include $(MAKE_PATH)/libfreetype2.mk
549
550-# libwebp
551-include $(MAKE_PATH)/libwebp.mk
552-
553 # libfftw
554 include $(MAKE_PATH)/libfftw.mk
555
556diff --git a/libjpeg-turbo-2.0.2/jconfig.h b/libjpeg-turbo-2.0.2/jconfig.h
557index 47d14c9..5c6f8ee 100644
558--- a/libjpeg-turbo-2.0.2/jconfig.h
559+++ b/libjpeg-turbo-2.0.2/jconfig.h
560@@ -1,57 +1,43 @@
561-/* autogenerated jconfig.h based on Android.mk var JCONFIG_FLAGS */
562+/* autogenerated jconfig.h based on Android.mk var JCONFIG_FLAGS */
563 #ifndef JPEG_LIB_VERSION
564 #define JPEG_LIB_VERSION 62
565 #endif
566-
567 #ifndef LIBJPEG_TURBO_VERSION
568 #define LIBJPEG_TURBO_VERSION 2.0.2
569 #endif
570-
571 #ifndef LIBJPEG_TURBO_VERSION_NUMBER
572 #define LIBJPEG_TURBO_VERSION_NUMBER 202
573 #endif
574-
575 #ifndef C_ARITH_CODING_SUPPORTED
576 #define C_ARITH_CODING_SUPPORTED
577 #endif
578-
579 #ifndef D_ARITH_CODING_SUPPORTED
580 #define D_ARITH_CODING_SUPPORTED
581 #endif
582-
583 #ifndef MEM_SRCDST_SUPPORTED
584 #define MEM_SRCDST_SUPPORTED
585 #endif
586-
587 #ifndef WITH_SIMD
588 #define WITH_SIMD
589 #endif
590-
591 #ifndef BITS_IN_JSAMPLE
592 #define BITS_IN_JSAMPLE 8
593 #endif
594-
595 #ifndef HAVE_LOCALE_H
596 #define HAVE_LOCALE_H
597 #endif
598-
599 #ifndef HAVE_STDDEF_H
600 #define HAVE_STDDEF_H
601 #endif
602-
603 #ifndef HAVE_STDLIB_H
604 #define HAVE_STDLIB_H
605 #endif
606-
607 #ifndef NEED_SYS_TYPES_H
608 #define NEED_SYS_TYPES_H
609 #endif
610-
611 #ifndef HAVE_UNSIGNED_CHAR
612 #define HAVE_UNSIGNED_CHAR
613 #endif
614-
615 #ifndef HAVE_UNSIGNED_SHORT
616 #define HAVE_UNSIGNED_SHORT
617 #endif
618-
619diff --git a/libxml2-2.9.9/encoding.c b/libxml2-2.9.9/encoding.c
620index a3aaf10..60f165b 100644
621--- a/libxml2-2.9.9/encoding.c
622+++ b/libxml2-2.9.9/encoding.c
623@@ -2394,7 +2394,6 @@ xmlCharEncOutput(xmlOutputBufferPtr output, int init)
624 {
625 int ret;
626 size_t written;
627- size_t writtentot = 0;
628 size_t toconv;
629 int c_in;
630 int c_out;
631@@ -2451,7 +2450,6 @@ retry:
632 xmlBufContent(in), &c_in);
633 xmlBufShrink(in, c_in);
634 xmlBufAddLen(out, c_out);
635- writtentot += c_out;
636 if (ret == -1) {
637 if (c_out > 0) {
638 /* Can be a limitation of iconv or uconv */
639@@ -2536,7 +2534,6 @@ retry:
640 }
641
642 xmlBufAddLen(out, c_out);
643- writtentot += c_out;
644 goto retry;
645 }
646 }
647@@ -2567,9 +2564,7 @@ xmlCharEncOutFunc(xmlCharEncodingHandler *handler, xmlBufferPtr out,
648 xmlBufferPtr in) {
649 int ret;
650 int written;
651- int writtentot = 0;
652 int toconv;
653- int output = 0;
654
655 if (handler == NULL) return(-1);
656 if (out == NULL) return(-1);
657@@ -2612,7 +2607,6 @@ retry:
658 in->content, &toconv);
659 xmlBufferShrink(in, toconv);
660 out->use += written;
661- writtentot += written;
662 out->content[out->use] = 0;
663 if (ret == -1) {
664 if (written > 0) {
665@@ -2622,8 +2616,6 @@ retry:
666 ret = -3;
667 }
668
669- if (ret >= 0) output += ret;
670-
671 /*
672 * Attempt to handle error cases
673 */
674@@ -2700,7 +2692,6 @@ retry:
675 }
676
677 out->use += written;
678- writtentot += written;
679 out->content[out->use] = 0;
680 goto retry;
681 }
682diff --git a/libxml2-2.9.9/xpath.c b/libxml2-2.9.9/xpath.c
683index 5e3bb9f..505ec82 100644
684--- a/libxml2-2.9.9/xpath.c
685+++ b/libxml2-2.9.9/xpath.c
686@@ -10547,7 +10547,7 @@ xmlXPathCompFilterExpr(xmlXPathParserContextPtr ctxt) {
687
688 static xmlChar *
689 xmlXPathScanName(xmlXPathParserContextPtr ctxt) {
690- int len = 0, l;
691+ int l;
692 int c;
693 const xmlChar *cur;
694 xmlChar *ret;
695@@ -10567,7 +10567,6 @@ xmlXPathScanName(xmlXPathParserContextPtr ctxt) {
696 (c == '_') || (c == ':') ||
697 (IS_COMBINING(c)) ||
698 (IS_EXTENDER(c)))) {
699- len += l;
700 NEXTL(l);
701 c = CUR_CHAR(l);
702 }
703diff --git a/make/libicu4c.mk b/make/libicu4c.mk
704index 21ec121..8b77865 100644
705--- a/make/libicu4c.mk
706+++ b/make/libicu4c.mk
707@@ -250,7 +250,7 @@ LOCAL_MODULE := libicuuc
708 LOCAL_SRC_FILES := $(src_files)
709
710 # when built in android, they require uconfig_local (because of android project), but we don't need this
711-$(shell > $(ICU_COMMON_PATH)/unicode/uconfig_local.h echo /* Autogenerated stub file to make libicuuc build happy */) \
712+$(shell > $(ICU_COMMON_PATH)/unicode/uconfig_local.h echo /\* Autogenerated stub file to make libicuuc build happy \*/) \
713
714 ifeq ($(LIBXML2_ENABLED),true)
715 include $(BUILD_STATIC_LIBRARY)
716diff --git a/make/libjpeg-turbo.mk b/make/libjpeg-turbo.mk
717index d39dd41..fdebcf3 100644
718--- a/make/libjpeg-turbo.mk
719+++ b/make/libjpeg-turbo.mk
720@@ -230,30 +230,30 @@ JCONFIG_FLAGS += \
721 HAVE_UNSIGNED_SHORT
722
723 JCONFIGINT_FLAGS += \
724- BUILD="20190814" \
725- PACKAGE_NAME="libjpeg-turbo" \
726- VERSION="2.0.2"
727+ BUILD=\"20190814\" \
728+ PACKAGE_NAME=\"libjpeg-turbo\" \
729+ VERSION=\"2.0.2\"
730
731 # originally defined in jconfigint.h, but the substitution has problems with spaces
732 LOCAL_CFLAGS := \
733 -DINLINE="inline __attribute__((always_inline))"
734
735 # create definition file jconfig.h, needed in order to build
736-$(shell echo /* autogenerated jconfig.h based on Android.mk var JCONFIG_FLAGS */ > $(JPEG_LIB_PATH)/jconfig.h)
737+$(shell echo \/\* autogenerated jconfig.h based on Android.mk var JCONFIG_FLAGS \*\/ > $(JPEG_LIB_PATH)/jconfig.h)
738 $(foreach name,$(JCONFIG_FLAGS), \
739 $(if $(findstring =,$(name)), \
740- $(shell >>$(JPEG_LIB_PATH)/jconfig.h echo #ifndef $(firstword $(subst =, ,$(name)))) \
741+ $(shell >>$(JPEG_LIB_PATH)/jconfig.h echo \#ifndef $(firstword $(subst =, ,$(name)))) \
742 , \
743- $(shell >>$(JPEG_LIB_PATH)/jconfig.h echo #ifndef $(name)) \
744+ $(shell >>$(JPEG_LIB_PATH)/jconfig.h echo \#ifndef $(name)) \
745 ) \
746- $(shell >>$(JPEG_LIB_PATH)/jconfig.h echo #define $(subst =, ,$(name))) \
747- $(shell >>$(JPEG_LIB_PATH)/jconfig.h echo #endif) \
748+ $(shell >>$(JPEG_LIB_PATH)/jconfig.h echo \#define $(subst =, ,$(name))) \
749+ $(shell >>$(JPEG_LIB_PATH)/jconfig.h echo \#endif) \
750 $(shell >> $(JPEG_LIB_PATH)/jconfig.h echo.) \
751 )
752
753 # create definition file jconfigint.h, needed in order to build
754-$(shell >$(JPEG_LIB_PATH)/jconfigint.h echo /* autogenerated jconfigint.h based on Android.mk vars JCONFIGINT_FLAGS */)
755-$(foreach name,$(JCONFIGINT_FLAGS),$(shell >>$(JPEG_LIB_PATH)/jconfigint.h echo #define $(subst =, ,$(name))))
756+$(shell >$(JPEG_LIB_PATH)/jconfigint.h echo /\* autogenerated jconfigint.h based on Android.mk vars JCONFIGINT_FLAGS \*/)
757+$(foreach name,$(JCONFIGINT_FLAGS),$(shell >>$(JPEG_LIB_PATH)/jconfigint.h echo \#define $(subst =, ,$(name))))
758
759 ifeq ($(LIBJPEG_TURBO_ENABLED),true)
760 include $(BUILD_STATIC_LIBRARY)
761diff --git a/make/liblcms2.mk b/make/liblcms2.mk
762index e1fd3b9..29ca791 100644
763--- a/make/liblcms2.mk
764+++ b/make/liblcms2.mk
765@@ -10,6 +10,10 @@ LOCAL_C_INCLUDES := \
766 $(LCMS_LIB_PATH)/include \
767 $(LCMS_LIB_PATH)/src
768
769+LOCAL_EXPORT_C_INCLUDES := \
770+ $(LCMS_LIB_PATH) \
771+ $(LCMS_LIB_PATH)/include \
772+ $(LCMS_LIB_PATH)/src
773
774 LOCAL_CFLAGS := \
775 -DHAVE_FUNC_ATTRIBUTE_VISIBILITY=1 \
776diff --git a/make/libmagick++-7.mk b/make/libmagick++-7.mk
777index 5352ccb..929396d 100644
778--- a/make/libmagick++-7.mk
779+++ b/make/libmagick++-7.mk
780@@ -12,7 +12,7 @@ LOCAL_C_INCLUDES := \
781
782 ifneq ($(STATIC_BUILD),true)
783 LOCAL_LDFLAGS += -fexceptions
784- LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -lz
785+ LOCAL_LDLIBS := -llog -lz
786 endif
787
788 LOCAL_SRC_FILES := \
789diff --git a/make/libmagickcore-7.mk b/make/libmagickcore-7.mk
790index 81293b2..d51fced 100644
791--- a/make/libmagickcore-7.mk
792+++ b/make/libmagickcore-7.mk
793@@ -25,6 +25,7 @@ else ifeq ($(TARGET_ARCH_ABI),x86_64)
794
795 endif
796
797+LOCAL_EXPORT_C_INCLUDES += $(IMAGE_MAGICK)
798
799 LOCAL_C_INCLUDES += \
800 $(IMAGE_MAGICK) \
801@@ -45,10 +46,9 @@ LOCAL_C_INCLUDES += \
802 $(BZLIB_LIB_PATH) \
803 $(LCMS_LIB_PATH)/include
804
805-
806 ifneq ($(STATIC_BUILD),true)
807 # ignored in static library builds
808- LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -lz
809+ LOCAL_LDLIBS := -llog -lz
810 endif
811
812
813diff --git a/make/libmagickwand-7.mk b/make/libmagickwand-7.mk
814index 7be2fb6..0bbcca5 100644
815--- a/make/libmagickwand-7.mk
816+++ b/make/libmagickwand-7.mk
817@@ -14,7 +14,7 @@ LOCAL_C_INCLUDES := \
818
819 # always ignored in static builds
820 ifneq ($(STATIC_BUILD),true)
821- LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -lz
822+ LOCAL_LDLIBS := -llog -lz
823 endif
824
825 LOCAL_SRC_FILES := \
826@@ -54,6 +54,29 @@ ifeq ($(OPENCL_BUILD),true)
827 LOCAL_SHARED_LIBRARIES += libopencl
828 endif
829
830+LOCAL_SHARED_LIBRARIES += libstdc++
831+
832+ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
833+ LOCAL_EXPORT_C_INCLUDES += $(IMAGE_MAGICK)/configs/arm64
834+ LOCAL_C_INCLUDES += $(IMAGE_MAGICK)/configs/arm64
835+else ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
836+ LOCAL_EXPORT_C_INCLUDES += $(IMAGE_MAGICK)/configs/arm
837+ LOCAL_C_INCLUDES += $(IMAGE_MAGICK)/configs/arm
838+else ifeq ($(TARGET_ARCH_ABI),x86)
839+ LOCAL_EXPORT_C_INCLUDES += $(IMAGE_MAGICK)/configs/x86
840+ LOCAL_C_INCLUDES += $(IMAGE_MAGICK)/configs/x86
841+else ifeq ($(TARGET_ARCH_ABI),x86_64)
842+ LOCAL_EXPORT_C_INCLUDES += $(IMAGE_MAGICK)/configs/x86-64
843+ LOCAL_C_INCLUDES += $(IMAGE_MAGICK)/configs/x86-64
844+
845+ ifneq ($(STATIC_BUILD),true)
846+ LOCAL_LDFLAGS += -latomic
847+ endif
848+
849+endif
850+
851+LOCAL_EXPORT_C_INCLUDES += $(IMAGE_MAGICK)
852+
853 ifeq ($(BUILD_MAGICKWAND),true)
854 ifeq ($(STATIC_BUILD),true)
855 LOCAL_STATIC_LIBRARIES := \
856diff --git a/make/libpng.mk b/make/libpng.mk
857index 24fb8ac..dda05fd 100644
858--- a/make/libpng.mk
859+++ b/make/libpng.mk
860@@ -30,6 +30,7 @@ ifeq ($(TARGET_ARCH_ABI), arm64-v8a)
861 endif # TARGET_ARCH_ABI == arm64-v8a
862
863
864+LOCAL_EXPORT_C_INCLUDES := $(PNG_LIB_PATH)
865 LOCAL_C_INCLUDES := $(PNG_LIB_PATH)
866
867 LOCAL_SRC_FILES += \
868diff --git a/make/libtiff.mk b/make/libtiff.mk
869index ca43f25..2b17508 100644
870--- a/make/libtiff.mk
871+++ b/make/libtiff.mk
872@@ -12,6 +12,9 @@ LOCAL_C_INCLUDES := \
873 $(LZMA_LIB_PATH)/liblzma/api \
874 $(WEBP_LIB_PATH)/src
875
876+LOCAL_EXPORT_C_INCLUDES := \
877+ $(TIFF_LIB_PATH)
878+
879 ifeq ($(LIBLZMA_ENABLED),true)
880 LOCAL_CFLAGS += -DLZMA_SUPPORT=1
881 endif
882diff --git a/make/magick.mk b/make/magick.mk
883index 3ba4b1d..5471608 100644
884--- a/make/magick.mk
885+++ b/make/magick.mk
886@@ -18,7 +18,7 @@ LOCAL_C_INCLUDES := \
887 $(FREETYPE_LIB_PATH)/include
888
889
890-LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -lz
891+LOCAL_LDLIBS := -llog -lz
892 LOCAL_SRC_FILES := \
893 $(IMAGE_MAGICK)/utilities/magick.c \
894
895
896
897This file is part of GNU Emacs.
898
899GNU Emacs is free software: you can redistribute it and/or modify
900it under the terms of the GNU General Public License as published by
901the Free Software Foundation, either version 3 of the License, or
902(at your option) any later version.
903
904GNU Emacs is distributed in the hope that it will be useful,
905but WITHOUT ANY WARRANTY; without even the implied warranty of
906MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
907GNU General Public License for more details.
908
909You should have received a copy of the GNU General Public License
910along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
diff --git a/java/README b/java/README
index fd4aa770f4b..9b6554481f6 100644
--- a/java/README
+++ b/java/README
@@ -1,6 +1,7 @@
1This directory holds the Java sources of the port of GNU Emacs to 1This directory holds the Java sources of the port of GNU Emacs to
2Android-like systems, along with files needed to create an application 2Android-like systems, along with files needed to create an application
3package out of them. 3package out of them. If you need to build this port, please read the
4document ``INSTALL.android''.
4 5
5The ``org/gnu/emacs'' subdirectory contains the Java sources under the 6The ``org/gnu/emacs'' subdirectory contains the Java sources under the
6``org.gnu.emacs'' package identifier. 7``org.gnu.emacs'' package identifier.