unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* how to run makeinfo in a subprocess on Windows?
@ 2021-09-05 22:47 Stephen Leake
  2021-09-06  2:52 ` Stefan Monnier
  2021-09-06  5:20 ` Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: Stephen Leake @ 2021-09-05 22:47 UTC (permalink / raw)
  To: emacs-devel

I'm working on automatically publishing html doc files for ELPA
packages.

When the source for a doc is .texi, that requires running "makeinfo".
elpa-admin does this via call-process, doing something like:

(let ((default-directory "c:/Projects/elpa/packages/ada-mode/")
      (docfile "ada-mode.texi")
      (html-file "doc/ada-mode/ada-mode.html"))
  (call-process "makeinfo" docfile nil nil "--no-split" "--html" "-o" html-file))

and that works fine on Debian.

However, on Windows, I get :
let: Searching for program: Permission denied, makeinfo

I suspect the problem is that "makeinfo" is actually a perl script, and
it has "#! /usr/bin/perl" on the first line. On Debian, the lower-level
system call that actually starts the process apparently knows how to
handle that; it starts perl, and passes it "makeinfo" and the other args.

However, on Windows that doesn't happen. I suspect if I was running the
mingw64 version of Emacs, it would work. The emacs I'm running is built
using mingw64 tools, but it uses the native Windows OS, not the
mingw64 layer.

Is there a suggested way to handle this? I can just add code to
elpa-admin to run perl explicitly when on Windows, but I'm hoping
there's already code somewhere that handles this.

-- 
-- Stephe



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

* Re: how to run makeinfo in a subprocess on Windows?
  2021-09-05 22:47 how to run makeinfo in a subprocess on Windows? Stephen Leake
@ 2021-09-06  2:52 ` Stefan Monnier
  2021-09-06  5:20 ` Eli Zaretskii
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2021-09-06  2:52 UTC (permalink / raw)
  To: Stephen Leake; +Cc: emacs-devel

Stephen Leake [2021-09-05 15:47:38] wrote:
> Is there a suggested way to handle this? I can just add code to
> elpa-admin to run perl explicitly when on Windows, but I'm hoping
> there's already code somewhere that handles this.

I'd *really* prefer not to add such hacks to `elpa-admin.el`.
Especially since this code's main target is elpa.gnu.org which is
obviously not running Windows ;-)
Whether or not it works under Windows is fairly secondary, so I'd rather
not obscure its code just for the benefit of Windows.
[ It doesn't mean I'm opposed to patches targeted at adding
  support for Windows, as evidenced by some recentish changes to ignore
  errors when creating symlinks, but I'd like to keep it to a minimum,
  especially if there's a workaround like running a cygwin build of
  Emacs instead of the native build.  ]

