commit:     42fbfc55f945efef8291022f02051373df7a4cc5
Author:     David Michael <fedora.dm0 <AT> gmail <DOT> com>
AuthorDate: Thu Nov 26 22:25:57 2020 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sat Nov 28 12:19:22 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=42fbfc55

app-editors/emacs: Support cross-compiling since Emacs 27

Closes: https://bugs.gentoo.org/718760
Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: David Michael <fedora.dm0 <AT> gmail.com>
[Revision bump, minor formatting tweaks]
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 ...cs-27.1.9999-r1.ebuild => emacs-27.1-r3.ebuild} | 40 ++++++++++++++++++----
 app-editors/emacs/emacs-27.1.9999-r1.ebuild        | 37 ++++++++++++++++----
 app-editors/emacs/emacs-28.0.9999.ebuild           | 37 ++++++++++++++++----
 3 files changed, 95 insertions(+), 19 deletions(-)

diff --git a/app-editors/emacs/emacs-27.1.9999-r1.ebuild 
b/app-editors/emacs/emacs-27.1-r3.ebuild
similarity index 91%
copy from app-editors/emacs/emacs-27.1.9999-r1.ebuild
copy to app-editors/emacs/emacs-27.1-r3.ebuild
index 8995971a50a..f97171f9c25 100644
--- a/app-editors/emacs/emacs-27.1.9999-r1.ebuild
+++ b/app-editors/emacs/emacs-27.1-r3.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-inherit autotools elisp-common flag-o-matic readme.gentoo-r1
+inherit autotools elisp-common flag-o-matic readme.gentoo-r1 toolchain-funcs
 
 if [[ ${PV##*.} = 9999 ]]; then
        inherit git-r3
@@ -134,6 +134,7 @@ BDEPEND="app-eselect/eselect-emacs
        gzip-el? ( app-arch/gzip )"
 
 RDEPEND="${RDEPEND}
+       !<=app-editors/emacs-27.1.9999-r0:27-vcs
        !app-editors/emacs-vcs:27
        app-eselect/eselect-emacs"
 
@@ -157,7 +158,7 @@ src_prepare() {
        # Fix filename reference in redirected man page
        sed -i -e "/^\\.so/s/etags/&-${EMACS_SUFFIX}/" doc/man/ctags.1 || die
 
-       AT_M4DIR=m4 eautoreconf
+       #AT_M4DIR=m4 eautoreconf
 }
 
 src_configure() {
@@ -261,6 +262,17 @@ src_configure() {
                fi
        fi
 
+       if tc-is-cross-compiler; then
+               # Configure a CBUILD directory when cross-compiling to make 
tools
+               mkdir "${S}-build" && pushd "${S}-build" >/dev/null || die
+               ECONF_SOURCE="${S}" econf_build --without-all 
--without-x-toolkit
+               popd >/dev/null || die
+               # Don't try to execute the binary for dumping during the build
+               myconf+=" --with-dumping=none"
+       else
+               myconf+=" --with-dumping=pdumper"
+       fi
+
        econf \
                --program-suffix="-${EMACS_SUFFIX}" \
                --includedir="${EPREFIX}"/usr/include/${EMACS_SUFFIX} \
@@ -270,8 +282,8 @@ src_configure() {
                --without-compress-install \
                --without-hesiod \
                --without-pop \
-               --with-dumping=pdumper \
                --with-file-notification=$(usev inotify || usev gfile || echo 
no) \
+               --with-pdumper \
                $(use_enable acl) \
                $(use_with dbus) \
                $(use_with dynamic-loading modules) \
@@ -292,10 +304,19 @@ src_configure() {
                ${myconf}
 }
 
-#src_compile() {
-#      # Disable sandbox when dumping. For the unbelievers, see bug #131505
-#      emake RUN_TEMACS="SANDBOX_ON=0 LD_PRELOAD= env ./temacs"
-#}
+src_compile() {
+       if tc-is-cross-compiler; then
+               # Build native tools for compiling lisp etc.
+               emake -C "${S}-build" src
+               emake lib          # Cross-compile dependencies first for 
timestamps
+               # Save native build tools in the cross-directory
+               cp "${S}-build"/lib-src/make-{docfile,fingerprint} lib-src || 
die
+               # Specify the native Emacs to compile lisp
+               emake -C lisp all EMACS="${S}-build/src/emacs"
+       fi
+
+       emake
+}
 
 src_install() {
        emake DESTDIR="${D}" NO_BIN_LINK=t BLESSMAIL_TARGET= install
@@ -401,6 +422,11 @@ src_install() {
                        \"${EPREFIX}/Applications/Gentoo\". You may want to 
copy or
                        symlink it into /Applications by yourself."
        fi
+       tc-is-cross-compiler && DOC_CONTENTS+="\\n\\nEmacs did not write
+               a portable dump file due to being cross-compiled.
+               To create this file at run time, execute the following command:
+               \\n${EMACS_SUFFIX} --batch --eval='(dump-emacs-portable
+               \"/usr/libexec/emacs/${FULL_VERSION}/${CHOST}/emacs.pdmp\")'"
        readme.gentoo_create_doc
 }
 

diff --git a/app-editors/emacs/emacs-27.1.9999-r1.ebuild 
b/app-editors/emacs/emacs-27.1.9999-r1.ebuild
index 8995971a50a..3b09fd2768c 100644
--- a/app-editors/emacs/emacs-27.1.9999-r1.ebuild
+++ b/app-editors/emacs/emacs-27.1.9999-r1.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-inherit autotools elisp-common flag-o-matic readme.gentoo-r1
+inherit autotools elisp-common flag-o-matic readme.gentoo-r1 toolchain-funcs
 
 if [[ ${PV##*.} = 9999 ]]; then
        inherit git-r3
@@ -261,6 +261,17 @@ src_configure() {
                fi
        fi
 
+       if tc-is-cross-compiler; then
+               # Configure a CBUILD directory when cross-compiling to make 
tools
+               mkdir "${S}-build" && pushd "${S}-build" >/dev/null || die
+               ECONF_SOURCE="${S}" econf_build --without-all 
--without-x-toolkit
+               popd >/dev/null || die
+               # Don't try to execute the binary for dumping during the build
+               myconf+=" --with-dumping=none"
+       else
+               myconf+=" --with-dumping=pdumper"
+       fi
+
        econf \
                --program-suffix="-${EMACS_SUFFIX}" \
                --includedir="${EPREFIX}"/usr/include/${EMACS_SUFFIX} \
@@ -270,8 +281,8 @@ src_configure() {
                --without-compress-install \
                --without-hesiod \
                --without-pop \
-               --with-dumping=pdumper \
                --with-file-notification=$(usev inotify || usev gfile || echo 
no) \
+               --with-pdumper \
                $(use_enable acl) \
                $(use_with dbus) \
                $(use_with dynamic-loading modules) \
@@ -292,10 +303,19 @@ src_configure() {
                ${myconf}
 }
 
-#src_compile() {
-#      # Disable sandbox when dumping. For the unbelievers, see bug #131505
-#      emake RUN_TEMACS="SANDBOX_ON=0 LD_PRELOAD= env ./temacs"
-#}
+src_compile() {
+       if tc-is-cross-compiler; then
+               # Build native tools for compiling lisp etc.
+               emake -C "${S}-build" src
+               emake lib          # Cross-compile dependencies first for 
timestamps
+               # Save native build tools in the cross-directory
+               cp "${S}-build"/lib-src/make-{docfile,fingerprint} lib-src || 
die
+               # Specify the native Emacs to compile lisp
+               emake -C lisp all EMACS="${S}-build/src/emacs"
+       fi
+
+       emake
+}
 
 src_install() {
        emake DESTDIR="${D}" NO_BIN_LINK=t BLESSMAIL_TARGET= install
@@ -401,6 +421,11 @@ src_install() {
                        \"${EPREFIX}/Applications/Gentoo\". You may want to 
copy or
                        symlink it into /Applications by yourself."
        fi
+       tc-is-cross-compiler && DOC_CONTENTS+="\\n\\nEmacs did not write
+               a portable dump file due to being cross-compiled.
+               To create this file at run time, execute the following command:
+               \\n${EMACS_SUFFIX} --batch --eval='(dump-emacs-portable
+               \"/usr/libexec/emacs/${FULL_VERSION}/${CHOST}/emacs.pdmp\")'"
        readme.gentoo_create_doc
 }
 

diff --git a/app-editors/emacs/emacs-28.0.9999.ebuild 
b/app-editors/emacs/emacs-28.0.9999.ebuild
index 39d49261783..e6f3ac9b344 100644
--- a/app-editors/emacs/emacs-28.0.9999.ebuild
+++ b/app-editors/emacs/emacs-28.0.9999.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-inherit autotools elisp-common flag-o-matic readme.gentoo-r1
+inherit autotools elisp-common flag-o-matic readme.gentoo-r1 toolchain-funcs
 
 if [[ ${PV##*.} = 9999 ]]; then
        inherit git-r3
@@ -260,6 +260,17 @@ src_configure() {
                fi
        fi
 
+       if tc-is-cross-compiler; then
+               # Configure a CBUILD directory when cross-compiling to make 
tools
+               mkdir "${S}-build" && pushd "${S}-build" >/dev/null || die
+               ECONF_SOURCE="${S}" econf_build --without-all 
--without-x-toolkit
+               popd >/dev/null || die
+               # Don't try to execute the binary for dumping during the build
+               myconf+=" --with-dumping=none"
+       else
+               myconf+=" --with-dumping=pdumper"
+       fi
+
        econf \
                --program-suffix="-${EMACS_SUFFIX}" \
                --includedir="${EPREFIX}"/usr/include/${EMACS_SUFFIX} \
@@ -269,8 +280,8 @@ src_configure() {
                --without-compress-install \
                --without-hesiod \
                --without-pop \
-               --with-dumping=pdumper \
                --with-file-notification=$(usev inotify || usev gfile || echo 
no) \
+               --with-pdumper \
                $(use_enable acl) \
                $(use_with dbus) \
                $(use_with dynamic-loading modules) \
@@ -291,10 +302,19 @@ src_configure() {
                ${myconf}
 }
 
-#src_compile() {
-#      # Disable sandbox when dumping. For the unbelievers, see bug #131505
-#      emake RUN_TEMACS="SANDBOX_ON=0 LD_PRELOAD= env ./temacs"
-#}
+src_compile() {
+       if tc-is-cross-compiler; then
+               # Build native tools for compiling lisp etc.
+               emake -C "${S}-build" src
+               emake lib          # Cross-compile dependencies first for 
timestamps
+               # Save native build tools in the cross-directory
+               cp "${S}-build"/lib-src/make-{docfile,fingerprint} lib-src || 
die
+               # Specify the native Emacs to compile lisp
+               emake -C lisp all EMACS="${S}-build/src/emacs"
+       fi
+
+       emake
+}
 
 src_install() {
        emake DESTDIR="${D}" NO_BIN_LINK=t BLESSMAIL_TARGET= install
@@ -400,6 +420,11 @@ src_install() {
                        \"${EPREFIX}/Applications/Gentoo\". You may want to 
copy or
                        symlink it into /Applications by yourself."
        fi
+       tc-is-cross-compiler && DOC_CONTENTS+="\\n\\nEmacs did not write
+               a portable dump file due to being cross-compiled.
+               To create this file at run time, execute the following command:
+               \\n${EMACS_SUFFIX} --batch --eval='(dump-emacs-portable
+               \"/usr/libexec/emacs/${FULL_VERSION}/${CHOST}/emacs.pdmp\")'"
        readme.gentoo_create_doc
 }
 

Reply via email to