diff options
| author | Po Lu | 2024-07-12 11:59:09 +0800 |
|---|---|---|
| committer | Po Lu | 2024-07-12 11:59:25 +0800 |
| commit | a5ef9e25680d490e2a453e5ed518aba8f4560b2d (patch) | |
| tree | e79513e876f8ff71be0787e8ba939c666c5d06d7 /doc | |
| parent | 0de0056fd6b3b70dde54884db5d9ffc013c49efc (diff) | |
| download | emacs-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.texi | 63 |
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 |
| 368 | meant to be inaccessible to processes not directly created by | 368 | to be inaccessible to processes not directly created by @code{zygote}, |
| 369 | @code{zygote}, the system service responsible for starting | 369 | the system service responsible for starting applications. Since |
| 370 | applications. Since required Lisp is found in the @file{/assets} | 370 | required Lisp is found in the @file{/assets} directory, it would thus |
| 371 | directory, it would thus follow that it is not possible for Emacs to | 371 | follow that it is not possible for Emacs to start itself as a |
| 372 | start itself as a subprocess. A special binary named | 372 | subprocess. A special binary named @command{libandroid-emacs.so} is |
| 373 | @command{libandroid-emacs.so} is provided with Emacs, which tries its | 373 | provided with Emacs, which is installed into the library directory, and |
| 374 | best to start Emacs for the purpose of running Lisp in batch mode. | 374 | which tries its best to start Emacs for the purpose of running Lisp in |
| 375 | However, the approach it takes was devised by reading Android source | 375 | batch mode. The approach it takes was devised by reference to Android |
| 376 | code, and is not sanctioned by the Android compatibility definition | 376 | source code, and is not sanctioned by the Android compatibility |
| 377 | documents, so your mileage may vary. | 377 | definition 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 | ||
| 381 | known in advance, special configuration is required to run Emacs from | ||
| 382 | elsewhere than a subprocess of an existing Emacs session, as it must be | ||
| 383 | made to understand the location of resources and shared libraries in or | ||
| 384 | extracted from the installed application package. The OS command | ||
| 385 | @command{pm path org.gnu.emacs} will print the location of the | ||
| 386 | application package, and the adjacent @file{lib} directory will hold | ||
| 387 | shared libraries extracted from the same, though the said command must | ||
| 388 | be invoked in a peculiar manner to satisfy system restrictions on | ||
| 389 | communication between pseudoterminal devices created by user | ||
| 390 | applications and system services such as the package manager, which is | ||
| 391 | to say, with the standard IO streams redirected to a real file or a | ||
| 392 | pipe. Such values, once established, must be specified in the | ||
| 393 | environment variables @code{EMACS_CLASS_PATH} and | ||
| 394 | @code{EMACS_LD_LIBRARY_PATH}, so that this sample shell script may be | ||
| 395 | installed as @code{emacs} in any location that is accessible: | ||
| 396 | |||
| 397 | @example | ||
| 398 | #!/system/bin/sh | ||
| 399 | |||
| 400 | package_name=`pm path org.gnu.emacs 2>/dev/null </dev/null \ | ||
| 401 | | sed 's/^package://'` | ||
| 402 | emacs= | ||
| 403 | ld_path= | ||
| 404 | EMACS_CLASS_PATH=$package_name | ||
| 405 | |||
| 406 | for 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 | ||
| 410 | done | ||
| 411 | |||
| 412 | EMACS_LD_LIBRARY_PATH=$ld_path | ||
| 413 | |||
| 414 | export EMACS_CLASS_PATH | ||
| 415 | export EMACS_LD_LIBRARY_PATH | ||
| 416 | test -x "$emacs" || exit 1 | ||
| 417 | exec $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 |