diff --git a/packages/emacs/build.sh b/packages/emacs/build.sh index 1d1c877cb..107d7b6d3 100644 --- a/packages/emacs/build.sh +++ b/packages/emacs/build.sh @@ -1,10 +1,9 @@ TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/emacs/ TERMUX_PKG_DESCRIPTION="Extensible, customizable text editor-and more" TERMUX_PKG_LICENSE="GPL-3.0" -TERMUX_PKG_VERSION=26.3 -TERMUX_PKG_REVISION=7 -TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/emacs/emacs-${TERMUX_PKG_VERSION}.tar.xz -TERMUX_PKG_SHA256=4d90e6751ad8967822c6e092db07466b9d383ef1653feb2f95c93e7de66d3485 +TERMUX_PKG_VERSION=27.1 +TERMUX_PKG_SRCURL=https://ftp.gnu.org/gnu/emacs/emacs-${TERMUX_PKG_VERSION}.tar.xz +TERMUX_PKG_SHA256=4a4c128f915fc937d61edfc273c98106711b540c9be3cd5d2e2b9b5b2f172e41 TERMUX_PKG_DEPENDS="ncurses, gnutls, libxml2" TERMUX_PKG_BREAKS="emacs-dev" TERMUX_PKG_REPLACES="emacs-dev" @@ -89,16 +88,19 @@ termux_step_host_build() { 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 + ( cd $TERMUX_PKG_SRCDIR; ./autogen.sh ) + $TERMUX_PKG_SRCDIR/configure --prefix=$NATIVE_PREFIX --without-all --without-x 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 + cp $TERMUX_PKG_HOSTBUILD_DIR/lib-src/make-fingerprint $TERMUX_PKG_BUILDDIR/lib-src/make-fingerprint # 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 + touch -d "next hour" $TERMUX_PKG_BUILDDIR/src/bootstrap-emacs \ + $TERMUX_PKG_BUILDDIR/lib-src/make-docfile \ + $TERMUX_PKG_BUILDDIR/lib-src/make-fingerprint } termux_step_post_make_install() { diff --git a/packages/emacs/lib-src-emacsclient.c.patch b/packages/emacs/lib-src-emacsclient.c.patch index c779f18b7..75dc0433a 100644 --- a/packages/emacs/lib-src-emacsclient.c.patch +++ b/packages/emacs/lib-src-emacsclient.c.patch @@ -1,18 +1,20 @@ ---- ../emacsclient.c.orig 2019-08-29 20:08:48.840624090 +0200 -+++ ./lib-src/emacsclient.c 2019-08-29 20:13:37.425382182 +0200 -@@ -1289,11 +1289,12 @@ - } - else - #endif -- tmpdir = "/tmp"; -+ tmpdir = "@TERMUX_PREFIX@/tmp"; - } -+ /* Use $PREFIX/var/run instead of $TMPDIR in termux. */ - socket_name_storage = -- xmalloc (strlen (tmpdir) + strlen (server_name) + EXTRA_SPACE); -- char *z = stpcpy (socket_name_storage, tmpdir); -+ xmalloc (strlen ("@TERMUX_PREFIX@/var/run") + strlen (server_name) + EXTRA_SPACE); -+ char *z = stpcpy (socket_name_storage, "@TERMUX_PREFIX@/var/run"); - z += sprintf (z, "/emacs%ld/", uid); - strcpy (z, server_name); - local_socket_name = socket_name_storage; +--- ./lib-src/emacsclient.c.orig 2020-07-29 23:40:41.000000000 +0200 ++++ ./lib-src/emacsclient.c 2020-09-14 21:36:04.883963456 +0200 +@@ -1411,7 +1411,7 @@ + tmpdirlen = min (n - 1, socknamesize); + # endif + if (tmpdirlen < 0) +- tmpdirlen = snprintf (sockname, socknamesize, "/tmp"); ++ tmpdirlen = snprintf (sockname, socknamesize, "@TERMUX_PREFIX@/tmp"); + } + socknamelen = local_sockname (sockname, socknamesize, tmpdirlen, + uid, server_name); +@@ -1495,7 +1495,7 @@ + uintmax_t id = uid; + char sockdirname[socknamesize]; + int sockdirnamelen = snprintf (sockdirname, sizeof sockdirname, +- "/run/user/%"PRIuMAX, id); ++ "@TERMUX_PREFIX/var@/run/user/%"PRIuMAX, id); + if (0 <= sockdirnamelen && sockdirnamelen < sizeof sockdirname + && faccessat (AT_FDCWD, sockdirname, X_OK, AT_EACCESS) == 0) + message diff --git a/packages/emacs/lisp-cus-start.el.patch.beforehostbuild b/packages/emacs/lisp-cus-start.el.patch.beforehostbuild index 3e5f69657..4ff5fec4c 100644 --- a/packages/emacs/lisp-cus-start.el.patch.beforehostbuild +++ b/packages/emacs/lisp-cus-start.el.patch.beforehostbuild @@ -1,7 +1,6 @@ -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 @@ +--- ./lisp/cus-start.el.orig 2020-07-27 23:21:49.000000000 +0200 ++++ ./lisp/cus-start.el 2020-09-14 21:34:59.583435440 +0200 +@@ -290,7 +290,7 @@ "/tmp")) (t (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") diff --git a/packages/emacs/lisp-loadup.el-2.patch.beforehostbuild b/packages/emacs/lisp-loadup.el-2.patch.beforehostbuild index e316780ca..4f328fc28 100644 --- a/packages/emacs/lisp-loadup.el-2.patch.beforehostbuild +++ b/packages/emacs/lisp-loadup.el-2.patch.beforehostbuild @@ -1,7 +1,6 @@ -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 @@ +--- ./lisp/loadup.el.orig 2020-07-27 23:21:49.000000000 +0200 ++++ ./lisp/loadup.el 2020-09-14 21:34:59.586768800 +0200 +@@ -423,7 +423,11 @@ (message "Warning: Change in load-path due to site-init will be \ lost after dumping"))) diff --git a/packages/emacs/lisp-net-tramp.el.patch.beforehostbuild b/packages/emacs/lisp-net-tramp.el.patch.beforehostbuild index f24d195fe..19daf3136 100644 --- a/packages/emacs/lisp-net-tramp.el.patch.beforehostbuild +++ b/packages/emacs/lisp-net-tramp.el.patch.beforehostbuild @@ -1,12 +1,11 @@ -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) - +--- ./lisp/net/tramp.el.orig 2020-07-29 23:40:41.000000000 +0200 ++++ ./lisp/net/tramp.el 2020-09-14 21:34:59.593435521 +0200 +@@ -133,7 +133,7 @@ + ;; Suppress `shell-file-name' for w32 systems. (defcustom tramp-encoding-shell -- (or (tramp-compat-funcall 'w32-shell-name) "/bin/sh") -+ (or (tramp-compat-funcall 'w32-shell-name) "@TERMUX_PREFIX@/bin/sh") + (let (shell-file-name) +- (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 + local host, so if you want to use \"~\" in those commands, you should diff --git a/packages/emacs/lisp-server.el.patch.beforehostbuild b/packages/emacs/lisp-server.el.patch.beforehostbuild index 162852a16..537d2782c 100644 --- a/packages/emacs/lisp-server.el.patch.beforehostbuild +++ b/packages/emacs/lisp-server.el.patch.beforehostbuild @@ -1,12 +1,11 @@ -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" "@TERMUX_PREFIX@/var/run" (user-uid))) +--- ./lisp/server.el.orig 2019-11-28 10:49:15.353433913 +0100 ++++ ./lisp/server.el 2019-11-28 10:50:18.741175439 +0100 +@@ -277,7 +277,7 @@ + (let ((xdg_runtime_dir (getenv "XDG_RUNTIME_DIR"))) + (if xdg_runtime_dir + (format "%s/emacs" xdg_runtime_dir) +- (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))))) ++ (format "%s/emacs%d" "@TERMUX_PREFIX@/var/run" (user-uid)))))) "The directory in which to place the server socket. If local sockets are not supported, this is nil.") diff --git a/packages/emacs/lisp-subr.el.patch.beforehostbuild b/packages/emacs/lisp-subr.el.patch.beforehostbuild deleted file mode 100644 index 28d90bdbc..000000000 --- a/packages/emacs/lisp-subr.el.patch.beforehostbuild +++ /dev/null @@ -1,21 +0,0 @@ -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) " "))) diff --git a/packages/emacs/lisp-term.el.patch.beforehostbuild b/packages/emacs/lisp-term.el.patch.beforehostbuild index 0058f6dd1..fc56b5714 100644 --- a/packages/emacs/lisp-term.el.patch.beforehostbuild +++ b/packages/emacs/lisp-term.el.patch.beforehostbuild @@ -1,10 +1,9 @@ -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 +--- ./lisp/term.el.orig 2019-11-28 10:52:45.633666279 +0100 ++++ ./lisp/term.el 2019-11-28 10:53:51.234778668 +0100 +@@ -1558,7 +1558,7 @@ + (push (format "EMACS=%s (term:%s)" emacs-version term-protocol-version) + process-environment)) + (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;\ diff --git a/packages/emacs/no_user_fullname.patch b/packages/emacs/no_user_fullname.patch index 4a99de697..153dbe63a 100644 --- a/packages/emacs/no_user_fullname.patch +++ b/packages/emacs/no_user_fullname.patch @@ -1,7 +1,6 @@ -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 @@ +--- ./src/editfns.c.orig 2020-07-29 23:40:42.000000000 +0200 ++++ ./src/editfns.c 2020-09-14 21:36:04.890630177 +0200 +@@ -1250,7 +1250,7 @@ if (!pw) return Qnil; @@ -9,4 +8,4 @@ diff -u -r ../emacs-24.3/src/editfns.c ./src/editfns.c + p = "unknown"; /* Chop off everything after the first comma. */ q = strchr (p, ','); - full = make_string (p, q ? q - p : strlen (p)); + full = make_string (p, q ? q - p : strlen (p)); \ No newline at end of file diff --git a/packages/emacs/src-callproc.c.patch b/packages/emacs/src-callproc.c.patch index 032c14306..f6588203a 100644 --- a/packages/emacs/src-callproc.c.patch +++ b/packages/emacs/src-callproc.c.patch @@ -1,12 +1,11 @@ -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 @@ +--- ./src/callproc.c.orig 2020-07-29 23:40:42.000000000 +0200 ++++ ./src/callproc.c 2020-09-14 21:36:04.897296897 +0200 +@@ -1621,7 +1621,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; + Lisp_Object gamedir = Qnil; + if (PATH_GAME) diff --git a/packages/emacs/src-filelock.c.patch b/packages/emacs/src-filelock.c.patch index bcf966bff..b27927cc0 100644 --- a/packages/emacs/src-filelock.c.patch +++ b/packages/emacs/src-filelock.c.patch @@ -1,12 +1,25 @@ -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 @@ +--- ../emacs-27/src/filelock.c 2019-11-28 09:41:28.000000000 +0100 ++++ ./src/filelock.c 2019-11-28 15:07:18.792543698 +0100 +@@ -63,11 +63,11 @@ + /* A file whose last-modified time is just after the most recent boot. + Define this to be NULL to disable checking for this file. */ + #ifndef BOOT_TIME_FILE +-#define BOOT_TIME_FILE "/var/run/random-seed" ++#define BOOT_TIME_FILE "@TERMUX_PREFIX@/var/run/random-seed" + #endif + + #if !defined WTMP_FILE && !defined WINDOWSNT +-#define WTMP_FILE "/var/log/wtmp" ++#define WTMP_FILE "@TERMUX_PREFIX@/var/log/wtmp" + #endif + + /* Normally use a symbolic link to represent a lock. +@@ -127,14 +127,14 @@ static time_t boot_time; static bool boot_time_initialized; -#ifdef BOOT_TIME -+#if defined(BOOT_TIME) && !defined(__ANDROID__) ++#if defined (BOOT_TIME) && !defined(__ANDROID__) static void get_boot_time_1 (const char *, bool); #endif @@ -18,21 +31,21 @@ diff -u -r ../emacs-25.2/src/filelock.c ./src/filelock.c int counter; #endif -@@ -169,7 +169,7 @@ +@@ -170,7 +170,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 @@ + /* The utmp routines maintain static state. Don't touch that state + if we are going to dump, since it might not survive dumping. */ + if (will_dump_p ()) +@@ -229,7 +229,7 @@ #endif } -#ifdef BOOT_TIME -+#if defined(BOOT_TIME) && !defined(__ANDROID__) ++#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. diff --git a/packages/emacs/src-keyboard.c.patch b/packages/emacs/src-keyboard.c.patch deleted file mode 100644 index da61b9170..000000000 --- a/packages/emacs/src-keyboard.c.patch +++ /dev/null @@ -1,22 +0,0 @@ -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