emacs: Update and patch more
authorFredrik Fornwall <fredrik@fornwall.net>
Sat, 26 Mar 2016 03:33:48 +0000 (23:33 -0400)
committerFredrik Fornwall <fredrik@fornwall.net>
Sat, 26 Mar 2016 03:33:48 +0000 (23:33 -0400)
Update emacs to 25.0.92, a prerelease for 25.1. Also patch some
more to avoid having it crashing on startup due to bugs in emacs
about undumped startup with a terminal. Closes #11.

packages/emacs/Makefile.in.patch [deleted file]
packages/emacs/build.sh
packages/emacs/lib-src-Makefile.in.patch [deleted file]
packages/emacs/lisp-loadup.el.patch.beforehostbuild [new file with mode: 0644]
packages/emacs/lisp-subr.el.patch.beforehostbuild [new file with mode: 0644]
packages/emacs/lisp-term.el.patch.beforehostbuild [new file with mode: 0644]
packages/emacs/site-init.el [new file with mode: 0644]
packages/emacs/src-Makefile.in.patch [deleted file]
packages/emacs/src-callproc.c.patch [new file with mode: 0644]
packages/emacs/src-xdisp.c.patch [new file with mode: 0644]
packages/emacs/unexelf.c.patch [deleted file]

diff --git a/packages/emacs/Makefile.in.patch b/packages/emacs/Makefile.in.patch
deleted file mode 100644 (file)
index 89e1898..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -u -r ../emacs-24.5/Makefile.in ./Makefile.in
---- ../emacs-24.5/Makefile.in  2015-04-02 03:23:06.000000000 -0400
-+++ ./Makefile.in      2015-08-03 19:41:45.006522243 -0400
-@@ -307,7 +307,7 @@
-         sed < ${srcdir}/src/epaths.in > epaths.h.$$$$         \
-         -e 's;\(#.*PATH_LOADSEARCH\).*$$;\1 "'"$${standardlisppath}"'";' \
-         -e 's;\(#.*PATH_SITELOADSEARCH\).*$$;\1 "'"$${locallisppath}"'";' \
--        -e 's;\(#.*PATH_DUMPLOADSEARCH\).*$$;\1 "'"$${buildlisppath}"'";' \
-+        -e 's;\(#.*PATH_DUMPLOADSEARCH\).*$$;\1 "'"$${standardlisppath}"'";' \
-         -e 's;\(#.*PATH_EXEC\).*$$;\1 "${archlibdir}";'               \
-         -e 's;\(#.*PATH_INFO\).*$$;\1 "${infodir}";'                  \
-         -e 's;\(#.*PATH_DATA\).*$$;\1 "${etcdir}";'                   \
index de34d1c..bee6252 100644 (file)
@@ -1,53 +1,35 @@
 TERMUX_PKG_HOMEPAGE=http://www.gnu.org/software/emacs/
 TERMUX_PKG_DESCRIPTION="Extensible, customizable text editor-and more"
-TERMUX_PKG_VERSION=24.5
-TERMUX_PKG_BUILD_REVISION=3
-TERMUX_PKG_SRCURL=http://ftp.gnu.org/pub/gnu/emacs/emacs-${TERMUX_PKG_VERSION}.tar.xz
+TERMUX_PKG_VERSION=25.0.92
+TERMUX_PKG_SRCURL=ftp://alpha.gnu.org/gnu/emacs/pretest/emacs-${TERMUX_PKG_VERSION}.tar.xz
 TERMUX_PKG_DEPENDS="ncurses"
 TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--without-x --with-xpm=no --with-jpeg=no --with-png=no --with-gif=no --with-tiff=no --without-gconf --without-gsettings --without-all"
+# 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_nopie=no"
 TERMUX_PKG_HOSTBUILD="yes"
 
-# Note that we remove leim:
+# Remove some irrelevant files:
 TERMUX_PKG_RM_AFTER_INSTALL="share/icons share/emacs/${TERMUX_PKG_VERSION}/etc/images share/applications/emacs.desktop share/emacs/${TERMUX_PKG_VERSION}/etc/emacs.desktop share/emacs/${TERMUX_PKG_VERSION}/etc/emacs.icon 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.*"
