forked from msys2/msys2-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_msys2_packages.sh
executable file
·37 lines (29 loc) · 1.57 KB
/
make_msys2_packages.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/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-20240210-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
printf "\n[artiq]\nSigLevel = Optional TrustAll\nServer = https://msys2.m-labs.hk/artiq-beta\n" >> $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-x86_64-artiq mingw-w64-x86_64-openocd mingw-w64-x86_64-bscan-spi-bitstreams > $MSYS2DIR/packages.txt
pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf --cachedir $MSYS2DIR/msys/cache \
--sync --print-format "%l %n" mingw-w64-x86_64-qt-installer-framework > $MSYS2DIR/qt_ifw_packages.txt
function generate_nix_packages() {
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_artiq_packages.nix generate_nix_packages
IN=$MSYS2DIR/qt_ifw_packages.txt OUT=msys2_qt_ifw_packages.nix generate_nix_packages