Skip to content

Commit

Permalink
emacs: Update and patch more
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fornwall committed Mar 26, 2016
1 parent 2a86d5d commit 8ce98d7
Show file tree
Hide file tree
Showing 11 changed files with 138 additions and 109 deletions.
12 changes: 0 additions & 12 deletions packages/emacs/Makefile.in.patch

This file was deleted.

63 changes: 20 additions & 43 deletions packages/emacs/build.sh
Original file line number Diff line number Diff line change
@@ -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 () {
Expand All @@ -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/
}

27 changes: 0 additions & 27 deletions packages/emacs/lib-src-Makefile.in.patch

This file was deleted.

32 changes: 32 additions & 0 deletions packages/emacs/lisp-loadup.el.patch.beforehostbuild
Original file line number Diff line number Diff line change
@@ -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)
21 changes: 21 additions & 0 deletions packages/emacs/lisp-subr.el.patch.beforehostbuild
Original file line number Diff line number Diff line change
@@ -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) " ")))
30 changes: 30 additions & 0 deletions packages/emacs/lisp-term.el.patch.beforehostbuild
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions packages/emacs/site-init.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
; Enable terminal mouse events:
(xterm-mouse-mode 1)
15 changes: 0 additions & 15 deletions packages/emacs/src-Makefile.in.patch

This file was deleted.

12 changes: 12 additions & 0 deletions packages/emacs/src-callproc.c.patch
Original file line number Diff line number Diff line change
@@ -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;
21 changes: 21 additions & 0 deletions packages/emacs/src-xdisp.c.patch
Original file line number Diff line number Diff line change
@@ -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.
12 changes: 0 additions & 12 deletions packages/emacs/unexelf.c.patch

This file was deleted.

0 comments on commit 8ce98d7

Please sign in to comment.