#!/usr/bin/env bash set -e cd $(dirname $0) MSYS2DIR=`pwd`/msys2 mkdir -p $MSYS2DIR/var/lib/pacman $MSYS2DIR/msys/etc curl -L https://repo.msys2.org/msys/x86_64/pacman-mirrors-20240523-1-any.pkg.tar.zst | tar xvf - -C $MSYS2DIR --zstd curl -L https://raw.githubusercontent.com/msys2/MSYS2-packages/master/pacman/pacman.conf | \ sed -e "s|/etc/pacman.d|$MSYS2DIR/etc/pacman.d|g" -e "s|SigLevel = Required|SigLevel = Never|g" > $MSYS2DIR/etc/pacman.conf fakeroot pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf -Syy pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf \ --cachedir $MSYS2DIR/msys/cache --sync --print-format "%l %n" \ mingw-w64-clang-x86_64-cc mingw-w64-clang-x86_64-python3.11 \ mingw-w64-clang-x86_64-python-numpy \ mingw-w64-clang-x86_64-python-setuptools mingw-w64-clang-x86_64-python-build mingw-w64-clang-x86_64-python-installer > $MSYS2DIR/packages.txt cat artiq_dependencies.txt comtools_dependencies.txt pythonparser_dependencies.txt sipyco_dependencies.txt | pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf \ --cachedir $MSYS2DIR/msys/cache --sync --print-format "%l %n" - > $MSYS2DIR/artiq_dependency_packages.txt pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf --cachedir $MSYS2DIR/msys/cache \ --sync --print-format "%l %n" mingw-w64-clang-x86_64-qt-installer-framework > $MSYS2DIR/qt_ifw_packages.txt function generate_nix_packages_from_pacman() { local in=$1 local out=$2 echo "{ pkgs } : [" > $out while IFS= read -r line; do read -r url package <<< "$line" hash=$(nix-prefetch-url $url --name $package) echo " (pkgs.fetchurl { url = \"$url\"; name = \"$package\"; sha256 = \"$hash\"; })" >> $out done < $in echo "]" >> $out } generate_nix_packages_from_pacman $MSYS2DIR/packages.txt msys2_packages.nix generate_nix_packages_from_pacman $MSYS2DIR/qt_ifw_packages.txt msys2_qt_ifw_packages.nix generate_nix_packages_from_pacman $MSYS2DIR/artiq_dependency_packages.txt artiq_dependency_packages.nix