From patchwork Mon Aug 28 04:21:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 53259 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8F32427BBEA; Mon, 28 Aug 2023 05:23:13 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 2CB5D27BBE9 for ; Mon, 28 Aug 2023 05:23:12 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qaTmE-0006iH-4c; Mon, 28 Aug 2023 00:22:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qaTmD-0006i4-4s for guix-patches@gnu.org; Mon, 28 Aug 2023 00:22:57 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qaTmC-0004pF-TG for guix-patches@gnu.org; Mon, 28 Aug 2023 00:22:56 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qaTmI-0002B3-Il for guix-patches@gnu.org; Mon, 28 Aug 2023 00:23:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65478] [PATCH emacs-team] gnu: emacs-flim-lb: Explicitly compile files to bytecode. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 28 Aug 2023 04:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65478 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler Cc: 65478@debbugs.gnu.org, Andrew Tropin Received: via spool by 65478-submit@debbugs.gnu.org id=B65478.16931965498313 (code B ref 65478); Mon, 28 Aug 2023 04:23:02 +0000 Received: (at 65478) by debbugs.gnu.org; 28 Aug 2023 04:22:29 +0000 Received: from localhost ([127.0.0.1]:46631 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qaTlk-0002A0-5T for submit@debbugs.gnu.org; Mon, 28 Aug 2023 00:22:28 -0400 Received: from mail.boiledscript.com ([144.168.59.46]:46002) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qaTld-00029n-CG for 65478@debbugs.gnu.org; Mon, 28 Aug 2023 00:22:26 -0400 Date: Mon, 28 Aug 2023 12:21:30 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=dkim; t=1693196493; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KEOVlidzL5E9MB/8ChPtp7SAmls2SP3QK/nGPaYnnTo=; b=mfnGDiA9f8DsvA9XVnjuCDmfVITcoQJ/LtSgWKl2wLhU+UlvWNFvxKgA6GHYtL/5f/EPh7 KpEadLl+q93hBhqj0WP4EkiCod9+tq8XOwlv1eG6+tnEe5IEH10inoJ12poIQbzqC0MDQ+ k76EkuVPR4WFDEyDylQ9SysiMbxVvRNnMYmZtKyEmCiGUb0Xu3Wgii/Vl+qODwwBU2Jq2N xXA0/isaoAg/uzIKj7AmP2tfrWzxc4r+FKfaVyamOPzDUjO2mZwFBGQ+0iYOPsnGOh88Sw +xdnSvgFsODbgJ7X3XAAqtsamzYZqDDE18j253ixOnnqE6BsL8be7txcBRsZhA== Authentication-Results: mail.boiledscript.com; auth=pass smtp.mailfrom=hako@ultrarare.space Message-ID: <87y1hv6blh.wl-hako@ultrarare.space> In-Reply-To: <2ea4d41e810638483c6c8e9f2dbfd901ecae8c98.camel@gmail.com> References: <5629f5f427c30caa6d43f37ac28c3dd3f1501d01.1692813553.git.hako@ultrarare.space> <8735047il4.wl-hako@ultrarare.space> <00b74be565b90c6f35cc14e607141da3e3540fbe.camel@gmail.com> <871qfo7avb.wl-hako@ultrarare.space> <2ea4d41e810638483c6c8e9f2dbfd901ecae8c98.camel@gmail.com> MIME-Version: 1.0 X-Spamd-Bar: / X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Hilton Chain X-ACL-Warn: , Hilton Chain via Guix-patches X-Patchwork-Original-From: Hilton Chain via Guix-patches via From: Hilton Chain Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches On Sun, 27 Aug 2023 23:49:49 +0800, Liliana Marie Prikler wrote: > > Am Sonntag, dem 27.08.2023 um 23:39 +0800 schrieb Hilton Chain: > > Currently on master: > > > > $ guix build emacs-flim-lb > > has elc files. > > > > $ guix build emacs-flim-lb --with-input=emacs-minimal=emacs > > has elc and eln files. > > > > $ guix build emacs-flim-lb --with-input=emacs-minimal=emacs-next > > has eln files. > > > > And I tried to build it with 'build phase deleted as well.  Had them > > all tested and came to the conclusion that elc files are required. > Hmm, this sounds like a failure of emacs-build-system then. The > assumption (based on Emacs 28) had been that both bytecode and native > compilation are done with one function call. Maybe that no longer > holds? Found a change in `batch-byte+native-compile' with $ git diff emacs-28.2..emacs-29.1 lisp/emacs-lisp/comp.el --8<---------------cut here---------------start------------->8--- +(defun comp-write-bytecode-file (eln-file) + "After native compilation write the bytecode file for ELN-FILE. +Make sure that eln file is younger than byte-compiled one and +return the filename of this last. + +This function can be used only in conjuntion with +`byte+native-compile' `byte-to-native-output-buffer-file' (see +`batch-byte+native-compile')." + (pcase byte-to-native-output-buffer-file + (`(,temp-buffer . ,target-file) + (unwind-protect + (progn + (byte-write-target-file temp-buffer target-file) + ;; Touch the .eln in order to have it older than the + ;; corresponding .elc. + (when (stringp eln-file) + (set-file-times eln-file))) + (kill-buffer temp-buffer)) + target-file))) ;;;###autoload (defun batch-byte+native-compile () @@ -4221,17 +4345,16 @@ Generate .elc files in addition to the .eln files. Force the produced .eln to be outputted in the eln system directory (the last entry in `native-comp-eln-load-path') unless `native-compile-target-directory' is non-nil. If the environment -variable 'NATIVE_DISABLED' is set, only byte compile." +variable \"NATIVE_DISABLED\" is set, only byte compile." (comp-ensure-native-compiler) (if (equal (getenv "NATIVE_DISABLED") "1") (batch-byte-compile) (cl-assert (length= command-line-args-left 1)) - (let ((byte+native-compile t) - (byte-to-native-output-file nil)) - (batch-native-compile) - (pcase byte-to-native-output-file - (`(,tempfile . ,target-file) - (rename-file tempfile target-file t)))))) + (let* ((byte+native-compile t) + (byte-to-native-output-buffer-file nil) + (eln-file (car (batch-native-compile)))) + (comp-write-bytecode-file eln-file) + (setq command-line-args-left (cdr command-line-args-left))))) --8<---------------cut here---------------end--------------->8--- And the following patch should work for Emacs 29, but not 28: --8<---------------cut here---------------start------------->8--- diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm index 850b1f5f2a..6c27b186e3 100644 --- a/guix/build/emacs-utils.scm +++ b/guix/build/emacs-utils.scm @@ -138,7 +138,7 @@ (define* (emacs-compile-directory dir) (files (directory-files-recursively ,dir "\\.el$"))) (mapc (lambda (file) - (let (byte-to-native-output-file + (let (byte-to-native-output-buffer-file ;; First entry is the eln-cache of the homeless shelter, ;; second entry is the install directory. (eln-dir (and (native-comp-available-p) @@ -148,12 +148,12 @@ (define* (emacs-compile-directory dir) (comp-el-to-eln-filename file eln-dir)) (byte-compile-file file)) ;; Sadly, we can't use pcase because quasiquote works different in - ;; Emacs. See `batch-byte+native-compile' in comp.el for the - ;; actual shape of byte-to-native-output-file. - (unless (null byte-to-native-output-file) - (rename-file (car byte-to-native-output-file) - (cdr byte-to-native-output-file) - t)))) + ;; Emacs. See `comp-write-bytecode-file' in comp.el for the actual + ;; shape of byte-to-native-output-buffer-file. + (unless (null byte-to-native-output-buffer-file) + (byte-write-target-file + (car byte-to-native-output-buffer-file) + (cdr byte-to-native-output-buffer-file))))) files)) #:dynamic? #t)) --8<---------------cut here---------------end--------------->8---