[bug#65478,emacs-team] gnu: emacs-flim-lb: Explicitly compile files to bytecode.

Message ID 5629f5f427c30caa6d43f37ac28c3dd3f1501d01.1692813553.git.hako@ultrarare.space
State New
Headers
Series [bug#65478,emacs-team] gnu: emacs-flim-lb: Explicitly compile files to bytecode. |

Commit Message

Hilton Chain Aug. 23, 2023, 6 p.m. UTC
* gnu/packages/emacs-xyz.scm (emacs-flim-lb)[#:phases]: Replace 'build phase
to byte compile files explicitly.
---
 gnu/packages/emacs-xyz.scm | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)


base-commit: d58c6e25ff3d1e70fd9b0e07bdad1b335de8a979
  

Comments

Liliana Marie Prikler Aug. 27, 2023, 6:24 a.m. UTC | #1
Am Donnerstag, dem 24.08.2023 um 02:00 +0800 schrieb Hilton Chain:
> * gnu/packages/emacs-xyz.scm (emacs-flim-lb)[#:phases]: Replace
> 'build phase to byte compile files explicitly.
> ---
Why do we need this?  If it's to disable native compilation, please add
a file-local variable to do so.

Cheers
  
Hilton Chain Aug. 27, 2023, 12:52 p.m. UTC | #2
On Sun, 27 Aug 2023 14:24:01 +0800,
Liliana Marie Prikler wrote:
>
> Am Donnerstag, dem 24.08.2023 um 02:00 +0800 schrieb Hilton Chain:
> > * gnu/packages/emacs-xyz.scm (emacs-flim-lb)[#:phases]: Replace
> > 'build phase to byte compile files explicitly.
> > ---
> Why do we need this?  If it's to disable native compilation, please add
> a file-local variable to do so.

I have tested the package on Emacs 28 and 29 with combinations of elc
or eln files in the output, and byte-compiled elc files seem to be a
requirement to use it -- otherwise the error would occur.  Disabling
native compilation won't help...
  
Liliana Marie Prikler Aug. 27, 2023, 3:13 p.m. UTC | #3
Am Sonntag, dem 27.08.2023 um 20:52 +0800 schrieb Hilton Chain:
> On Sun, 27 Aug 2023 14:24:01 +0800,
> Liliana Marie Prikler wrote:
> > 
> > Am Donnerstag, dem 24.08.2023 um 02:00 +0800 schrieb Hilton Chain:
> > > * gnu/packages/emacs-xyz.scm (emacs-flim-lb)[#:phases]: Replace
> > > 'build phase to byte compile files explicitly.
> > > ---
> > Why do we need this?  If it's to disable native compilation, please
> > add a file-local variable to do so.
> 
> I have tested the package on Emacs 28 and 29 with combinations of elc
> or eln files in the output, and byte-compiled elc files seem to be a
> requirement to use it -- otherwise the error would occur.  Disabling
> native compilation won't help...
How is your phase functionally different from disabling native
compilation?  IIUC, it deletes all pre-existing bytecode and native
code and then runs bytecode compilation.  Where do these elc and eln
files even come from?
  
Hilton Chain Aug. 27, 2023, 3:39 p.m. UTC | #4
On Sun, 27 Aug 2023 23:13:44 +0800,
Liliana Marie Prikler wrote:
>
> Am Sonntag, dem 27.08.2023 um 20:52 +0800 schrieb Hilton Chain:
> > On Sun, 27 Aug 2023 14:24:01 +0800,
> > Liliana Marie Prikler wrote:
> > >
> > > Am Donnerstag, dem 24.08.2023 um 02:00 +0800 schrieb Hilton Chain:
> > > > * gnu/packages/emacs-xyz.scm (emacs-flim-lb)[#:phases]: Replace
> > > > 'build phase to byte compile files explicitly.
> > > > ---
> > > Why do we need this?  If it's to disable native compilation, please
> > > add a file-local variable to do so.
> >
> > I have tested the package on Emacs 28 and 29 with combinations of elc
> > or eln files in the output, and byte-compiled elc files seem to be a
> > requirement to use it -- otherwise the error would occur.  Disabling
> > native compilation won't help...
> How is your phase functionally different from disabling native
> compilation?  IIUC, it deletes all pre-existing bytecode and native
> code and then runs bytecode compilation.  Where do these elc and eln
> files even come from?

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.
  
Liliana Marie Prikler Aug. 27, 2023, 3:49 p.m. UTC | #5
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?
  

Patch

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 412ace373e..ecdfa235c7 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -37655,6 +37655,24 @@  (define-public emacs-flim-lb
                  (base32
                   "1wsnipyl3blldcl8ynmpj1mxfvl7kjmxd8gapl83vqd3r0l9cr6q"))))
       (build-system emacs-build-system)
+      (arguments
+       (list
+        #:phases
+        #~(modify-phases %standard-phases
+            ;; FIXME: Following error occurs when native compiled:
+            ;; condition-case: Eager macro-expansion failure: (void-variable
+            ;; eof-block-branches).
+            (replace 'build
+              ;; Copied from emacs-build-system's build phase, with
+              ;; `emacs-compile-directory' replaced to
+              ;; `emacs-byte-compile-directory'.
+              (lambda* (#:key outputs inputs #:allow-other-keys)
+                (for-each delete-file (find-files "." "\\.el[cn]$"))
+                (let* ((emacs (search-input-file inputs "/bin/emacs"))
+                       (out (assoc-ref outputs "out")))
+                  (setenv "SHELL" "sh")
+                  (parameterize ((%emacs emacs))
+                    (emacs-byte-compile-directory (elpa-directory out)))))))))
       (propagated-inputs (list emacs-apel-lb emacs-oauth2))
       (home-page "https://www.emacswiki.org/emacs/WanderLust")
       (synopsis
@@ -37694,9 +37712,6 @@  (define-public emacs-semi-epg
 
 (define-public emacs-wanderlust
   ;; No release since Jan 15, 2010.
-  ;; FIXME: Building with emacs-next-pgtk would yield a void variable related
-  ;; macro-expansion failure at runtime, so don't rewrite emacs input of this
-  ;; package.
   (let ((version "2.15.9")
         (revision "791")
         (commit "8369b2d5170a174652294835dd9a18ed21a38cb2"))