From 8209c0a4755b4bb97424a9173606a225c9d92779 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 4 Apr 2022 14:24:47 +0800 Subject: [PATCH] windows: create MSYS2 package --- flake.nix | 1 + nix/windows/PKGBUILD | 25 +++++++++++++++++++++++++ nix/windows/default.nix | 27 ++++++++++++++++++++++----- nix/windows/makepkg.conf | 2 ++ 4 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 nix/windows/PKGBUILD create mode 100644 nix/windows/makepkg.conf diff --git a/flake.nix b/flake.nix index a51f860b..c65485c7 100644 --- a/flake.nix +++ b/flake.nix @@ -142,6 +142,7 @@ inherit (packages.x86_64-linux) llvm-nac3 nac3artiq; llvm-nac3-msys2 = packages.x86_64-w64-mingw32.llvm-nac3; nac3artiq-msys2 = packages.x86_64-w64-mingw32.nac3artiq; + nac3artiq-msys2-pkg = packages.x86_64-w64-mingw32.nac3artiq-pkg; lld-msys2 = packages.x86_64-w64-mingw32.lld; }; }; diff --git a/nix/windows/PKGBUILD b/nix/windows/PKGBUILD new file mode 100644 index 00000000..e835169e --- /dev/null +++ b/nix/windows/PKGBUILD @@ -0,0 +1,25 @@ +pkgbase="mingw-w64-nac3artiq" +pkgname="mingw-w64-x86_64-nac3artiq" +pkgver=1.0 +pkgrel=1 +pkgdesc="New ARTIQ compiler 3" +arch=("any") +mingw_arch=("mingw64") +url="https://m-labs.hk" +license=("LGPL") +source=("nac3artiq.pyd") +noextract=("nac3artiq.pyd") +sha256sums=("SKIP") + +prepare() { + true +} + +build() { + true +} + +package() { + mkdir -p $pkgdir/mingw64/lib/python3.9/site-packages + cp ${srcdir}/nac3artiq.pyd $pkgdir/mingw64/lib/python3.9/site-packages +} diff --git a/nix/windows/default.nix b/nix/windows/default.nix index 94ae8f5d..e660f143 100644 --- a/nix/windows/default.nix +++ b/nix/windows/default.nix @@ -80,7 +80,7 @@ in rec { name = "nac3artiq-msys2"; src = ../../.; cargoLock = { lockFile = ../../Cargo.lock; }; - nativeBuildInputs = [ pkgs.wineWowPackages.stable pkgs.zip ]; + nativeBuildInputs = [ pkgs.wineWowPackages.stable ]; buildPhase = '' export HOME=`mktemp -d` @@ -92,10 +92,9 @@ in rec { ''; installPhase = '' - mkdir -p $out $out/nix-support - ln -s target/release/nac3artiq.dll nac3artiq.pyd - zip $out/nac3artiq.zip nac3artiq.pyd - echo file binary-dist $out/nac3artiq.zip >> $out/nix-support/hydra-build-products + mkdir $out $out/nix-support + cp target/release/nac3artiq.dll $out/nac3artiq.pyd + echo file binary-dist $out/nac3artiq.pyd >> $out/nix-support/hydra-build-products ''; checkPhase = '' @@ -103,6 +102,24 @@ in rec { ''; dontFixup = true; }; + nac3artiq-pkg = pkgs.stdenvNoCC.mkDerivation { + name = "nac3artiq-msys2-pkg"; + nativeBuildInputs = [ pkgs.pacman pkgs.fakeroot pkgs.libarchive pkgs.zstd ]; + src = nac3artiq; + phases = [ "buildPhase" "installPhase" ]; + buildPhase = + '' + ln -s ${./PKGBUILD} PKGBUILD + ln -s $src/nac3artiq.pyd nac3artiq.pyd + makepkg --config ${./makepkg.conf} + ''; + installPhase = + '' + mkdir $out $out/nix-support + cp *.pkg.tar.zst $out + echo file binary-dist $out/*.pkg.tar.zst >> $out/nix-support/hydra-build-products + ''; + }; lld = pkgs.stdenvNoCC.mkDerivation rec { pname = "lld-msys2"; version = "13.0.1"; diff --git a/nix/windows/makepkg.conf b/nix/windows/makepkg.conf new file mode 100644 index 00000000..3238344e --- /dev/null +++ b/nix/windows/makepkg.conf @@ -0,0 +1,2 @@ +PKGEXT='.pkg.tar.zst' +SRCEXT='.src.tar.gz'