+
 # Remove ctags from the emacs package to prevent conflicting with
-# the Universal Ctags from the 'ctags' package. The bin/etags
-# program still remain in the emacs package.
+# the Universal Ctags from the 'ctags' package (the bin/etags
+# program still remain in the emacs package):
 TERMUX_PKG_RM_AFTER_INSTALL+=" bin/ctags share/man/man1/ctags.1"
 
-# http://www.gnu.org/software/emacs/manual/html_node/elisp/Building-Emacs.html#Building-Emacs
-# "Compilation of the C source files in the src directory produces an executable file called temacs, also called a
-# bare impure Emacs. It contains the Emacs Lisp interpreter and I/O routines, but not the editing commands.
-# The command temacs -l loadup would run temacs and direct it to load loadup.el. The loadup library loads additional Lisp libraries,
-# which set up the normal Emacs editing environment. After this step, the Emacs executable is no longer bare.
-# Because it takes some time to load the standard Lisp files, the temacs executable usually isn't run directly by users. Instead, as
-# one of the last steps of building Emacs, the command 'temacs -batch -l loadup dump' is run. The special 'dump' argument causes temacs
-# to dump out an executable program, called emacs, which has all the standard Lisp files preloaded. (The '-batch' argument prevents
-# temacs from trying to initialize any of its data on the terminal, so that the tables of terminal information are empty in the dumped Emacs.)"
-
-########## FROM src/Makefile:
-## The dumped Emacs is as functional and more efficient than
-## bootstrap-emacs, so we replace the latter with the former.
-## Strictly speaking, emacs does not depend directly on all of $lisp,
-## since not all pieces are used on all platforms.  But DOC depends
-## on all of $lisp, and emacs depends on DOC, so it is ok to use $lisp here.
-# emacs$(EXEEXT): temacs$(EXEEXT) $(etc)/DOC $(lisp) $(leimdir)/leim-list.el
-# if test "$(CANNOT_DUMP)" = "yes"; then \
-#      rm -f emacs$(EXEEXT); \
-#      ln temacs$(EXEEXT) emacs$(EXEEXT); \
-# else \
-#      LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \
-#      test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \
-#      rm -f bootstrap-emacs$(EXEEXT); \
-#      ln emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
-# fi
-# so emacs => temacs, and then it tries to execute emacs, leading to error
-
-# We can build without dump, but a bootstrap-emacs is still needed to produce bytecode-compiled (platform-independent) emacs lisp .elc files.
+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_step_host_build () {
-       $TERMUX_PKG_SRCDIR/configure $TERMUX_PKG_EXTRA_CONFIGURE_ARGS
+       # Build a bootstrap-emacs binary to be used in termux_step_post_configure.
+       $TERMUX_PKG_SRCDIR/configure --prefix=$TERMUX_PREFIX --without-x --with-xpm=no --with-jpeg=no \
+                                    --with-png=no --with-tiff=no --without-gconf --without-gsettings --without-all
        make
+       export CANNOT_DUMP=yes
 }
 
 termux_step_post_configure () {
@@ -58,10 +40,5 @@ termux_step_post_configure () {
 }
 
 termux_step_post_make_install () {
-       rm $TERMUX_PREFIX/bin/emacs $TERMUX_PREFIX/bin/emacs-$TERMUX_PKG_VERSION
-       echo "#!/$TERMUX_PREFIX/bin/sh" > $TERMUX_PREFIX/bin/emacs
-       echo "exec temacs -l loadup \$@" >> $TERMUX_PREFIX/bin/emacs
-       chmod +x $TERMUX_PREFIX/bin/emacs
-       cp $TERMUX_PKG_BUILDDIR/src/temacs $TERMUX_PREFIX/bin/temacs
+       cp $TERMUX_PKG_BUILDER_DIR/site-init.el $TERMUX_PREFIX/share/emacs/${TERMUX_PKG_VERSION}/lisp/emacs-lisp/
 }
-
diff --git a/packages/emacs/lib-src-Makefile.in.patch b/packages/emacs/lib-src-Makefile.in.patch
deleted file mode 100644 (file)
index b7c8954..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-diff -u -r ../emacs-24.4/lib-src/Makefile.in ./lib-src/Makefile.in
---- ../emacs-24.4/lib-src/Makefile.in  2014-04-29 16:52:57.000000000 +0200
-+++ ./lib-src/Makefile.in      2014-11-01 12:29:44.881760880 +0100
-@@ -128,7 +128,7 @@
- UTILITIES = profile${EXEEXT} movemail${EXEEXT} hexl${EXEEXT} \
-             update-game-score${EXEEXT}
--DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
-+DONT_INSTALL= make-docfile${EXEEXT}
- # Like UTILITIES, but they're not system-dependent, and should not be
- #  deleted by the distclean target.
-@@ -303,14 +303,6 @@
- TAGS: etags${EXEEXT}
-       etags *.[ch]
--## This verifies that the non-ASCII characters in the file \`testfile\'
--## have not been clobbered by whatever means were used to copy and
--## distribute Emacs.  If they were clobbered, all the .elc files were
--## clobbered too.
--test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
--      $(CC) ${ALL_CFLAGS} -o test-distrib${EXEEXT} ${srcdir}/test-distrib.c
--      ./test-distrib ${srcdir}/testfile
--
- ../lib/libgnu.a: $(config_h)
-       cd ../lib && $(MAKE) libgnu.a
diff --git a/packages/emacs/lisp-loadup.el.patch.beforehostbuild b/packages/emacs/lisp-loadup.el.patch.beforehostbuild
new file mode 100644 (file)
index 0000000..d767362
--- /dev/null
@@ -0,0 +1,32 @@
+diff -u -r ../emacs-25.0.92/lisp/loadup.el ./lisp/loadup.el
+--- ../emacs-25.0.92/lisp/loadup.el    2016-03-02 05:21:42.000000000 -0500
++++ ./lisp/loadup.el   2016-03-25 21:40:48.314906360 -0400
+@@ -1,3 +1,7 @@
++;; Termux patch: See
++;; https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-03/msg00471.html
++(setq-default bidi-display-reordering nil)
++
+ ;;; loadup.el --- load up standardly loaded Lisp files for Emacs
+ ;; Copyright (C) 1985-1986, 1992, 1994, 2001-2016 Free Software
+@@ -110,6 +114,12 @@
+ (load "format")
+ (load "bindings")
+ (load "window")  ; Needed here for `replace-buffer-in-windows'.
++;; Termux patch: See
++;; https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-03/msg00679.html
++;; We are now capable of resizing the mini-windows, so give the
++;; variable its advertised default value (it starts as nil, see
++;; xdisp.c).
++(setq resize-mini-windows 'grow-only)
+ (setq load-source-file-function 'load-with-code-conversion)
+ (load "files")
+@@ -465,3 +475,7 @@
+ ;; End:
+ ;;; loadup.el ends here
++
++;; Termux patch: See
++;; https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-03/msg00471.html
++(setq-default bidi-display-reordering t)
diff --git a/packages/emacs/lisp-subr.el.patch.beforehostbuild b/packages/emacs/lisp-subr.el.patch.beforehostbuild
new file mode 100644 (file)
index 0000000..28d90bd
--- /dev/null
@@ -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) " ")))
diff --git a/packages/emacs/lisp-term.el.patch.beforehostbuild b/packages/emacs/lisp-term.el.patch.beforehostbuild
new file mode 100644 (file)
index 0000000..e025384
--- /dev/null
@@ -0,0 +1,30 @@
+diff -u -r ../emacs-25.0.92/lisp/term.el ./lisp/term.el
+--- ../emacs-25.0.92/lisp/term.el      2016-03-02 05:21:42.000000000 -0500
++++ ./lisp/term.el     2016-03-25 22:01:42.366218150 -0400
+@@ -1346,7 +1346,7 @@
+                                          (or explicit-shell-file-name
+                                              (getenv "ESHELL")
+                                              (getenv "SHELL")
+-                                             "/bin/sh"))))
++                                             "@TERMUX_PREFIX@/bin/sh"))))
+   (set-buffer (make-term "terminal" program))
+   (term-mode)
+   (term-char-mode)
+@@ -1466,7 +1466,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)
+@@ -4108,7 +4108,7 @@
+                                          (or explicit-shell-file-name
+                                              (getenv "ESHELL")
+                                              (getenv "SHELL")
+-                                             "/bin/sh"))))
++                                             "@TERMUX_PREFIX@/bin/sh"))))
+   ;; Pick the name of the new buffer.
+   (setq term-ansi-buffer-name
diff --git a/packages/emacs/site-init.el b/packages/emacs/site-init.el
new file mode 100644 (file)
index 0000000..064a308
--- /dev/null
@@ -0,0 +1,2 @@
+; Enable terminal mouse events:
+(xterm-mouse-mode 1)
diff --git a/packages/emacs/src-Makefile.in.patch b/packages/emacs/src-Makefile.in.patch
deleted file mode 100644 (file)
index b1e2f30..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-diff -u -r ../emacs-24.5/src/Makefile.in ./src/Makefile.in
---- ../emacs-24.5/src/Makefile.in      2015-04-02 03:23:06.000000000 -0400
-+++ ./src/Makefile.in  2015-08-03 19:25:48.870287123 -0400
-@@ -434,10 +434,7 @@
-         rm -f emacs$(EXEEXT); \
-         ln temacs$(EXEEXT) emacs$(EXEEXT); \
-       else \
--        LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \
--        test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \
--        rm -f bootstrap-emacs$(EXEEXT); \
--        ln emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
-+        cp temacs emacs; \
-       fi
- ## We run make-docfile twice because the command line may get too long
diff --git a/packages/emacs/src-callproc.c.patch b/packages/emacs/src-callproc.c.patch
new file mode 100644 (file)
index 0000000..032c143
--- /dev/null
@@ -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;
diff --git a/packages/emacs/src-xdisp.c.patch b/packages/emacs/src-xdisp.c.patch
new file mode 100644 (file)
index 0000000..614d66c
--- /dev/null
@@ -0,0 +1,21 @@
+See https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-03/msg00679.html
+
+The other part of that patch is in lisp-loadup.el.patch
+
+diff -u -r ../emacs-25.0.92/src/xdisp.c ./src/xdisp.c
+--- ../emacs-25.0.92/src/xdisp.c       2016-03-02 05:21:43.000000000 -0500
++++ ./src/xdisp.c      2016-03-25 21:25:36.960819633 -0400
+@@ -31598,7 +31598,12 @@
+ A value of `grow-only', the default, means let mini-windows grow only;
+ they return to their normal size when the minibuffer is closed, or the
+ echo area becomes empty.  */);
+-  Vresize_mini_windows = Qgrow_only;
++  /* Contrary to the doc string, we initialize this to nil, so that
++     loading loadup.el won't try to resize windows before loading
++     window.el, where some functions we need to call for this live.
++     We assign the 'grow-only' value right after loading window.el
++     during loadup.  */
++  Vresize_mini_windows = Qnil;
+   DEFVAR_LISP ("blink-cursor-alist", Vblink_cursor_alist,
+     doc: /* Alist specifying how to blink the cursor off.
diff --git a/packages/emacs/unexelf.c.patch b/packages/emacs/unexelf.c.patch
deleted file mode 100644 (file)
index 724d473..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -u -r ../emacs-24.4/src/unexelf.c ./src/unexelf.c
---- ../emacs-24.4/src/unexelf.c        2014-03-21 01:34:40.000000000 -0400
-+++ ./src/unexelf.c    2015-01-01 15:26:13.000318635 -0500
-@@ -1323,7 +1323,7 @@
-   if (stat (new_name, &stat_buf) != 0)
-     fatal ("Can't stat (%s): %s", new_name, strerror (errno));
--  mask = umask (777);
-+  mask = umask (0777);
-   umask (mask);
-   stat_buf.st_mode |= 0111 & ~mask;
-   if (chmod (new_name, stat_buf.st_mode) != 0)