From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mike Gran Newsgroups: gmane.lisp.guile.user Subject: relocatable guile on windows Date: Sat, 3 Dec 2022 18:48:23 -0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9756"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Dec 04 03:49:25 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p1f4G-0002Kf-FK for guile-user@m.gmane-mx.org; Sun, 04 Dec 2022 03:49:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p1f3U-0001pG-Sh; Sat, 03 Dec 2022 21:48:36 -0500 Original-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 1p1f3T-0001p6-Cg for guile-user@gnu.org; Sat, 03 Dec 2022 21:48:35 -0500 Original-Received: from sonic316-12.consmr.mail.bf2.yahoo.com ([74.6.130.122]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p1f3R-0002jw-EQ for guile-user@gnu.org; Sat, 03 Dec 2022 21:48:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1670122108; bh=zvvIOTiKpXbuDTofo5xS4oGokkyFcZTgQERYyDmjhgU=; h=Date:From:To:Subject:References:From:Subject:Reply-To; b=snpkx1MOENLs6dCCMs4MrILp7x0hZY1HvIVRlLNIxRBXuYTRhFS2qG5vFgO3ZHx1cN0SO/7sFC+M7ruXfdIgv2eSLz0jWe/QxbZ86trzjl8Y9gBB7M/e1O2A+GaQhixQvmOv/vQGzYyUODJvFdSPuvd5G9SJ8O0Y5QudMhVqKsPpyRFBFkOqkvJfIcmt/+BnYcYW0nukKRlCiAqynTLsJzQUOPIEU3BPJSkJB32JIwLW4JhmVwgXYqpdgpWJIlWkZ1xJtQUPDCefsvgizUQyIuqcCTpP97DbxAZewnswTtPKfdv9RPqKv+0buEFJ2rlhB9CYKydgepXR2xL9ny6iyA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1670122108; bh=IAS0/RYI0pwcA9kXpHsTEst14oxRK0L2Kb86Fx8DlQq=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=X3ASgmebXghF5VFIKy5D2SAtaZVEJahy37gJJ2xlxAde7+DCR0Qmdn4xm9G3Myast3q6TtDvHkyK55fYCQscdZt6l/46nq50Cb9eWmGvZNvxg8lGqldVwm+o78Pz229AD7+lqwu/wnNcKVh+0L88DQyZoRkr5sXH96Tuz74ACKacxNaXoTNZedEttXODL4ho2etnPPRAlnOQJLsl6tUR4iWkyxYgKS0EEEWE2t6HujdSzhnU1tCX/gnuRpdkSbiMnOQJzOi+K4OCZXLJU8r5efGQkiR51rPxOW1DE59bO/IOrjYAJPQM61WQNtLQfEHZaZSZ/2V3j4YDQYLexUMi3Q== X-YMail-OSG: .SRVhm0VM1l70_lAy_WlVJaFtCq9j5En9qm6MDKbI72U5F5LpBMFS6mCeqQSbGc QUKeXRHapuJtwXCI6zbZiR31blIMgjMEWzGFc9h8ReCDJtqkKbn1aYiA2ZcbLxPkz6izNYmfCAm9 pXLgdipPp4jskwB8JZfXAhWVyjidY2vei.oyE2I0GMGX9ijdrq06Ox1Uu.sXudgIBWDB_vWwTCVd eIBzBpyOefROIVcbId79GNp.0RIbkXxfex3isIfretPp3gsabg3ibeWSHs8XF.b27_XBOMgkBSal TkzpN2bnhvc60pxKCrZYAJgaS1Ia0yG2RAHQjZ_KTS3kaC2sw1ck.sbvN7uAtU8XQ.h.hg_Wkttx e_4QHGGwxyP48zHKtxe_VQ6ht7S_tcPEs1PYyjFSwaAz4_YPMg7JaUZLbHXAbfpqfBBoU_E.bYIX 5YqfZgkQsKKRlI7uXOfL9Sb26yO2NvWaLighPHf6PIqz1snRmwg0pmdjdDKEPPPVyzgyvV4BFPlJ F0JhU.vcz.KiNzOZtIOHbFhq7tf7cuRpyjsbfFy.v9MWhukOr6nP_Gcc9eSEFe8Nb90QQ4_wqngl LwMKaSHzywWAaVkD4v18X_Vh.pSHS5DCIyKSwYYDz4J6o8YCfVBJo3_LlZlpIhgVmHGuOS6ghzRQ mhfHnQyey4SOPxg2n84fGOcqrbsJfc3lJRHdVbh9sghYyacpyNu4yRgEZhDDc4.OXOGEFFP0emxf 8zDFmzexRZT2fvV06czW5LPXexoSQ7wWwz00KDhb2IykeoQO_HKBis7rduHnd9iWKCSiDEFrvkEh 1_9YVvH4pJyYNHbTTVNTbGmwwyjjeVmY_4S_miewTW X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.bf2.yahoo.com with HTTP; Sun, 4 Dec 2022 02:48:28 +0000 Original-Received: by hermes--production-ne1-7b69748c4d-qm42l (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID abd70e6ee489b47a2cdded1b2291e09a; Sun, 04 Dec 2022 02:48:25 +0000 (UTC) Content-Disposition: inline X-Mailer: WebService/1.1.20926 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=74.6.130.122; envelope-from=spk121@yahoo.com; helo=sonic316-12.consmr.mail.bf2.yahoo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:18759 Archived-At: 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 \AppData\Local\guile rather than \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