1
0
mirror of https://github.com/termux/termux-packages synced 2024-06-27 10:57:08 +00:00

new package: emacs-x (Emacs with X11 support enabled)

Requested in https://github.com/termux/x11-packages/issues/1
This commit is contained in:
Leonid Pliushch 2018-09-12 22:33:06 +03:00 committed by Yaksh Bariya
parent 56c3db0ed8
commit dbea808431
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
13 changed files with 271 additions and 0 deletions

View File

@ -0,0 +1,86 @@
TERMUX_PKG_MAINTAINER="Leonid Plyushch <leonid.plyushch@gmail.com> @xeffyr"
TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/emacs/
TERMUX_PKG_DESCRIPTION="Extensible, customizable text editor-and more (with X11 support)"
TERMUX_PKG_VERSION=26.1
TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/emacs/emacs-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=1cf4fc240cd77c25309d15e18593789c8dbfba5c2b44d8f77c886542300fd32c
TERMUX_PKG_DEPENDS="giflib, libandroid-shmem, libgnutls, libgtk3, libjpeg-turbo, libpng, librsvg, libtiff, libxml2, libxpm, littlecms, ncurses"
TERMUX_PKG_HOSTBUILD=yes
TERMUX_PKG_KEEP_INFOPAGES=yes
# Remove some irrelevant files:
TERMUX_PKG_RM_AFTER_INSTALL="
bin/ctags
share/emacs/${TERMUX_PKG_VERSION}/etc/images
bin/grep-changelog share/man/man1/grep-changelog.1.gz
share/emacs/${TERMUX_PKG_VERSION}/etc/refcards
share/emacs/${TERMUX_PKG_VERSION}/etc/tutorials/TUTORIAL.*
share/man/man1/ctags.1
share/man/man1/ctags.1.gz
"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
--disable-autodepend
--without-cairo
--without-imagemagick
--without-libotf
--without-xaw3d
--without-gpm
--without-dbus
--without-gconf
--without-gsettings
--with-xwidgets
--with-x
"
# Ensure use of system malloc:
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" emacs_cv_sanitize_address=yes"
# Prevent configure from adding -nopie:
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" emacs_cv_prog_cc_no_pie=no"
# Prevent linking against libelf:
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" ac_cv_lib_elf_elf_begin=no"
# implemented using dup3(), which fails if oldfd == newfd
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" gl_cv_func_dup2_works=no"
# disable setrlimit function to make termux-am work from within emacs
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" ac_cv_func_setrlimit=no"
termux_step_post_extract_package() {
# XXX: We have to start with new host build each time
# to avoid build error when cross compiling.
rm -Rf $TERMUX_PKG_HOSTBUILD_DIR
# Termux only use info pages for emacs. Remove the info directory
# to get a clean Info directory file dir.
rm -Rf $TERMUX_PREFIX/share/info
# We cannot run a dumped emacs on Android 5.0+ due to the pie requirement.
# Also, the native emacs we build (bootstrap-emacs) cannot used dumps when
# building inside docker: https://github.com/docker/docker/issues/22801
export CANNOT_DUMP=yes
}
termux_step_host_build() {
# Build a bootstrap-emacs binary to be used in termux_step_post_configure.
local NATIVE_PREFIX=$TERMUX_PKG_TMPDIR/emacs-native
mkdir -p $NATIVE_PREFIX/share/emacs/$TERMUX_PKG_VERSION
ln -s $TERMUX_PKG_SRCDIR/lisp $NATIVE_PREFIX/share/emacs/$TERMUX_PKG_VERSION/lisp
$TERMUX_PKG_SRCDIR/configure --prefix=$NATIVE_PREFIX --without-all --with-x-toolkit=no
make -j $TERMUX_MAKE_PROCESSES
}
termux_step_post_configure() {
cp $TERMUX_PKG_HOSTBUILD_DIR/src/bootstrap-emacs $TERMUX_PKG_BUILDDIR/src/bootstrap-emacs
cp $TERMUX_PKG_HOSTBUILD_DIR/lib-src/make-docfile $TERMUX_PKG_BUILDDIR/lib-src/make-docfile
# Update timestamps so that the binaries does not get rebuilt:
touch -d "next hour" $TERMUX_PKG_BUILDDIR/src/bootstrap-emacs $TERMUX_PKG_BUILDDIR/lib-src/make-docfile
}
termux_step_post_make_install() {
cp $TERMUX_PKG_BUILDER_DIR/site-init.el $TERMUX_PREFIX/share/emacs/${TERMUX_PKG_VERSION}/lisp/emacs-lisp/
}

View File