I know very little about Windows, but my crystal ball suggests that you
need to use a different version of `makeinfo` (after all, if a native
Emacs can't launch it, there's a change that other native apps can't
either, so maybe you're running some cygwin version of it?).


        Stefan




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

* Re: how to run makeinfo in a subprocess on Windows?
  2021-09-05 22:47 how to run makeinfo in a subprocess on Windows? Stephen Leake
  2021-09-06  2:52 ` Stefan Monnier
@ 2021-09-06  5:20 ` Eli Zaretskii
  2021-09-06 16:20   ` Stephen Leake
  1 sibling, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2021-09-06  5:20 UTC (permalink / raw)
  To: Stephen Leake; +Cc: emacs-devel

> From: Stephen Leake <stephen_leake@stephe-leake.org>
> Date: Sun, 05 Sep 2021 15:47:38 -0700
> 
> When the source for a doc is .texi, that requires running "makeinfo".
> elpa-admin does this via call-process, doing something like:
> 
> (let ((default-directory "c:/Projects/elpa/packages/ada-mode/")
>       (docfile "ada-mode.texi")
>       (html-file "doc/ada-mode/ada-mode.html"))
>   (call-process "makeinfo" docfile nil nil "--no-split" "--html" "-o" html-file))
> 
> and that works fine on Debian.
> 
> However, on Windows, I get :
> let: Searching for program: Permission denied, makeinfo
> 
> I suspect the problem is that "makeinfo" is actually a perl script, and
> it has "#! /usr/bin/perl" on the first line. On Debian, the lower-level
> system call that actually starts the process apparently knows how to
> handle that; it starts perl, and passes it "makeinfo" and the other args.

Where did you get the Windows binary Texinfo distribution?  If done
right for native MS-Windows, such a binary distribution should install
on PATH the makeinfo.bat batch file in addition to makeinfo the Perl
script, and Emacs is supposed to find the batch file and invoke it
instead of the Perl script.  However, I'm not sure MSYS2/MinGW64
provide a native MinGW Texinfo package, in which case what you have is
the MSYS2 port of Texinfo, and that isn't good in general for using it
from a native w32 Emacs.

> However, on Windows that doesn't happen. I suspect if I was running the
> mingw64 version of Emacs, it would work. The emacs I'm running is built
> using mingw64 tools, but it uses the native Windows OS, not the
> mingw64 layer.

There's a terminology problem here.  MinGW64 executables are native
Windows executables, so the Emacs you are running _is_ "the mingw64
version of Emacs".  The non-native executables provided by MSYS2 are
called "MSYS2 executables", and are similar to Cygwin executables:
they need a special DLL to run on Windows, and have features and
peculiarities whose intent is to run smoothly inside Bash and interact
smoothly with other MSYS2 programs.

> Is there a suggested way to handle this? I can just add code to
> elpa-admin to run perl explicitly when on Windows, but I'm hoping
> there's already code somewhere that handles this.

The official upstream Texinfo tarball includes makeinfo.bat, so if the
binary distribution you have doesn't have it, you could try installing
that by hand and using it.  Or just write it yourself, it's very
simple:

  @echo off
  setlocal
  set TEXINFO_XS_PARSER=1
  perl "%~dpn0" %*
  endlocal

If this somehow doesn't work, try commenting out the "set" command,
maybe your Texinfo binaries were built without XS support.



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

* Re: how to run makeinfo in a subprocess on Windows?
  2021-09-06  5:20 ` Eli Zaretskii
@ 2021-09-06 16:20   ` Stephen Leake
  2021-09-06 16:56     ` Stephen Leake
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Leake @ 2021-09-06 16:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Stephen Leake <stephen_leake@stephe-leake.org>
>> I suspect the problem is that "makeinfo" is actually a perl script, and
>> it has "#! /usr/bin/perl" on the first line. On Debian, the lower-level
>> system call that actually starts the process apparently knows how to
>> handle that; it starts perl, and passes it "makeinfo" and the other args.
>
> Where did you get the Windows binary Texinfo distribution?  

From mingw64.

>> However, on Windows that doesn't happen. I suspect if I was running the
>> mingw64 version of Emacs, it would work. The emacs I'm running is built
>> using mingw64 tools, but it uses the native Windows OS, not the
>> mingw64 layer.
>
> There's a terminology problem here.  MinGW64 executables are native
> Windows executables, so the Emacs you are running _is_ "the mingw64
> version of Emacs".  The non-native executables provided by MSYS2 are
> called "MSYS2 executables", 

Ok, thanks. So the makeinfo I have is an msys2 executable.

> The official upstream Texinfo tarball includes makeinfo.bat, 

Thanks, I'll install that.

-- 
-- Stephe



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

* Re: how to run makeinfo in a subprocess on Windows?
  2021-09-06 16:20   ` Stephen Leake
@ 2021-09-06 16:56     ` Stephen Leake
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Leake @ 2021-09-06 16:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Stephen Leake <stephen_leake@stephe-leake.org> writes:

>> The official upstream Texinfo tarball includes makeinfo.bat, 
>
> Thanks, I'll install that.

For the record, I put this in file ~/bin/makeinfo.bat:

@echo off
perl d:/msys64/usr/bin/makeinfo %*

and it works from call-process.

-- 
-- Stephe



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

end of thread, other threads:[~2021-09-06 16:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-05 22:47 how to run makeinfo in a subprocess on Windows? Stephen Leake
2021-09-06  2:52 ` Stefan Monnier
2021-09-06  5:20 ` Eli Zaretskii
2021-09-06 16:20   ` Stephen Leake
2021-09-06 16:56     ` Stephen Leake

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).