aboutsummaryrefslogtreecommitdiffstats
path: root/java/org
diff options
context:
space:
mode:
authorPo Lu2024-04-22 16:27:30 +0800
committerPo Lu2024-04-22 16:30:15 +0800
commit3bcdf010a9f2576bac0d7f23af70fa9dff81ef95 (patch)
tree600a98286f5469579cf87dac7c920590b5af4082 /java/org
parent4d9629b087fe6df941b553c6931b2f8996901e21 (diff)
downloademacs-3bcdf010a9f2576bac0d7f23af70fa9dff81ef95.tar.gz
emacs-3bcdf010a9f2576bac0d7f23af70fa9dff81ef95.zip
Generate Android shared library list automatically
* .gitignore: Ignore new generated files. * cross/Makefile.in (src/Makefile): Remove leftover specification of the source Gnulib directory. * cross/ndk-build/ndk-build.mk.in (NDK_BUILD_READELF): New variable. * java/Makefile.in (CONFIG_FILE, ALL_DEPENDENCIES, READELF) (cf-stamp-1, cf-stamp): New variables and rules; compute the set of library files in the order of loading and generate a file with this information. (ALL_CLASS_FILES): New variable; if builddir is not srcdir, $($(CONFIG_FILE), $(CLASS_FILES)): Depend on EmacsConfig.java. add generated files in the build directory. (classes.dex): Adjust to match. * java/org/gnu/emacs/EmacsNative.java (EmacsNative) <static initializer>: Load shared libraries from EMACS_SHARED_LIBRARIES rather than a hard-coded list. * m4/ndk-build.m4 (ndk_INIT): Search for readelf... (ndk_CHECK_MODULES): ...and substitute its path as NDK_BUILD_READELF.
Diffstat (limited to 'java/org')
-rw-r--r--java/org/gnu/emacs/EmacsNative.java52
1 files changed, 24 insertions, 28 deletions
diff --git a/java/org/gnu/emacs/EmacsNative.java b/java/org/gnu/emacs/EmacsNative.java
index 567242f2ec3..9b3e60e1a84 100644
--- a/java/org/gnu/emacs/EmacsNative.java
+++ b/java/org/gnu/emacs/EmacsNative.java
@@ -321,39 +321,35 @@ public final class EmacsNative
321 321
322 static 322 static
323 { 323 {
324 /* Older versions of Android cannot link correctly with shared 324 /* A library search path misconfiguration prevents older versions of
325 libraries that link with other shared libraries built along 325 Android from successfully loading application shared libraries
326 Emacs unless all requisite shared libraries are explicitly 326 unless all requisite shared libraries provided by the application
327 loaded from Java. 327 are explicitly loaded from Java. The build process arranges that
328 328 EmacsConfig.EMACS_SHARED_LIBRARIES hold the names of each of
329 Every time you add a new shared library dependency to Emacs, 329 these libraries in the correct order, so load them now. */
330 please insert it here as well, before other shared libraries of 330
331 which it might be a dependency. */ 331 libraryDeps = EmacsConfig.EMACS_SHARED_LIBRARIES;
332
333 libraryDeps = new String[] { "c++_shared", "gnustl_shared",
334 "stlport_shared", "gabi++_shared",
335 "png_emacs", "pcre_emacs",
336 "selinux_emacs", "crypto_emacs",
337 "packagelistparser_emacs",
338 "gmp_emacs", "nettle_emacs",
339 "p11-kit_emacs", "tasn1_emacs",
340 "hogweed_emacs", "gnutls_emacs",
341 "jpeg_emacs", "tiff_emacs",
342 "icuuc_emacs", "xml2_emacs",
343 "harfbuzz_emacs", "tree-sitter_emacs", };
344 332
345 for (String dependency : libraryDeps) 333 for (String dependency : libraryDeps)
346 { 334 {
347 try 335 /* Remove the "lib" prefix, if any. */
348 { 336 if (dependency.startsWith ("lib"))
349 System.loadLibrary (dependency); 337 dependency = dependency.substring (3);
350 } 338
351 catch (UnsatisfiedLinkError exception) 339 /* If this library is provided by the operating system, don't
352 { 340 link to it. */
353 /* Ignore this exception. */ 341 if (dependency.equals ("z")
354 } 342 || dependency.equals ("c")
343 || dependency.equals ("m")
344 || dependency.equals ("dl")
345 || dependency.equals ("log")
346 || dependency.equals ("android"))
347 continue;
348
349 System.loadLibrary (dependency);
355 } 350 }
356 351
352 /* At this point, it should be alright to load Emacs. */
357 System.loadLibrary ("emacs"); 353 System.loadLibrary ("emacs");
358 }; 354 };
359}; 355};