@ -0,0 +1,12 @@
diff -u -r ../emacs-25.0.92/lib-src/emacsclient.c ./lib-src/emacsclient.c
--- ../emacs-25.0.92/lib-src/emacsclient.c 2016-03-02 05:21:42.000000000 -0500
+++ ./lib-src/emacsclient.c 2016-04-09 01:28:10.881760020 -0400
@@ -1210,7 +1210,7 @@
}
else
#endif
- tmpdir = "/tmp";
+ tmpdir = "@TERMUX_PREFIX@/tmp";
}
socket_name_storage =
xmalloc (strlen (tmpdir) + strlen (server_name) + EXTRA_SPACE);

View File

@ -0,0 +1,12 @@
diff -u -r ../emacs-25.0.92/lisp/cus-start.el ./lisp/cus-start.el
--- ../emacs-25.0.92/lisp/cus-start.el 2016-03-02 05:21:42.000000000 -0500
+++ ./lisp/cus-start.el 2016-04-06 18:16:00.007272810 -0400
@@ -277,7 +277,7 @@
"/tmp"))
(t
(or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP")
- "/tmp"))))
+ "@TERMUX_PREFIX@/tmp"))))
:initialize custom-initialize-delay)
;; fns.c
(use-dialog-box menu boolean "21.1")

View File

@ -0,0 +1,16 @@
diff -u -r ../emacs-25.0.92/lisp/loadup.el ./lisp/loadup.el
--- ../emacs-25.0.92/lisp/loadup.el 2016-09-06 09:49:51.838175278 +0300
+++ ./lisp/loadup.el 2016-09-06 09:57:18.694585441 +0300
@@ -378,7 +378,11 @@
(message "Warning: Change in load-path due to site-init will be \
lost after dumping")))
-(setq current-load-list nil)
+;; On an emacs that runs undumped, i.e. Android, this causes bogus
+;; entries to appear in load-history. Commenting this out causes an entry
+;; for loadup.el with a bogus filename to appear instead, but since it
+;; neither provides nor requires anything, it appears to be safe.
+;;(setq current-load-list nil)
;; Avoid storing references to build directory in the binary.
(setq custom-current-group-alist nil)

View File

