| 1 | #!/usr/bin/env bash | 
 
 
 
 
 | 2 | set -e | 
 
 
 
 
 | 3 |  | 
 
 
 
 
 | 4 | # This script creates a very minimal MSYS2 build environment that can be | 
 
 
 
 
 | 5 | # distributed with the Daodan source code, allowing 1-click builds with | 
 
 
 
 
 | 6 | # mingw-build.bat. It must be ran from an existing MSYS2 environment. | 
 
 
 
 
 | 7 |  | 
 
 
 
 
 | 8 | if [[ $(uname -o) != 'Msys' ]]; then | 
 
 
 
 
 | 9 | printf >&2 'This script must be ran from an MSYS2 environment\n' | 
 
 
 
 
 | 10 | exit 1 | 
 
 
 
 
 | 11 | fi | 
 
 
 
 
 | 12 |  | 
 
 
 
 
 | 13 | cd "$(dirname -- "$0")" | 
 
 
 
 
 | 14 | root="$PWD/MSYS2" | 
 
 
 
 
 | 15 |  | 
 
 
 
 
 | 16 | rm -rf -- "$root" | 
 
 
 
 
 | 17 | mkdir -p -- "$root/var/lib/pacman" | 
 
 
 
 
 | 18 | pacman --noconfirm --root="$root" -Sy --needed bash | 
 
 
 
 
 | 19 | pacman --noconfirm --root="$root" -S --needed coreutils | 
 
 
 
 
 | 20 | pacman --noconfirm --root="$root" -S --needed make mingw-w64-i686-gcc | 
 
 
 
 
 | 21 | touch -- "$root/tmp/.keep" | 
 
 
 
 
 | 22 | rm -rf -- "$root/var/lib/pacman" |