Put dependencies into txts and remove other executables from start menu

Signed-off-by: Egor Savkin <es@m-labs.hk>
Egor Savkin 2024-05-02 12:50:47 +08:00
parent b281f4d727
commit 64c412213f
9 changed files with 61 additions and 71 deletions

View File

@ -16,6 +16,14 @@
let
pkgs = import artiqpkgs.inputs.nixpkgs { system = "x86_64-linux"; };
msys2 = import ./msys2 { inherit pkgs; };
sipycoDependenciesFile = ./msys2/sipyco_deps.txt;
artiqDependenciesFile = ./msys2/artiq_deps.txt;
comtoolsDependenciesFile = ./msys2/comtools_deps.txt;
openocdDependenciesFile = ./msys2/openocd_deps.txt;
pythonparserDependenciesFile = ./msys2/pythonparser_deps.txt;
# reads filename and return list of non-empty lines from it
nonEmptyLinesFileReader = (filename: builtins.filter (x: builtins.lessThan 0 (builtins.length (pkgs.lib.strings.stringToCharacters x)))
(builtins.filter builtins.isString (builtins.split "\n| |\t" (builtins.readFile filename))));
condaDeps = with pkgs; [ zlib xorg.libSM xorg.libICE xorg.libX11 xorg.libXau xorg.libXi xorg.libXrender libselinux libGL ];
# Use the full Anaconda distribution, which already contains conda-build and its many dependencies.
@ -420,19 +428,19 @@
name = "python-pythonparser";
version = artiqpkgs.packages.x86_64-linux.pythonparser.version;
src = artiqpkgs.packages.x86_64-linux.pythonparser.src;
depends = [ "mingw-w64-x86_64-python-regex" ];
depends = nonEmptyLinesFileReader pythonparserDependenciesFile;
};
msys2-sipyco = msys2.makeMsys2Package {
name = "python-sipyco";
src = artiqpkgs.inputs.sipyco.packages.x86_64-linux.sipyco.src;
inherit (artiqpkgs.inputs.sipyco.packages.x86_64-linux.sipyco) version;
depends = [ "mingw-w64-x86_64-python" "mingw-w64-x86_64-python-numpy" "mingw-w64-x86_64-python-pybase64" ];
depends = nonEmptyLinesFileReader sipycoDependenciesFile;
};
msys2-artiq-comtools = msys2.makeMsys2Package {
name = "artiq-comtools";
src = artiqpkgs.inputs.artiq-comtools.packages.x86_64-linux.artiq-comtools.src;
inherit (artiqpkgs.inputs.artiq-comtools.packages.x86_64-linux.artiq-comtools) version;
depends = [ "mingw-w64-x86_64-python" "mingw-w64-x86_64-python-sipyco" "mingw-w64-x86_64-python-numpy" "mingw-w64-x86_64-python-aiohttp" ];
depends = (nonEmptyLinesFileReader comtoolsDependenciesFile) ++ [ "mingw-w64-x86_64-python-sipyco" ];
};
msys2-artiq = msys2.makeMsys2Package {
name = "artiq";
@ -442,27 +450,10 @@
export VERSIONEER_OVERRIDE=${artiqpkgs.packages.x86_64-linux.artiq.version}
export VERSIONEER_REV=${artiqpkgs.sourceInfo.rev}
'';
depends = [
"mingw-w64-x86_64-python"
"mingw-w64-x86_64-python-h5py"
"mingw-w64-x86_64-python-pyqt5"
"mingw-w64-x86_64-qt5-svg"
"mingw-w64-x86_64-python-qasync"
"mingw-w64-x86_64-python-pyqtgraph"
"mingw-w64-x86_64-python-numpy"
"mingw-w64-x86_64-python-scipy"
"mingw-w64-x86_64-python-dateutil"
"mingw-w64-x86_64-python-prettytable"
"mingw-w64-x86_64-python-tqdm"
"mingw-w64-x86_64-python-pygit2"
"mingw-w64-x86_64-python-sipyco"
"mingw-w64-x86_64-python-llvmlite"
"mingw-w64-x86_64-python-pythonparser"
"mingw-w64-x86_64-python-levenshtein"
"mingw-w64-x86_64-python-lmdb"
"mingw-w64-x86_64-lld"
"mingw-w64-x86_64-artiq-comtools"
];
depends = (nonEmptyLinesFileReader artiqDependenciesFile)
++ (nonEmptyLinesFileReader openocdDependenciesFile)
++ [ "mingw-w64-x86_64-python-sipyco" "mingw-w64-x86_64-python-pythonparser" "mingw-w64-x86_64-artiq-comtools" ];
};
msys2-asyncserial = msys2.makeMsys2Package {
name = "python-asyncserial";
@ -536,8 +527,8 @@
installPhase = (pkgs.lib.strings.concatStringsSep "\n" (["mkdir $out"] ++ (map (p: "tar xvf ${p} -C $out") srcs)));
};
msys2_image = pkgs.stdenvNoCC.mkDerivation rec {
name = "msys2_image";
msys2_artiq_image = pkgs.stdenvNoCC.mkDerivation rec {
name = "msys2_artiq_image";
artiq-deps-pkgs = import ./msys2/artiq_dep_packages.nix { inherit pkgs; };
msys2-pkgs = import ./msys2/msys2_packages.nix { inherit pkgs; };
msys2-base = pkgs.fetchurl {
@ -556,8 +547,8 @@
tar -xvf ${msys2-base} --strip-components=1 -C $out/ msys64
printf "\n[artiq]\nSigLevel = Optional TrustAll\nServer = https://msys2.m-labs.hk/artiq-beta\n" >> $out/etc/pacman.conf
cat $out/etc/pacman.conf | sed -e "s|/etc/pacman.d|$out/etc/pacman.d|g" -e "s|SigLevel = Required|SigLevel = Never|g" -e "s|CheckSpace||g" > tmp/pacman.conf
fakeroot pacman -U --noconfirm --cachedir tmp/cache --config tmp/pacman.conf --root $out ${pkgs.lib.concatStringsSep " " (map (p: "${p}") msys2-pkgs)}
fakeroot pacman -U --noconfirm --cachedir tmp/cache --config tmp/pacman.conf --root $out ${pkgs.lib.concatStringsSep " " (map (p: "${p}") artiq-deps-pkgs)}
fakeroot pacman -U --asdeps --noconfirm --cachedir tmp/cache --config tmp/pacman.conf --root $out ${pkgs.lib.concatStringsSep " " (map (p: "${p}") msys2-pkgs)}
fakeroot pacman -U --asdeps --noconfirm --cachedir tmp/cache --config tmp/pacman.conf --root $out ${pkgs.lib.concatStringsSep " " (map (p: "${p}") artiq-deps-pkgs)}
fakeroot pacman -U --noconfirm --cachedir tmp/cache --config tmp/pacman.conf --root $out ${msys2-artiq}/*.pkg.tar.zst ${msys2-artiq-comtools}/*.pkg.tar.zst ${msys2-pythonparser}/*.pkg.tar.zst ${msys2-sipyco}/*.pkg.tar.zst
'';
};
@ -566,11 +557,12 @@
buildPhase = ''
export HOME=`mktemp -d`
cp -r $src/installer/qt-ifw qt-ifw
# needed for sed and 7z
chmod -R 700 qt-ifw
sed -i "s|@DATE@|$(date +'%Y-%m-%d')|g" qt-ifw/config/config.xml qt-ifw/packages/com.msys2.root/meta/package.xml ;
sed -i "s|@VERSION@|$(date +'%Y%m%d')|g" qt-ifw/config/config.xml qt-ifw/packages/com.msys2.root/meta/package.xml ;
7z a -mx9 -md128m "qt-ifw/packages/com.msys2.root/data/msys64.7z" "$msys2_image/"*
7z a -mx9 -md128m "qt-ifw/packages/com.msys2.root/data/msys64.7z" "msys2_artiq_image/"*
${pkgs.wineWowPackages.stable}/bin/wine64 $msys2_qt_ifw/mingw64/bin/binarycreator.exe \
-t "$msys2_qt_ifw/mingw64/bin/installerbase.exe" \
-p "qt-ifw/packages" \
@ -601,7 +593,7 @@
fakeroot
p7zip
msys2.wine-msys2
wine64
wineWowPackages.stable
];
};
};

View File

@ -34,12 +34,7 @@ function createShortcuts()
return;
}
component.addOperation("CreateShortcut", "@TargetDir@/mingw32.exe", "@StartMenuDir@/MSYS2 MINGW32.lnk", "iconPath=@TargetDir@/mingw32.exe");
component.addOperation("CreateShortcut", "@TargetDir@/mingw64.exe", "@StartMenuDir@/MSYS2 MINGW64.lnk", "iconPath=@TargetDir@/mingw64.exe");
component.addOperation("CreateShortcut", "@TargetDir@/ucrt64.exe", "@StartMenuDir@/MSYS2 UCRT64.lnk", "iconPath=@TargetDir@/ucrt64.exe");
component.addOperation("CreateShortcut", "@TargetDir@/clang64.exe", "@StartMenuDir@/MSYS2 CLANG64.lnk", "iconPath=@TargetDir@/clang64.exe");
component.addOperation("CreateShortcut", "@TargetDir@/clangarm64.exe", "@StartMenuDir@/MSYS2 CLANGARM64.lnk", "iconPath=@TargetDir@/clangarm64.exe");
component.addOperation("CreateShortcut", "@TargetDir@/msys2.exe", "@StartMenuDir@/MSYS2 MSYS.lnk", "iconPath=@TargetDir@/msys2.exe");
component.addOperation( "Execute",
["@TargetDir@\\usr\\bin\\bash.exe", "--login", "-c", "exit"]);

View File

@ -528,18 +528,6 @@
sha256 = "17qym6rwq1w37a6ph0drvz7jqmnm8k0pc3cnbhfj135cq0z79q96";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-python-regex-2023.12.25-1-any.pkg.tar.zst";
name = "mingw-w64-x86_64-python-regex";
sha256 = "17hmnaw3fvcbnzjbm6i7drs3i5j2rsdmxq2c841n497ks30xa5r4";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-python-pybase64-1.3.2-1-any.pkg.tar.zst";
name = "mingw-w64-x86_64-python-pybase64";
sha256 = "0wnwfacimz7jxv2cnpn9z4x5fbz0fyin04grab3pslrl5xa4shyr";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-hidapi-0.14.0-2-any.pkg.tar.zst";
name = "mingw-w64-x86_64-hidapi";
@ -593,4 +581,16 @@
name = "mingw-w64-x86_64-bscan-spi-bitstreams";
sha256 = "0facp60r9364fkrxx6vfrbivr00yiq99n6n24f5snqb8vqc2mrd1";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-python-regex-2023.12.25-1-any.pkg.tar.zst";
name = "mingw-w64-x86_64-python-regex";
sha256 = "17hmnaw3fvcbnzjbm6i7drs3i5j2rsdmxq2c841n497ks30xa5r4";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-python-pybase64-1.3.2-1-any.pkg.tar.zst";
name = "mingw-w64-x86_64-python-pybase64";
sha256 = "0wnwfacimz7jxv2cnpn9z4x5fbz0fyin04grab3pslrl5xa4shyr";
})
]

16
msys2/artiq_deps.txt Normal file
View File

@ -0,0 +1,16 @@
mingw-w64-x86_64-python
mingw-w64-x86_64-python-h5py
mingw-w64-x86_64-python-pyqt5
mingw-w64-x86_64-qt5-svg
mingw-w64-x86_64-python-qasync
mingw-w64-x86_64-python-pyqtgraph
mingw-w64-x86_64-python-numpy
mingw-w64-x86_64-python-scipy
mingw-w64-x86_64-python-dateutil
mingw-w64-x86_64-python-prettytable
mingw-w64-x86_64-python-tqdm
mingw-w64-x86_64-python-pygit2
mingw-w64-x86_64-python-llvmlite
mingw-w64-x86_64-python-levenshtein
mingw-w64-x86_64-python-lmdb
mingw-w64-x86_64-lld

3
msys2/comtools_deps.txt Normal file
View File

@ -0,0 +1,3 @@
mingw-w64-x86_64-python
mingw-w64-x86_64-python-numpy
mingw-w64-x86_64-python-aiohttp

View File

@ -17,30 +17,8 @@ pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf \
mingw-w64-x86_64-cc mingw-w64-x86_64-python3.11 \
mingw-w64-x86_64-python-numpy mingw-w64-x86_64-python-setuptools > $MSYS2DIR/packages.txt
pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf \
--cachedir $MSYS2DIR/msys/cache --sync --print-format "%l %n" \
mingw-w64-x86_64-python\
mingw-w64-x86_64-python-h5py\
mingw-w64-x86_64-python-pyqt5\
mingw-w64-x86_64-qt5-svg\
mingw-w64-x86_64-python-qasync\
mingw-w64-x86_64-python-pyqtgraph\
mingw-w64-x86_64-python-numpy\
mingw-w64-x86_64-python-scipy\
mingw-w64-x86_64-python-dateutil\
mingw-w64-x86_64-python-prettytable\
mingw-w64-x86_64-python-tqdm\
mingw-w64-x86_64-python-pygit2\
mingw-w64-x86_64-python-llvmlite\
mingw-w64-x86_64-python-levenshtein\
mingw-w64-x86_64-python-lmdb\
mingw-w64-x86_64-lld \
mingw-w64-x86_64-python-aiohttp \
mingw-w64-x86_64-python-idna \
mingw-w64-x86_64-python-yarl \
mingw-w64-x86_64-python-regex \
mingw-w64-x86_64-python-pybase64 \
mingw-w64-x86_64-openocd mingw-w64-x86_64-bscan-spi-bitstreams > $MSYS2DIR/artiq_dep_packages.txt
cat artiq_deps.txt comtools_deps.txt openocd_deps.txt pythonparser_deps.txt sipyco_deps.txt | pacman --root $MSYS2DIR --config $MSYS2DIR/etc/pacman.conf \
--cachedir $MSYS2DIR/msys/cache --sync --print-format "%l %n" - > $MSYS2DIR/artiq_dep_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

2
msys2/openocd_deps.txt Normal file
View File

@ -0,0 +1,2 @@
mingw-w64-x86_64-openocd
mingw-w64-x86_64-bscan-spi-bitstreams

View File

@ -0,0 +1 @@
mingw-w64-x86_64-python-regex

3
msys2/sipyco_deps.txt Normal file
View File

@ -0,0 +1,3 @@
mingw-w64-x86_64-python
mingw-w64-x86_64-python-numpy
mingw-w64-x86_64-python-pybase64