#!/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-python \ mingw-w64-clang-x86_64-python-numpy mingw-w64-clang-x86_64-python-setuptools > $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() { 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 } IN=$MSYS2DIR/packages.txt OUT=msys2_packages.nix generate_nix_packages_from_pacman IN=$MSYS2DIR/qt_ifw_packages.txt OUT=msys2_qt_ifw_packages.nix generate_nix_packages_from_pacman IN=$MSYS2DIR/artiq_dependency_packages.txt OUT=artiq_dependency_packages.nix generate_nix_packages_from_pacman