From 1cfd2bcc847526af3f476adab0703b20d6184104 Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Samaniego Date: Wed, 30 Aug 2023 00:25:17 -0600 Subject: emacs: update to 29.1 - Rebase (and rename) use-emacs-native-tools-for-cross-compiling.patch - Build bootstrap-emacs for emacs-native - Use bootstrap-emacs (native) for cross compiling. - We need to pass EMACSLOADPATH and EMACSDATA so we can control the directories being used by bootstrap-emacs. - Create avoid-running-host-binaries-for-sanity.patch to avoid running the newly integrated santity-check by emacs since it tries to run target binaries on the host. - Fix emacs-minimal packaging for new version. Signed-off-by: Alejandro Hernandez Samaniego Signed-off-by: Khem Raj --- .../avoid-running-host-binaries-for-sanity.patch | 38 ++++++++ ...se-emacs-native-tools-for-cross-compiling.patch | 106 +++++++++++++++++++++ .../emacs/files/usemake-docfile-native.patch | 85 ----------------- 3 files changed, 144 insertions(+), 85 deletions(-) create mode 100644 meta-oe/recipes-support/emacs/files/avoid-running-host-binaries-for-sanity.patch create mode 100644 meta-oe/recipes-support/emacs/files/use-emacs-native-tools-for-cross-compiling.patch delete mode 100644 meta-oe/recipes-support/emacs/files/usemake-docfile-native.patch (limited to 'meta-oe/recipes-support/emacs/files') diff --git a/meta-oe/recipes-support/emacs/files/avoid-running-host-binaries-for-sanity.patch b/meta-oe/recipes-support/emacs/files/avoid-running-host-binaries-for-sanity.patch new file mode 100644 index 0000000000..719ee4bce9 --- /dev/null +++ b/meta-oe/recipes-support/emacs/files/avoid-running-host-binaries-for-sanity.patch @@ -0,0 +1,38 @@ +Upstream-Status: Inappropriate [OE-Specific] + +Emacs introduced a sanity-check for the build artifacts, where it +runs the newly built emacs to perform some checks. + +This is not going to work for us since we are cross-compiling, +we need to avoid running target binaries on the host + +Signed-off-by: Alejandro Hernandez Samaniego + +Index: emacs-29.1/Makefile.in +=================================================================== +--- emacs-29.1.orig/Makefile.in ++++ emacs-29.1/Makefile.in +@@ -416,19 +416,10 @@ advice-on-failure: + @exit ${exit-status} + + sanity-check: +- @[ -f .no-advice-on-failure ] && exit 0; true +- @v=$$(src/emacs${EXEEXT} --batch --eval \ +- '(progn (defun f (n) (if (= 0 n) 1 (* n (f (- n 1))))) (princ (f 10)))' \ +- 2> /dev/null); \ +- [ "X$$v" = "X3628800" ] && exit 0; \ +- echo >&2 '***'; \ +- echo >&2 '*** '"\"make ${make-target}\" succeeded, but Emacs is not functional."; \ +- echo >&2 '***'; \ +- cat Makefile | \ +- sed -n '/^# ADVICE-ON-FAILURE-BEGIN:${make-target}/,$${p;/^# ADVICE-ON-FAILURE-END:${make-target}/q;};' | \ +- sed 's/^# /*** /' | grep -v '^\*\*\* ADVICE-ON-FAILURE-' >&2; \ +- echo >&2 '***'; \ +- exit 1 ++# The Makefile will try to call the newly built emacs to perform some checks ++# this is not going to work since it was (probably) built for a different architecture. ++# Avoid calling target binaries from the host and simply assume our build artifacts work. ++ exit 0 + + .PHONY: all ${SUBDIR} blessmail epaths-force epaths-force-w32 epaths-force-ns-self-contained etc-emacsver + diff --git a/meta-oe/recipes-support/emacs/files/use-emacs-native-tools-for-cross-compiling.patch b/meta-oe/recipes-support/emacs/files/use-emacs-native-tools-for-cross-compiling.patch new file mode 100644 index 0000000000..df5e4bd258 --- /dev/null +++ b/meta-oe/recipes-support/emacs/files/use-emacs-native-tools-for-cross-compiling.patch @@ -0,0 +1,106 @@ +Upstream-Status: Inappropriate [OE-Specific] + +When building emacs, it builds some tools for the HOST +that are then used to build for target, such as +make-fingerprint and make-docfile and bootstrap-emacs, +this needs to be adapted to be used by bitbake, otherwise +the compiled executables arent compatible with the HOST. + +We also need to be able to use emacs env variables to +control how bootstrap-emacs is used when cross-compiling. + +Use the above mentioned tools provided by the native +version of the recipe instead. + +Signed-off-by: Alejandro Enedino Hernandez Samaniego + +Index: emacs-29.1/src/Makefile.in +=================================================================== +--- emacs-29.1.orig/src/Makefile.in ++++ emacs-29.1/src/Makefile.in +@@ -1,3 +1,4 @@ ++ + ### @configure_input@ + + # Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2023 Free Software +@@ -508,7 +509,7 @@ ifeq ($(CHECK_STRUCTS),true) + pdumper.o: dmpstruct.h + endif + dmpstruct.h: $(srcdir)/dmpstruct.awk +-dmpstruct.h: $(libsrc)/make-fingerprint$(EXEEXT) $(dmpstruct_headers) ++dmpstruct.h: $(dmpstruct_headers) + $(AM_V_GEN)POSIXLY_CORRECT=1 awk -f $(srcdir)/dmpstruct.awk \ + $(dmpstruct_headers) > $@ + +@@ -610,8 +611,7 @@ SYSTEM_TYPE = @SYSTEM_TYPE@ + ## 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) \ +- lisp.mk $(etc)/DOC $(lisp) \ ++emacs$(EXEEXT): lisp.mk $(etc)/DOC $(lisp) \ + $(lispsource)/international/charprop.el ${charsets} + ifeq ($(SYSTEM_TYPE),cygwin) + find ${top_builddir} -name '*.eln' | rebase -v -O -T - +@@ -654,7 +654,7 @@ endif + $(etc)/DOC: $(libsrc)/make-docfile$(EXEEXT) $(doc_obj) + $(AM_V_GEN)$(MKDIR_P) $(etc) + $(AM_V_at)rm -f $(etc)/DOC +- $(AM_V_at)$(libsrc)/make-docfile -d $(srcdir) \ ++ make-docfile -d $(srcdir) \ + $(SOME_MACHINE_OBJECTS) $(doc_obj) > $(etc)/DOC + + $(libsrc)/make-docfile$(EXEEXT) $(libsrc)/make-fingerprint$(EXEEXT): \ +@@ -671,7 +671,7 @@ buildobj.h: Makefile + GLOBAL_SOURCES = $(base_obj:.o=.c) $(NS_OBJC_OBJ:.o=.m) + + gl-stamp: $(libsrc)/make-docfile$(EXEEXT) $(GLOBAL_SOURCES) +- $(AM_V_GLOBALS)$(libsrc)/make-docfile -d $(srcdir) -g $(doc_obj) > globals.tmp ++ make-docfile -d $(srcdir) -g $(doc_obj) > globals.tmp + $(AM_V_at)$(top_srcdir)/build-aux/move-if-change globals.tmp globals.h + $(AM_V_at)echo timestamp > $@ + +@@ -685,7 +685,7 @@ $(LIBEGNU_ARCHIVE): $(config_h) + $(MAKE) -C $(dir $@) all + + ifeq ($(HAVE_PDUMPER),yes) +-MAKE_PDUMPER_FINGERPRINT = $(libsrc)/make-fingerprint$(EXEEXT) ++MAKE_PDUMPER_FINGERPRINT = make-fingerprint + else + MAKE_PDUMPER_FINGERPRINT = + endif +Index: emacs-29.1/lisp/Makefile.in +=================================================================== +--- emacs-29.1.orig/lisp/Makefile.in ++++ emacs-29.1/lisp/Makefile.in +@@ -53,7 +53,7 @@ FIND_DELETE = @FIND_DELETE@ + # We never change directory before running Emacs, so a relative file + # name is fine, and makes life easier. If we need to change + # directory, we can use emacs --chdir. +-EMACS = ../src/emacs${EXEEXT} ++EMACS = bootstrap-emacs + + # Command line flags for Emacs. + +@@ -109,7 +109,7 @@ MAIN_FIRST = ./emacs-lisp/eieio.el ./ema + ./org/oc.el ./org/ol.el ./emacs-lisp/cl-lib.el + + # Prevent any settings in the user environment causing problems. +-unexport EMACSDATA EMACSDOC EMACSLOADPATH EMACSPATH ++unexport EMACSDOC EMACSPATH + + # The actual Emacs command run in the targets below. + emacs = '$(EMACS)' $(EMACSOPT) +Index: emacs-29.1/Makefile.in +=================================================================== +--- emacs-29.1.orig/Makefile.in ++++ emacs-29.1/Makefile.in +@@ -328,7 +328,7 @@ GLIB_COMPILE_SCHEMAS = glib-compile-sche + TRANSFORM = @program_transform_name@ + + # Prevent any settings in the user environment causing problems. +-unexport EMACSDATA EMACSDOC EMACSLOADPATH EMACSPATH ++unexport EMACSDOC EMACSPATH + + # What emacs should be called when installed. + EMACS_NAME = `echo emacs | sed '$(TRANSFORM)'` diff --git a/meta-oe/recipes-support/emacs/files/usemake-docfile-native.patch b/meta-oe/recipes-support/emacs/files/usemake-docfile-native.patch deleted file mode 100644 index 95b4281836..0000000000 --- a/meta-oe/recipes-support/emacs/files/usemake-docfile-native.patch +++ /dev/null @@ -1,85 +0,0 @@ -Upstream-Status: Inappropriate [OE-Specific] - -When building emacs, it builds some tools for the HOST -that are then used to build for target, such as -make-fingerprint and make-docfile, this needs to be -adapted to be used by bitbake, otherwise the compiled -executables arent compatible with the HOST. - -Use the above mentioned tools provided by the native -version of the recipe instead. - -Signed-off-by: Alejandro Enedino Hernandez Samaniego - -Index: emacs-28.2/src/Makefile.in -=================================================================== ---- emacs-28.2.orig/src/Makefile.in -+++ emacs-28.2/src/Makefile.in -@@ -462,7 +462,7 @@ ifeq ($(CHECK_STRUCTS),true) - pdumper.o: dmpstruct.h - endif - dmpstruct.h: $(srcdir)/dmpstruct.awk --dmpstruct.h: $(libsrc)/make-fingerprint$(EXEEXT) $(dmpstruct_headers) -+dmpstruct.h: $(dmpstruct_headers) - $(AM_V_GEN)POSIXLY_CORRECT=1 awk -f $(srcdir)/dmpstruct.awk \ - $(dmpstruct_headers) > $@ - -@@ -563,8 +563,7 @@ SYSTEM_TYPE = @SYSTEM_TYPE@ - ## 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) \ -- lisp.mk $(etc)/DOC $(lisp) \ -+emacs$(EXEEXT): lisp.mk $(etc)/DOC $(lisp) \ - $(lispsource)/international/charprop.el ${charsets} - ifeq ($(SYSTEM_TYPE),cygwin) - find ${top_builddir} -name '*.eln' | rebase -v -O -T - -@@ -597,15 +596,15 @@ endif - ## for the first time, this prevents any variation between configurations - ## in the contents of the DOC file. - ## --$(etc)/DOC: lisp.mk $(libsrc)/make-docfile$(EXEEXT) $(obj) $(lisp) -+$(etc)/DOC: lisp.mk $(obj) $(lisp) - $(AM_V_GEN)$(MKDIR_P) $(etc) - $(AM_V_at)rm -f $(etc)/DOC -- $(AM_V_at)$(libsrc)/make-docfile -d $(srcdir) \ -+ make-docfile -d $(srcdir) \ - $(SOME_MACHINE_OBJECTS) $(obj) > $(etc)/DOC -- $(AM_V_at)$(libsrc)/make-docfile -a $(etc)/DOC -d $(lispsource) \ -+ make-docfile -a $(etc)/DOC -d $(lispsource) \ - $(shortlisp) - --$(libsrc)/make-docfile$(EXEEXT) $(libsrc)/make-fingerprint$(EXEEXT): \ -+$(libsrc)/make-fingerprint$(EXEEXT): \ - $(lib)/libgnu.a - $(MAKE) -C $(dir $@) $(notdir $@) - -@@ -618,8 +617,8 @@ buildobj.h: Makefile - - GLOBAL_SOURCES = $(base_obj:.o=.c) $(NS_OBJC_OBJ:.o=.m) - --gl-stamp: $(libsrc)/make-docfile$(EXEEXT) $(GLOBAL_SOURCES) -- $(AM_V_GLOBALS)$(libsrc)/make-docfile -d $(srcdir) -g $(obj) > globals.tmp -+gl-stamp: $(GLOBAL_SOURCES) -+ make-docfile -d $(srcdir) -g $(obj) > globals.tmp - $(AM_V_at)$(top_srcdir)/build-aux/move-if-change globals.tmp globals.h - $(AM_V_at)echo timestamp > $@ - -@@ -633,7 +632,7 @@ $(LIBEGNU_ARCHIVE): $(config_h) - $(MAKE) -C $(dir $@) all - - ifeq ($(HAVE_PDUMPER),yes) -- MAKE_PDUMPER_FINGERPRINT = $(libsrc)/make-fingerprint$(EXEEXT) -+ MAKE_PDUMPER_FINGERPRINT = make-fingerprint - else - MAKE_PDUMPER_FINGERPRINT = - endif -@@ -643,7 +642,7 @@ endif - ## This goes on to affect various things, and the emacs binary fails - ## to start if Vinstallation_directory has the wrong value. - temacs$(EXEEXT): $(LIBXMENU) $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(EMACSRES) \ -- $(charsets) $(charscript) ${emoji-zwj} $(MAKE_PDUMPER_FINGERPRINT) -+ $(charsets) $(charscript) ${emoji-zwj} - $(AM_V_CCLD)$(CC) -o $@.tmp \ - $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \ - $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES) -- cgit v1.2.3-54-g00ecf