2022-10-24 18:52:11 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cd $(dirname $0)
|
|
|
|
MSYS2DIR=`pwd`/msys2
|
|
|
|
mkdir -p $MSYS2DIR/var/lib/pacman $MSYS2DIR/msys/etc
|
|
|
|
|
2024-07-15 13:43:20 +08:00
|
|
|
curl -L https://repo.msys2.org/msys/x86_64/pacman-mirrors-20240523-1-any.pkg.tar.zst | tar xvf - -C $MSYS2DIR --zstd
|
2024-05-06 15:52:57 +08:00
|
|
|
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
|
2022-10-24 18:52:11 +08:00
|
|
|
|
|
|
|
fakeroot pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf -Syy
|
2024-05-06 15:52:57 +08:00
|
|
|
pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf \
|
|
|
|
--cachedir $MSYS2DIR/msys/cache --sync --print-format "%l %n" \
|
2024-11-13 16:21:32 +08:00
|
|
|
mingw-w64-clang-x86_64-cc mingw-w64-clang-x86_64-python \
|
2024-05-17 15:31:02 +08:00
|
|
|
mingw-w64-clang-x86_64-python-numpy mingw-w64-clang-x86_64-python-setuptools > $MSYS2DIR/packages.txt
|
2024-05-06 15:52:57 +08:00
|
|
|
|
|
|
|
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 \
|
2024-05-17 15:31:02 +08:00
|
|
|
--sync --print-format "%l %n" mingw-w64-clang-x86_64-qt-installer-framework > $MSYS2DIR/qt_ifw_packages.txt
|
2024-05-06 15:52:57 +08:00
|
|
|
|
|
|
|
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
|