#!/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