Windows release binaries (x86_64) via MSYS2/MinGW
Adds a windows-latest job to the release matrix: MSYS2/MinGW-w64 toolchain, Chez 10.4.1 built from source (ta6nt), the same build-joltc flow, packaged as a zip of joltc.exe. The whole job runs in the msys2 shell so cc/xxd/paths behave; the produced binary is a plain Windows executable. Platform seams: bld-nt? with the winsock/COM/registry link set, no -rdynamic under MinGW, GetModuleFileName as the launcher's self-path on _WIN32, and built binaries (joltc itself and jolt-build outputs) normalize to a .exe suffix. workflow_dispatch added so the matrix can be dry-run without tagging; the release upload step only fires on tags. For #205.
This commit is contained in:
parent
58ef0c8fa1
commit
b2aa757af2
4 changed files with 99 additions and 14 deletions
73
.github/workflows/release.yml
vendored
73
.github/workflows/release.yml
vendored
|
|
@ -12,6 +12,7 @@ on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
|
workflow_dispatch: {} # dry-run the build matrix without tagging
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write # create/update the GitHub Release and upload assets
|
contents: write # create/update the GitHub Release and upload assets
|
||||||
|
|
@ -26,10 +27,18 @@ jobs:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
target: x86_64-linux
|
target: x86_64-linux
|
||||||
|
shell: bash
|
||||||
# No x86_64-macos: GitHub is retiring the macos-13 Intel runner (jobs
|
# No x86_64-macos: GitHub is retiring the macos-13 Intel runner (jobs
|
||||||
# queue forever). Intel Macs build from source. macos-14 is arm64.
|
# queue forever). Intel Macs build from source. macos-14 is arm64.
|
||||||
- os: macos-14
|
- os: macos-14
|
||||||
target: aarch64-macos
|
target: aarch64-macos
|
||||||
|
shell: bash
|
||||||
|
- os: windows-latest
|
||||||
|
target: x86_64-windows
|
||||||
|
shell: msys2 {0}
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: ${{ matrix.shell }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
|
|
@ -78,6 +87,54 @@ jobs:
|
||||||
if: runner.os == 'macOS'
|
if: runner.os == 'macOS'
|
||||||
run: brew install chezscheme lz4
|
run: brew install chezscheme lz4
|
||||||
|
|
||||||
|
# --- Windows: MSYS2/MinGW-w64 toolchain + Chez built from source (ta6nt).
|
||||||
|
# The whole job runs in the msys2 shell so cc/xxd/paths behave; the
|
||||||
|
# produced joltc.exe is a plain Windows binary (no MSYS runtime dep). ---
|
||||||
|
- name: Set up MSYS2 (Windows)
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
uses: msys2/setup-msys2@v2
|
||||||
|
with:
|
||||||
|
msystem: MINGW64
|
||||||
|
update: false
|
||||||
|
install: >-
|
||||||
|
git make vim unzip zip
|
||||||
|
mingw-w64-x86_64-gcc
|
||||||
|
mingw-w64-x86_64-lz4
|
||||||
|
mingw-w64-x86_64-zlib
|
||||||
|
|
||||||
|
- name: Cache Chez Scheme (Windows)
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
id: cache-chez-win
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: chez-install
|
||||||
|
key: chez-${{ runner.os }}-v10.4.1-mingw64
|
||||||
|
|
||||||
|
- name: Build Chez Scheme from source (Windows)
|
||||||
|
if: runner.os == 'Windows' && steps.cache-chez-win.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
git clone --depth 1 --branch v10.4.1 https://github.com/cisco/ChezScheme.git /tmp/chez-src
|
||||||
|
cd /tmp/chez-src
|
||||||
|
./configure --threads --installprefix="$GITHUB_WORKSPACE/chez-install"
|
||||||
|
make -j"$(nproc)"
|
||||||
|
make install
|
||||||
|
|
||||||
|
- name: Put chez on PATH (Windows)
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
run: |
|
||||||
|
printf '#!/bin/sh
|
||||||
|
exec "%s/chez-install/bin/scheme" "$@"
|
||||||
|
' "$GITHUB_WORKSPACE" > "$GITHUB_WORKSPACE/chez-install/bin/chez"
|
||||||
|
chmod +x "$GITHUB_WORKSPACE/chez-install/bin/chez"
|
||||||
|
echo "$GITHUB_WORKSPACE/chez-install/bin" >> "$GITHUB_PATH"
|
||||||
|
# cc is the build's compiler name; alias it to mingw gcc
|
||||||
|
printf '#!/bin/sh
|
||||||
|
exec gcc "$@"
|
||||||
|
' > /usr/local/bin/cc || printf '#!/bin/sh
|
||||||
|
exec gcc "$@"
|
||||||
|
' > "$GITHUB_WORKSPACE/chez-install/bin/cc"
|
||||||
|
chmod +x /usr/local/bin/cc 2>/dev/null || chmod +x "$GITHUB_WORKSPACE/chez-install/bin/cc"
|
||||||
|
|
||||||
- name: Show Chez version
|
- name: Show Chez version
|
||||||
run: chez --version
|
run: chez --version
|
||||||
|
|
||||||
|
|
@ -132,16 +189,24 @@ jobs:
|
||||||
ver="${GITHUB_REF_NAME}"
|
ver="${GITHUB_REF_NAME}"
|
||||||
name="joltc-${ver}-${{ matrix.target }}"
|
name="joltc-${ver}-${{ matrix.target }}"
|
||||||
mkdir -p "dist/${name}"
|
mkdir -p "dist/${name}"
|
||||||
cp target/release/joltc "dist/${name}/joltc"
|
|
||||||
cp README.md LICENSE "dist/${name}/"
|
cp README.md LICENSE "dist/${name}/"
|
||||||
tar -C dist -czf "dist/${name}.tar.gz" "${name}"
|
if [ "${{ runner.os }}" = "Windows" ]; then
|
||||||
( cd dist && shasum -a 256 "${name}.tar.gz" > "${name}.tar.gz.sha256" )
|
cp target/release/joltc.exe "dist/${name}/joltc.exe"
|
||||||
|
( cd dist && zip -r "${name}.zip" "${name}" && sha256sum "${name}.zip" > "${name}.zip.sha256" )
|
||||||
|
else
|
||||||
|
cp target/release/joltc "dist/${name}/joltc"
|
||||||
|
tar -C dist -czf "dist/${name}.tar.gz" "${name}"
|
||||||
|
( cd dist && shasum -a 256 "${name}.tar.gz" > "${name}.tar.gz.sha256" )
|
||||||
|
fi
|
||||||
ls -la dist
|
ls -la dist
|
||||||
|
|
||||||
- name: Upload to the GitHub Release
|
- name: Upload to the GitHub Release
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
dist/*.tar.gz
|
dist/*.tar.gz
|
||||||
dist/*.tar.gz.sha256
|
dist/*.tar.gz.sha256
|
||||||
fail_on_unmatched_files: true
|
dist/*.zip
|
||||||
|
dist/*.zip.sha256
|
||||||
|
fail_on_unmatched_files: false
|
||||||
|
|
|
||||||
|
|
@ -245,6 +245,6 @@
|
||||||
;; table so `build` can foreign-entry them to spill the bundled Chez boots. On
|
;; table so `build` can foreign-entry them to spill the bundled Chez boots. On
|
||||||
;; Linux dlsym can't see executable symbols otherwise (macOS exports them anyway).
|
;; Linux dlsym can't see executable symbols otherwise (macOS exports them anyway).
|
||||||
(bld-system (string-append
|
(bld-system (string-append
|
||||||
"cc -O2 -rdynamic -I'" bld-csv-dir "' -I'" jb-build "' '" jb-main-c "' '"
|
"cc -O2 " (if bld-nt? "" "-rdynamic ") "-I'" bld-csv-dir "' -I'" jb-build "' '" jb-main-c "' '"
|
||||||
bld-csv-dir "/libkernel.a' -o '" jb-out "' " (bld-link-libs)))
|
bld-csv-dir "/libkernel.a' -o '" jb-out "' " (bld-link-libs)))
|
||||||
(display (string-append "build-joltc: wrote " jb-out "\n"))
|
(display (string-append "build-joltc: wrote " jb-out "\n"))
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@
|
||||||
;; --- toolchain discovery ----------------------------------------------------
|
;; --- toolchain discovery ----------------------------------------------------
|
||||||
(define bld-machine (symbol->string (machine-type)))
|
(define bld-machine (symbol->string (machine-type)))
|
||||||
(define bld-osx? (bld-contains? bld-machine "osx"))
|
(define bld-osx? (bld-contains? bld-machine "osx"))
|
||||||
|
(define bld-nt? (bld-contains? bld-machine "nt"))
|
||||||
|
|
||||||
;; The Chez executable, for the isolated compile pass (see build-binary step 4).
|
;; The Chez executable, for the isolated compile pass (see build-binary step 4).
|
||||||
(define bld-chez
|
(define bld-chez
|
||||||
|
|
@ -94,14 +95,19 @@
|
||||||
|
|
||||||
;; Link flags. macOS Homebrew layout for the kernel's lz4/zlib/ncurses deps.
|
;; Link flags. macOS Homebrew layout for the kernel's lz4/zlib/ncurses deps.
|
||||||
(define (bld-link-libs)
|
(define (bld-link-libs)
|
||||||
(if bld-osx?
|
(cond
|
||||||
(let ((lz4 (bld-sh-capture "brew --prefix lz4 2>/dev/null")))
|
(bld-osx?
|
||||||
(string-append
|
(let ((lz4 (bld-sh-capture "brew --prefix lz4 2>/dev/null")))
|
||||||
(if (> (string-length lz4) 0) (string-append "-L" lz4 "/lib ") "")
|
(string-append
|
||||||
"-llz4 -lz -lncurses -framework Foundation -liconv -lm"))
|
(if (> (string-length lz4) 0) (string-append "-L" lz4 "/lib ") "")
|
||||||
;; Linux: the Chez kernel pulls in compression (lz4/z), the expression
|
"-llz4 -lz -lncurses -framework Foundation -liconv -lm")))
|
||||||
;; editor (ncurses + terminfo), threads, dlopen, libuuid, and clock_gettime.
|
;; Windows (ta6nt, MinGW-w64 under MSYS2): the Chez kernel pulls in
|
||||||
"-llz4 -lz -lncurses -ltinfo -ldl -lm -lpthread -luuid -lrt"))
|
;; compression, winsock, COM/UUID, and the registry.
|
||||||
|
(bld-nt?
|
||||||
|
"-llz4 -lz -lws2_32 -lrpcrt4 -lole32 -ladvapi32 -luser32 -lshell32 -lm")
|
||||||
|
;; Linux: the Chez kernel pulls in compression (lz4/z), the expression
|
||||||
|
;; editor (ncurses + terminfo), threads, dlopen, libuuid, and clock_gettime.
|
||||||
|
(else "-llz4 -lz -lncurses -ltinfo -ldl -lm -lpthread -luuid -lrt")))
|
||||||
|
|
||||||
;; --- runtime manifest (mirrors host/chez/cli.ss's load order) ---------------
|
;; --- runtime manifest (mirrors host/chez/cli.ss's load order) ---------------
|
||||||
;; A line is either literal Scheme text to inline, or a tag whose emission the build
|
;; A line is either literal Scheme text to inline, or a tag whose emission the build
|
||||||
|
|
@ -411,7 +417,15 @@
|
||||||
;; direct-link?: opt-in closed-world direct-linking (app->app calls bind directly,
|
;; direct-link?: opt-in closed-world direct-linking (app->app calls bind directly,
|
||||||
;; no runtime redefinition). Off by default in every mode — release stays
|
;; no runtime redefinition). Off by default in every mode — release stays
|
||||||
;; dynamically linked.
|
;; dynamically linked.
|
||||||
|
(define (bld-suffix? s suf)
|
||||||
|
(let ((n (string-length s)) (m (string-length suf)))
|
||||||
|
(and (>= n m) (string=? (substring s (- n m) n) suf))))
|
||||||
(define (build-binary entry-ns out-path mode natives embed-dirs ext-roots direct-link? tree-shake?)
|
(define (build-binary entry-ns out-path mode natives embed-dirs ext-roots direct-link? tree-shake?)
|
||||||
|
;; Windows executables carry .exe; normalize here so the append-payload and
|
||||||
|
;; cc paths agree and the shell can run the result.
|
||||||
|
(let ((out-path (if (and bld-nt? (not (bld-suffix? out-path ".exe")))
|
||||||
|
(string-append out-path ".exe")
|
||||||
|
out-path)))
|
||||||
;; The self-contained path (jolt-embedded-bytes "stub/launcher") needs no csv
|
;; The self-contained path (jolt-embedded-bytes "stub/launcher") needs no csv
|
||||||
;; kernel files, no Chez, no cc — only the legacy cc path does.
|
;; kernel files, no Chez, no cc — only the legacy cc path does.
|
||||||
(unless (jolt-embedded-bytes "stub/launcher") (bld-check-toolchain))
|
(unless (jolt-embedded-bytes "stub/launcher") (bld-check-toolchain))
|
||||||
|
|
@ -558,7 +572,7 @@
|
||||||
(build-self-contained entry-ns out-path mode builddir flat-ss flat-so boot
|
(build-self-contained entry-ns out-path mode builddir flat-ss flat-so boot
|
||||||
(bld-native-link-flags natives))
|
(bld-native-link-flags natives))
|
||||||
(build-with-cc entry-ns out-path mode builddir flat-ss flat-so boot boot-h main-c
|
(build-with-cc entry-ns out-path mode builddir flat-ss flat-so boot boot-h main-c
|
||||||
(bld-native-link-flags natives))))))))
|
(bld-native-link-flags natives)))))))))
|
||||||
|
|
||||||
;; --- self-contained link (in-process compile + append the boot to the stub) ---
|
;; --- self-contained link (in-process compile + append the boot to the stub) ---
|
||||||
;; compile-file runs against the DEFAULT interaction environment, so the boot's
|
;; compile-file runs against the DEFAULT interaction environment, so the boot's
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,12 @@ static int self_path(char *buf, uint32_t size) {
|
||||||
/* _NSGetExecutablePath fills buf and reports the needed size on overflow. */
|
/* _NSGetExecutablePath fills buf and reports the needed size on overflow. */
|
||||||
return _NSGetExecutablePath(buf, &size);
|
return _NSGetExecutablePath(buf, &size);
|
||||||
}
|
}
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
#include <windows.h>
|
||||||
|
static int self_path(char *buf, uint32_t size) {
|
||||||
|
DWORD n = GetModuleFileNameA(NULL, buf, size);
|
||||||
|
return (n == 0 || n >= size) ? -1 : 0;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
static int self_path(char *buf, uint32_t size) {
|
static int self_path(char *buf, uint32_t size) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue