unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Distributing packages with native emacs modules
@ 2020-10-01  8:47 Immanuel Litzroth
  2020-10-01  8:52 ` Robert Pluim
  2020-10-01 13:19 ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Immanuel Litzroth @ 2020-10-01  8:47 UTC (permalink / raw)
  To: emacs-devel

Gents,
I'm trying to figure out how to distribute a package which has some C++ code
implementing an emacs module. I'm currently not 100% clear on all that:
1) It seems the package repo's only do byte compilation of el files?

2) Are there examples or packages doing compilation of modules?

3) It would be possible to wrap the compilation of the package in an
"(eval-when-compile"
but that would be quite laborious. Is that a route that has been taken
in the past?

4) The other option is to ship the code to the user and tell him/her
to run the compilation
if the binary module isn't there yet (possible providing an elisp
function to do that).

Any thoughts?
Immanuel


-- 
-- Researching the dual problem of finding the function that has a
given point as fixpoint.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Distributing packages with native emacs modules
  2020-10-01  8:47 Distributing packages with native emacs modules Immanuel Litzroth
@ 2020-10-01  8:52 ` Robert Pluim
  2020-10-01 13:19 ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Robert Pluim @ 2020-10-01  8:52 UTC (permalink / raw)
  To: Immanuel Litzroth; +Cc: emacs-devel

>>>>> On Thu, 1 Oct 2020 10:47:16 +0200, Immanuel Litzroth <immanuel.litzroth@gmail.com> said:

    Immanuel> Gents,
    Immanuel> I'm trying to figure out how to distribute a package which has some C++ code
    Immanuel> implementing an emacs module. I'm currently not 100% clear on all that:
    Immanuel> 1) It seems the package repo's only do byte compilation of el files?

    Immanuel> 2) Are there examples or packages doing compilation of modules?

vterm at least. pdf-tools also compiles some C-code.

Robert
-- 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Distributing packages with native emacs modules
  2020-10-01  8:47 Distributing packages with native emacs modules Immanuel Litzroth
  2020-10-01  8:52 ` Robert Pluim
@ 2020-10-01 13:19 ` Stefan Monnier
  2020-10-06 21:06   ` Stephen Leake
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2020-10-01 13:19 UTC (permalink / raw)
  To: Immanuel Litzroth; +Cc: emacs-devel

> I'm trying to figure out how to distribute a package which has some C++ code
> implementing an emacs module. I'm currently not 100% clear on all that:
> 1) It seems the package repo's only do byte compilation of el files?

Yes and no: it's not the package's repository which does it, but the
`package.el` code in the Emacs program used to install the package
(i.e. it applies to all packages installed with `package.el`, whether
they come from a repository or not).

> 2) Are there examples or packages doing compilation of modules?

A few, yes.  E.g. the `emacs-tree-sitter` package.

Actually, IIUC the `ada-mode` package in GNU ELPA also kind of does
that, except I believe it uses a separate executable rather than
a module.  [ I believe the same applies to `pdf-tools`.  ]

> 3) It would be possible to wrap the compilation of the package in an
> "(eval-when-compile" but that would be quite laborious.

That's the route I recommend, tho a good option is to do it more lazily
(i.e. not when the package is byte-compiled but when it's first loaded),
and an even better one is to do it both ways.

> 4) The other option is to ship the code to the user and tell him/her
> to run the compilation
> if the binary module isn't there yet (possible providing an elisp
> function to do that).

I think you'll want a function/command for that in any case
(i.e. whether or not you run that function from
`eval-when-compile`), yes.


        Stefan




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Distributing packages with native emacs modules
  2020-10-01 13:19 ` Stefan Monnier
@ 2020-10-06 21:06   ` Stephen Leake
  2020-10-06 21:23     ` Immanuel Litzroth
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Leake @ 2020-10-06 21:06 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Immanuel Litzroth, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Actually, IIUC the `ada-mode` package in GNU ELPA also kind of does
> that, except I believe it uses a separate executable rather than
> a module.  [ I believe the same applies to `pdf-tools`.  ]

Yes. The installed package includes a file build.sh; the README
instructs the user to invoke that shell script to compile and install
the executable.

I did not try to automate invoking build.sh; this package doesn't change
often, and there are often issues with compiler version compatibility,
so requiring the user to manually invoke build.sh has not been a
problem.

It helps that this is for ada-mode and the code is written in Ada; users
of ada-mode are used to running the Ada compiler.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Distributing packages with native emacs modules
  2020-10-06 21:06   ` Stephen Leake
@ 2020-10-06 21:23     ` Immanuel Litzroth
  0 siblings, 0 replies; 5+ messages in thread
From: Immanuel Litzroth @ 2020-10-06 21:23 UTC (permalink / raw)
  To: Stephen Leake; +Cc: Stefan Monnier, emacs-devel

Thanks for the helpful messages, I think I'm going to go with the
solution in the
pdftools package of compiling the module (in their case it's a program
I think) when
the user first tries to load the file.
Immanuel

On Tue, Oct 6, 2020 at 11:06 PM Stephen Leake
<stephen_leake@stephe-leake.org> wrote:
>
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
> > Actually, IIUC the `ada-mode` package in GNU ELPA also kind of does
> > that, except I believe it uses a separate executable rather than
> > a module.  [ I believe the same applies to `pdf-tools`.  ]
>
> Yes. The installed package includes a file build.sh; the README
> instructs the user to invoke that shell script to compile and install
> the executable.
>
> I did not try to automate invoking build.sh; this package doesn't change
> often, and there are often issues with compiler version compatibility,
> so requiring the user to manually invoke build.sh has not been a
> problem.
>
> It helps that this is for ada-mode and the code is written in Ada; users
> of ada-mode are used to running the Ada compiler.
>
> --
> -- Stephe



-- 
-- Researching the dual problem of finding the function that has a
given point as fixpoint.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-06 21:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-01  8:47 Distributing packages with native emacs modules Immanuel Litzroth
2020-10-01  8:52 ` Robert Pluim
2020-10-01 13:19 ` Stefan Monnier
2020-10-06 21:06   ` Stephen Leake
2020-10-06 21:23     ` Immanuel Litzroth

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).