Build 6.1.0 with w64devkit and make the prefix relocatable

Replace the MSYS2/UCRT64 toolchain with the portable w64devkit kit:
bootstrap a pinned kit, build with its sh/make/gcc, and keep the
compiler's temporary files inside work/.

Update upstream to 6.1.0 and add a portable-prefix patch: when the
configured prefix is gone, csc, csi, chicken, and the chicken-* tools
derive include, library, and repository paths from the running
executable.  A released zip now works wherever it is unpacked, which
it did not before.

Signed-off-by: Pavel Kulyov <kulyov.pavel@gmail.com>
This commit is contained in:
2026-11-18 00:09:31 +03:00
parent 8c25c16c79
commit 4865835943
5 changed files with 248 additions and 67 deletions

View File

@@ -2,33 +2,29 @@
Chicken (6) 4 Windows 10+.
Upstream does not ship a Windows binary. This repo keeps the MinGW patches and builds a UCRT64 prefix, then publishes that prefix as a Gitea release. CHICKEN sources are not stored here.
This repo keeps the MinGW pathes, builds a MinGW-w64 prefix with w64devkit and publishes
that prefix as a Gitea release.
## Kit
A clean Windows install is not a development machine. Start with [scoop](https://scoop.sh), then:
The build uses [w64devkit](https://github.com/skeeto/w64devkit), a portable folder with MinGW-w64 GCC, GNU make, and a POSIX shell.
```powershell
scoop install git msys2
.\ck.ps1 bootstrap
```
In the UCRT64 shell (`C:\Users\<you>\scoop\apps\msys2\current\ucrt64.exe`, or `bash` after `MSYSTEM=UCRT64`):
That downloads one pinned kit archive into `work/w64devkit`. To use a kit you already unpacked:
```sh
pacman -S --needed --noconfirm base-devel mingw-w64-ucrt-x86_64-gcc
```powershell
$env:W64DEVKIT_ROOT = 'C:\w64devkit'
```
Put `%USERPROFILE%\scoop\apps\msys2\current\ucrt64\bin` on `PATH` so `gcc` is the UCRT64 one.
Publishing reads `GITEA_TOKEN` from a gitignored `.env` in this directory:
```
GITEA_TOKEN=...
```
Nothing is added to the machine `PATH`; `ck.ps1` puts the kit on `PATH` for each command.
## Commands
```powershell
.\ck.ps1 bootstrap
.\ck.ps1 fetch-sources
.\ck.ps1 patch
.\ck.ps1 build
@@ -37,10 +33,31 @@ GITEA_TOKEN=...
.\ck.ps1 clean
```
Versions live in `chicken.json`. The script loads and saves it with `ConvertFrom-Json` and `ConvertTo-Json`. Change `upstream.version` and clear `upstream.sha256`; `fetch-sources` downloads that release and writes the hash back. `.\ck.ps1 fetch-sources -Latest` (and `publish -Latest`) instead takes whatever `https://code.call-cc.org/releases/current/` is serving and overwrites `upstream.version` and `upstream.sha256`. `revision` is the local serial in the same file. The tag is `<version>-win<revision>`.
Versions live in `chicken.json`, the script loads and saves it.
Change `upstream.version` and clear `upstream.sha256`; `fetch-sources` downloads that release and writes the hash back.
`.\ck.ps1 fetch-sources -Latest` (and `publish -Latest`) instead takes whatever
`https://code.call-cc.org/releases/current/` is serving and overwrites `upstream.version` and `upstream.sha256`.
`revision` is the local serial in the same file. The tag is `<version>-win<revision>`.
`publish` runs fetch, patch, build, and test, then uploads `work/dist/chicken-<version>-ucrt64-x86_64.zip`. If that tag already exists, publish stops. Bump `revision` to ship another build of the same upstream tarball.
`publish` runs fetch, patch, build, and test, then uploads `work/dist/chicken-<version>-mingw-x86_64.zip`.
If that tag already exists, publish stops. Bump `revision` to ship another build of the same upstream tarball.
`clean` deletes `work/` only.
`clean` deletes the sources, prefix, and dist; it keeps the toolchain in `work/w64devkit`.
`csc` in the zip still has `work/prefix` compiled into it. Consumers pass `-libdir` at wherever they unpacked the zip. Sex does that.
Publishing reads `GITEA_TOKEN` from a gitignored `.env` in this directory:
```
GITEA_TOKEN=...
```
## The zip
The release zip is relocatable: unpack it anywhere and run `bin\csc.exe`.
When the prefix it was configured with is gone, `csc`, `csi`, and the `chicken-*` tools locate
the include, library, and share directories from the running executable.
Compiling with `csc` still needs a C compiler on `PATH`: the w64devkit `bin` directory (it provides `cc` and `gcc`).
`csc -static` links a standalone executable; the default links `libchicken.dll`, which must sit next to the executable or on `PATH`.
The two MinGW patches keep MinGW's SEH `setjmp` off CHICKEN's alloca frames and make the standard
handles inheritable for `process`. The third makes the installed prefix relocatable.