guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

relocatable guile on windows


From: Mike Gran
Subject: relocatable guile on windows
Date: Sat, 3 Dec 2022 18:48:23 -0800

Hello Guile,

The Lisp Game Jam was a few weeks ago, and in prep, I took a stab an
making Guile work better on Windows, using MinGW MSys64 UCRT64 for
compilation. Little did I imagine that it would take a couple months
to make something servicable, so I never got around to actually making
a game.

This Guile is a fork with a lot of hacks for Windows: lack of
POSIX shell, DLL nonsense, Windows filesystem instead of FHS,
yadda yadda yadda.  The biggest hack is that of making
all the file paths relative to the guile executable, so that
it can be distributed as a single zip file or MSIX install file.

There is an MSIX installer and a Zip file of a compiled Guile at

  https://github.com/spk121/guile/releases/tag/3.0.8.1

For reasons why you shouldn't use Microsoft Windows ever, see:
https://www.gnu.org/philosophy/upgrade-windows.html

There is a README-win.txt file that explains how you might use it to
distribute a game jam game on Windows.

  https://github.com/spk121/guile/blob/reloc-package/README-win.txt

-------

This is just a hack. I am not promising to maintain it, and I'm not
sure how much of this nonsense can or should be upstreamed.  But if
you do find a problem, I guess just email me directly so we don't clog
the mailing list with discussion of non-free software.

Also, my name shows up on the MSIX installer. I'm not taking credit,
it is just that the installer requires that the publisher match the
code signing certificate.

-------

CHANGES FROM CORE GUILE

This fork from core Guile has features necessary to distribute a Guile
app on Windows.  These are some of the changes.

Almost all instances of the long integer are replaced with intptr_t,
since on 64-bit Windows, sizeof(long) < sizeof(void *), in violation
of Guile's expectations.  Largely janneke did this work, but, I added
a couple more.

To help deliver a game as a single zip or tar file, a new configure
option --enable-relative-paths is added.  This installs all of guile
into the $(prefix)/app directory, and modifies the loading logic to
search for scheme, compiled scheme, and extension files relative to
the location of the executable.  The applications and all shared
object library files are in the root of that directory.  $(prefix)/app
is just a staging directory, and that directory can be renamed and
relocated.

Since the presence of a POSIX shell is not guaranteed, the guild
script may not be usable. A binary executable version of guild, called
guile-tools, is added.  Previously, guile-tools was an alias to guild
but now it is a compiled program.

Since unpacking zip or MSIX files may not preserve timestamps,
unpacked scheme files may have more recent file timestamps than their
associated compiled scheme (*.go) files, causing a recompilation.  A
feature is added such that if a file named FINAL is present in
ccache-dir or site-ccache-dir, the files therein are not recompiled
when they have file timestamps older than their associated scheme
files.

On Windows, the fallback directory is set to a more canonical Windows
app directory

  <HOME>\AppData\Local\guile

rather than

  <HOME>\AppData\Local\.cache\guile

On Windows, before a binary extension is loaded, the $libdir and
$extensiondir paths are added to the DLL search directories.  Also the
paths in the LTDL_LIBRARY_PATH and SCM_EXTENSIONS_PATH environment
variables are added to the DLL search directories.  This helps improve
the problem with a DLL failing to load because it depends on a DLL in
a directory that has not yet been added to the DLL search directories.

On Windows, there is a new function add-dll-search-directories.

On Windows, UTF-8 locales are used and tested.  When using the UCRT
library instead of the deprecated MSVCRT libary, guile on Windows has
some UTF-8 support.

read-line now handles the alternate line endings CRLF, CR, LS and PS.
To handle CRLF, read-line may return a string line terminator.  I
guess theoretically NEL is also a line terminator, but, I ignored
that.

The HTTP read-header-line is simplfied to take advantage of CRLF
support in read-line.

By default, cmd and powershell scripts require security elevation on
Windows.  As a workaround to avoid having to make a batch file to
launch a game, if guile is called without any command line arguments,
it now searches for a file named "cmdargs.txt" in the current working
directory.  When present, it will be used as command line arguments
for executing guile.  The purpose of this is to allow someone to just
double-click on the Guile executable to launch an app without
requiring a shell script.

In "cmdargs.txt", a line that begins with '#' in the first column is
treated as a comment.  If you need a command-line argument that begins
with a '#', begin the line with a space or tab.  The first non-comment
line of "command-args.txt" is stripped of initial and terminal
whitespace and is used as the first command-line argument (argv[1]).
The 2nd non-comment line is the 2nd command-line argument (argv[2]),
etc.  If the file does not end with newline, the last line is ignored.

Regards,
Mike Gran


reply via email to

[Prev in Thread] Current Thread [Next in Thread]