Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update INSTALL.md - Using Junctions on Windows for Seamless Builds #3198

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
11 changes: 10 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@ code. The requirements are:

On Windows, it has been reported that installing via `MSYS2` works
[MSYS2](https://www.msys2.org/). On Windows older than Windows 8, you may need
to set an environment variable `OLD_WIN=1` or modify it in `config.mk`.
to set an environment variable `OLD_WIN=1` or modify it in `config.mk`. The idea is that
this flag makes programs see paths in the old 8.3 convention. Another way to get Idris2
built on windows is to create a junction without spaces for the ChezScheme base folder, e.g.

```sh
mklink /j C:\Chez "C:\Program Files\Chez Scheme 9.6.4"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to have the version be an environment variable, or even better: extracted from chez --version or similar? Just so we don't risk people mistyping the version, and so we don't have to update this whenever a new Chez version releases : )

Copy link
Author

@hellerim hellerim Jan 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably we are bound to manual handling. Chez Scheme appears to work through several nested cmd calls. I didn't manage to pipe its output into a file; scheme --version > chezvers.dat leaves the file empty; equally I didn't succeed to capture the output in an environment variable. But even if this worked, the junction to the old version should be removed.

In my opinion trying to fully automate updates is not worth the effort. The mklink command is well documented by Microsoft (including the command's delete option), and there is no magic: A junction is a small file which points to a folder; although the dir command produces a listing, a junction cannot be used by programs to run through the folder entries normally.
My first idea was to modify the ProgramFiles environment variable to include double quotes. It turned out that this does not work. Anyway, to keep risk low, I used a Windows virtual machine. (You can get a legal copy of Windows 11 for about 12 $.) Wouldn't this be a possibility to produce a distributable binary copy of the current version and to include this on the download page? I have no idea how much work this would mean in addition to what I experienced - apart from starting the build, the rest takes a couple of minutes which don't require anyone's presence. Running a test suite could be automated as well.

Copy link
Author

@hellerim hellerim Jan 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a solution: Copy these two lines to the file mkChezLink.cmd:

@rd C:\Chez
@for /f "tokens=1" %%i in ('dir "%ProgramFiles%\Chez*" /B /O-D') do mklink /j C:\Chez "%ProgramFiles%\%%i"

Running it will delete an existing junction and create a new one. If Chez Scheme is not installed it does nothing but display a file not found message. In case there are multiple versions it will use the latest one. If the junction does not exist, it will display an error.
Anyway, C:\Chez must be added to the system path (one-time action).

Copy link
Author

@hellerim hellerim Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the forcommand, a delimiter needs to be added. Otherwise, folder names are extracted only up to the first space. Hence:

@for /f "tokens=1 delims=:" %%i in ('dir "%ProgramFiles%\Chez*" /B /O-D') do mklink /j C:\Chez "%ProgramFiles%\%%i"

I corrected this in my fork.

```

and then to add `C:\Chez\bin\ta6nt\` to your path. Entering `make bootstrap && make install`
in the MSYS2 shell then should work without problems.

On Raspberry Pi, you can bootstrap via Racket.

Expand Down