aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorPo Lu2024-07-12 11:59:09 +0800
committerPo Lu2024-07-12 11:59:25 +0800
commita5ef9e25680d490e2a453e5ed518aba8f4560b2d (patch)
treee79513e876f8ff71be0787e8ba939c666c5d06d7 /doc
parent0de0056fd6b3b70dde54884db5d9ffc013c49efc (diff)
downloademacs-a5ef9e25680d490e2a453e5ed518aba8f4560b2d.tar.gz
emacs-a5ef9e25680d490e2a453e5ed518aba8f4560b2d.zip
Document means of executing Emacs from unrelated Android applications
* doc/emacs/android.texi (Android Environment): Document significance, effect and purpose of EMACS_CLASS_PATH and EMACS_LD_LIBRARY_PATH, and the utility of `pm path org.gnu.emacs'.
Diffstat (limited to 'doc')
-rw-r--r--doc/emacs/android.texi63
1 files changed, 52 insertions, 11 deletions
diff --git a/doc/emacs/android.texi b/doc/emacs/android.texi
index 606c5e719cb..2d95f5c8fef 100644
--- a/doc/emacs/android.texi
+++ b/doc/emacs/android.texi
@@ -364,17 +364,58 @@ consult the values of the variables @code{ctags-program-name},
364@code{ebrowse-program-name}, and @code{rcs2log-program-name}. 364@code{ebrowse-program-name}, and @code{rcs2log-program-name}.
365@xref{Subprocess Creation,,, elisp, the Emacs Lisp Reference Manual}. 365@xref{Subprocess Creation,,, elisp, the Emacs Lisp Reference Manual}.
366 366
367 The @file{/assets} directory containing Emacs start-up files is 367 The @file{/assets} directory containing Emacs start-up files is meant
368meant to be inaccessible to processes not directly created by 368to be inaccessible to processes not directly created by @code{zygote},
369@code{zygote}, the system service responsible for starting 369the system service responsible for starting applications. Since
370applications. Since required Lisp is found in the @file{/assets} 370required Lisp is found in the @file{/assets} directory, it would thus
371directory, it would thus follow that it is not possible for Emacs to 371follow that it is not possible for Emacs to start itself as a
372start itself as a subprocess. A special binary named 372subprocess. A special binary named @command{libandroid-emacs.so} is
373@command{libandroid-emacs.so} is provided with Emacs, which tries its 373provided with Emacs, which is installed into the library directory, and
374best to start Emacs for the purpose of running Lisp in batch mode. 374which tries its best to start Emacs for the purpose of running Lisp in
375However, the approach it takes was devised by reading Android source 375batch mode. The approach it takes was devised by reference to Android
376code, and is not sanctioned by the Android compatibility definition 376source code, and is not sanctioned by the Android compatibility
377documents, so your mileage may vary. 377definition documents, so your mileage may vary.
378
379@cindex EMACS_CLASS_PATH environment variable, Android
380 Even when the location of the @command{libandroid-emacs.so} command is
381known in advance, special configuration is required to run Emacs from
382elsewhere than a subprocess of an existing Emacs session, as it must be
383made to understand the location of resources and shared libraries in or
384extracted from the installed application package. The OS command
385@command{pm path org.gnu.emacs} will print the location of the
386application package, and the adjacent @file{lib} directory will hold
387shared libraries extracted from the same, though the said command must
388be invoked in a peculiar manner to satisfy system restrictions on
389communication between pseudoterminal devices created by user
390applications and system services such as the package manager, which is
391to say, with the standard IO streams redirected to a real file or a
392pipe. Such values, once established, must be specified in the
393environment variables @code{EMACS_CLASS_PATH} and
394@code{EMACS_LD_LIBRARY_PATH}, so that this sample shell script may be
395installed as @code{emacs} in any location that is accessible:
396
397@example
398#!/system/bin/sh
399
400package_name=`pm path org.gnu.emacs 2>/dev/null </dev/null \
401 | sed 's/^package://'`
402emacs=
403ld_path=
404EMACS_CLASS_PATH=$package_name
405
406for libdir in `dirname $package_name`/lib/*; do
407 ld_path=$@{ld_path:+$@{ld_path@}:@}$libdir
408 test -x "$libdir"/libandroid-emacs.so \
409 && emacs="$libdir"/libandroid-emacs.so
410done
411
412EMACS_LD_LIBRARY_PATH=$ld_path
413
414export EMACS_CLASS_PATH
415export EMACS_LD_LIBRARY_PATH
416test -x "$emacs" || exit 1
417exec $emacs "$@@"
418@end example
378 419
379@cindex call-process, Android 420@cindex call-process, Android
380@vindex android-use-exec-loader 421@vindex android-use-exec-loader