From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1226343-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id D63361382C5
	for <garchives@archives.gentoo.org>; Sat, 28 Nov 2020 12:19:37 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 1ED61E0814;
	Sat, 28 Nov 2020 12:19:36 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id EFFB8E0814
	for <gentoo-commits@lists.gentoo.org>; Sat, 28 Nov 2020 12:19:35 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id E4D783415EE
	for <gentoo-commits@lists.gentoo.org>; Sat, 28 Nov 2020 12:19:34 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 6604A453
	for <gentoo-commits@lists.gentoo.org>; Sat, 28 Nov 2020 12:19:33 +0000 (UTC)
From: "Ulrich Müller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" <ulm@gentoo.org>
Message-ID: <1606565962.42fbfc55f945efef8291022f02051373df7a4cc5.ulm@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: app-editors/emacs/
X-VCS-Repository: repo/gentoo
X-VCS-Files: app-editors/emacs/emacs-27.1-r3.ebuild app-editors/emacs/emacs-27.1.9999-r1.ebuild app-editors/emacs/emacs-28.0.9999.ebuild
X-VCS-Directories: app-editors/emacs/
X-VCS-Committer: ulm
X-VCS-Committer-Name: Ulrich Müller
X-VCS-Revision: 42fbfc55f945efef8291022f02051373df7a4cc5
X-VCS-Branch: master
Date: Sat, 28 Nov 2020 12:19:33 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 41f46046-8d4a-47ff-aea8-496a9aa41f50
X-Archives-Hash: 4082f266e4d91ba58cc052f9cc617713

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
 }