Files
chicken6-4-win/build.sh
Pavel Kulyov 4865835943 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>
2026-11-18 00:09:31 +03:00

61 lines
1.6 KiB
Bash

#!/usr/bin/env bash
# Configure, build, and install into work/prefix.
# Run from a w64devkit shell (or let ck.ps1 provide one).
set -eu
root=$(CDPATH= cd -- "$(dirname "$0")" && pwd)
src="$root/work/src"
prefix="${CHICKEN_PREFIX:-$root/work/prefix}"
prefix=${prefix//\\//}
if [ "${1:-}" = check ]; then
PATH="$prefix/bin;$PATH"
export PATH
make -C "$src" check
exit 0
fi
if [ ! -f "$src/configure" ]; then
echo "no sources in work/src; run: .\\ck.ps1 fetch-sources" >&2
exit 1
fi
machine=$(gcc -dumpmachine)
case "$machine" in
*mingw*) ;;
*)
echo "gcc targets ${machine}. Run this from w64devkit (or .\\ck.ps1 build)." >&2
exit 1
;;
esac
# The generated posixwin.c is what this tarball compiles. Keep it newer
# than posixwin.scm so make does not try to regenerate it.
if [ -f "$src/posixwin.c" ]; then
touch "$src/posixwin.c"
fi
jobs=$(nproc 2>/dev/null || echo 1)
# Bootstrap rebuilds run "chicken" from the source directory; sh does
# not look in the current directory, so put it on PATH.
PATH="$src;$PATH"
export PATH
(
cd "$src"
./configure --prefix "$prefix" --platform mingw
# The tarball ships generated C that is newer than the Scheme sources
# it came from, and the portable-prefix patch changes two of those
# sources. Regenerating them needs the compiler those C files build,
# so build it from the shipped C first, then let it regenerate.
touch library.c csc.c chicken-install.c chicken-status.c chicken-uninstall.c
make -j"$jobs" chicken.exe
touch library.scm egg-environment.scm
make -j"$jobs"
make install
)
PATH="$prefix/bin;$PATH"
export PATH
echo "installed $prefix"
csc -version