#!/usr/bin/env bash # Configure, build, and install into work/prefix. Run from a UCRT64 shell. set -eu root=$(CDPATH= cd -- "$(dirname "$0")" && pwd) src="$root/work/src" prefix=$(cygpath -m "$root/work/prefix") if [ ! -f "$src/configure" ]; then echo "no sources in work/src; run: .\\ck.ps1 fetch-sources" >&2 exit 1 fi case "${MSYSTEM:-}" in UCRT64|MINGW64|CLANG64) ;; *) echo "build.sh needs an MSYS2 MinGW shell (UCRT64)." >&2 exit 1 ;; esac machine=$(gcc -dumpmachine) case "$machine" in *mingw*) ;; *) echo "gcc targets ${machine}. Install the UCRT64 toolchain." >&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) ( cd "$src" ./configure --prefix "$prefix" --platform mingw make -j"$jobs" make install ) export PATH="$(cygpath -u "$prefix")/bin:${PATH}" echo "installed $prefix" csc -version