#!/bin/bash set -e XZ_DIR="mingw-w64-x86_64-xz" XZ_PACKAGE_VERSION_FILE="${XZ_DIR}/version" XZ_PACKAGE_VERSION="mingw-w64-x86_64-xz-5.2.5-2-any.pkg.tar.zst" if [ -f "${XZ_DIR}/version" ]; then XZ_PACKAGE_INSTALLED_VERSION=$(<$XZ_PACKAGE_VERSION_FILE) else XZ_PACKAGE_INSTALLED_VERSION="" fi if [ "${XZ_PACKAGE_VERSION}" != "${XZ_PACKAGE_INSTALLED_VERSION}" ]; then rm -rf ${XZ_DIR} mkdir ${XZ_DIR} (cd mingw-w64-x86_64-xz && \ wget -qO- https://mirror.msys2.org/mingw/mingw64/${XZ_PACKAGE_VERSION} | \ unzstd - | \ tar -xf -) echo ${XZ_PACKAGE_VERSION} > ${XZ_PACKAGE_VERSION_FILE} fi export MINGWPATHS="-Imingw-w64-x86_64-xz/mingw64/include -Lmingw-w64-x86_64-xz/mingw64/lib" case "$(uname -s)" in Linux) export CC="x86_64-w64-mingw32-gcc" export CXX="x86_64-w64-mingw32-g++" ;; MINGW*) export CC="gcc" export CXX="g++" ;; esac make clean make