@ -0,0 +1,12 @@
diff -u -r ../emacs-26.1/lisp/net/tramp.el ./lisp/net/tramp.el
--- ../emacs-26.1/lisp/net/tramp.el 2018-04-23 14:17:48.000000000 +0000
+++ ./lisp/net/tramp.el 2018-05-29 09:26:34.017326913 +0000
@@ -127,7 +127,7 @@
:require 'tramp)
(defcustom tramp-encoding-shell
- (or (tramp-compat-funcall 'w32-shell-name) "/bin/sh")
+ (or (tramp-compat-funcall 'w32-shell-name) "@TERMUX_PREFIX@/bin/sh")
"Use this program for encoding and decoding commands on the local host.
This shell is used to execute the encoding and decoding command on the
local host, so if you want to use `~' in those commands, you should

View File

@ -0,0 +1,12 @@
diff -u -r ../emacs-25.0.92/lisp/server.el ./lisp/server.el
--- ../emacs-25.0.92/lisp/server.el 2016-03-02 05:21:42.000000000 -0500
+++ ./lisp/server.el 2016-04-06 17:34:48.134354070 -0400
@@ -267,7 +267,7 @@
;; does not read the init file.
(defvar server-socket-dir
(and (featurep 'make-network-process '(:family local))
- (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))
+ (format "%s/emacs%d" (or (getenv "TMPDIR") "@TERMUX_PREFIX@/tmp") (user-uid)))
"The directory in which to place the server socket.
If local sockets are not supported, this is nil.")

View File

@ -0,0 +1,21 @@
diff -u -r ../emacs-25.0.92/lisp/subr.el ./lisp/subr.el
--- ../emacs-25.0.92/lisp/subr.el 2016-03-02 05:21:42.000000000 -0500
+++ ./lisp/subr.el 2016-03-25 22:03:57.240066240 -0400
@@ -2975,7 +2975,7 @@
(declare (advertised-calling-convention (name buffer command) "23.1"))
(start-file-process
name buffer
- (if (file-remote-p default-directory) "/bin/sh" shell-file-name)
+ (if (file-remote-p default-directory) "@TERMUX_PREFIX@/bin/sh" shell-file-name)
(if (file-remote-p default-directory) "-c" shell-command-switch)
(mapconcat 'identity args " ")))
@@ -3019,7 +3019,7 @@
(declare (advertised-calling-convention
(command &optional infile buffer display) "24.5"))
(process-file
- (if (file-remote-p default-directory) "/bin/sh" shell-file-name)
+ (if (file-remote-p default-directory) "@TERMUX_PREFIX@/bin/sh" shell-file-name)
infile buffer display
(if (file-remote-p default-directory) "-c" shell-command-switch)
(mapconcat 'identity (cons command args) " ")))

View File

@ -0,0 +1,12 @@
diff -u -r ../emacs-26.1/lisp/term.el ./lisp/term.el
--- ../emacs-26.1/lisp/term.el 2018-05-25 08:53:30.000000000 +0000
+++ ./lisp/term.el 2018-05-29 09:28:08.472262228 +0000
@@ -1552,7 +1552,7 @@
;; do the decoding by hand on the parts that are made of chars.
(coding-system-for-read 'binary))
(apply 'start-process name buffer
- "/bin/sh" "-c"
+ "@TERMUX_PREFIX@/bin/sh" "-c"
(format "stty -nl echo rows %d columns %d sane 2>/dev/null;\
if [ $1 = .. ]; then shift; fi; exec \"$@\""
term-height term-width)

View File

@ -0,0 +1,12 @@
diff -u -r ../emacs-24.3/src/editfns.c ./src/editfns.c
--- ../emacs-24.3/src/editfns.c 2013-01-01 21:37:17.000000000 +0100
+++ ./src/editfns.c 2014-02-19 03:21:55.000000000 +0100
@@ -1304,7 +1304,7 @@
if (!pw)
return Qnil;
- p = USER_FULL_NAME;
+ p = "unknown";
/* Chop off everything after the first comma. */
q = strchr (p, ',');
full = make_string (p, q ? q - p : strlen (p));

View File

@ -0,0 +1,4 @@
; Enable terminal mouse events:
(xterm-mouse-mode 1)
(global-set-key [mouse-4] 'scroll-down-line)
(global-set-key [mouse-5] 'scroll-up-line)

View File

@ -0,0 +1,12 @@
diff -u -r ../emacs-25.0.92/src/callproc.c ./src/callproc.c
--- ../emacs-25.0.92/src/callproc.c 2016-03-02 05:21:43.000000000 -0500
+++ ./src/callproc.c 2016-03-25 22:02:38.977310920 -0400
@@ -1619,7 +1619,7 @@
dir_warning ("arch-independent data dir", Vdata_directory);
sh = getenv ("SHELL");
- Vshell_file_name = build_string (sh ? sh : "/bin/sh");
+ Vshell_file_name = build_string (sh ? sh : "@TERMUX_PREFIX@/bin/sh");
#ifdef DOS_NT
Vshared_game_score_directory = Qnil;

View File

@ -0,0 +1,38 @@
diff -u -r ../emacs-25.2/src/filelock.c ./src/filelock.c
--- ../emacs-25.2/src/filelock.c 2017-02-03 11:25:45.000000000 +0100
+++ ./src/filelock.c 2017-06-30 23:36:35.331596590 +0200
@@ -126,14 +126,14 @@
static time_t boot_time;
static bool boot_time_initialized;
-#ifdef BOOT_TIME
+#if defined(BOOT_TIME) && !defined(__ANDROID__)
static void get_boot_time_1 (const char *, bool);
#endif
static time_t
get_boot_time (void)
{
-#if defined (BOOT_TIME)
+#if defined (BOOT_TIME) && !defined(__ANDROID__)
int counter;
#endif
@@ -169,7 +169,7 @@
}
}
-#if defined (BOOT_TIME)
+#if defined (BOOT_TIME) && !defined(__ANDROID__)
#ifndef CANNOT_DUMP
/* The utmp routines maintain static state.
Don't touch that state unless we are initialized,
@@ -237,7 +237,7 @@
#endif
}
-#ifdef BOOT_TIME
+#if defined(BOOT_TIME) && !defined(__ANDROID__)
/* Try to get the boot time from wtmp file FILENAME.
This succeeds if that file contains a reboot record.

View File

@ -0,0 +1,22 @@
https://github.com/emacs-mirror/emacs/commit/18b235941109ab9e7a405cbe950886c97e897e11
diff --git a/src/keyboard.c b/src/keyboard.c
index 57757cf2112..f32b1560133 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -8916,7 +8916,6 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
ptrdiff_t keys_start;
Lisp_Object current_binding = Qnil;
- Lisp_Object first_event = Qnil;
/* Index of the first key that has no binding.
It is useless to try fkey.start larger than that. */
@@ -9026,6 +9025,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
starting_buffer = current_buffer;
first_unbound = bufsize + 1;
+ Lisp_Object first_event = mock_input > 0 ? keybuf[0] : Qnil;
/* Build our list of keymaps.
If we recognize a function key and replace its escape sequence in