forked from M-Labs/nac3
1
0
Fork 0

windows: create MSYS2 package

This commit is contained in:
Sebastien Bourdeauducq 2022-04-04 14:24:47 +08:00
parent 4f66bdeda9
commit 8209c0a475
4 changed files with 50 additions and 5 deletions

View File

@ -142,6 +142,7 @@
inherit (packages.x86_64-linux) llvm-nac3 nac3artiq; inherit (packages.x86_64-linux) llvm-nac3 nac3artiq;
llvm-nac3-msys2 = packages.x86_64-w64-mingw32.llvm-nac3; llvm-nac3-msys2 = packages.x86_64-w64-mingw32.llvm-nac3;
nac3artiq-msys2 = packages.x86_64-w64-mingw32.nac3artiq; 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; lld-msys2 = packages.x86_64-w64-mingw32.lld;
}; };
}; };

25
nix/windows/PKGBUILD Normal file
View File

@ -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
}

View File

@ -80,7 +80,7 @@ in rec {
name = "nac3artiq-msys2"; name = "nac3artiq-msys2";
src = ../../.; src = ../../.;
cargoLock = { lockFile = ../../Cargo.lock; }; cargoLock = { lockFile = ../../Cargo.lock; };
nativeBuildInputs = [ pkgs.wineWowPackages.stable pkgs.zip ]; nativeBuildInputs = [ pkgs.wineWowPackages.stable ];
buildPhase = buildPhase =
'' ''
export HOME=`mktemp -d` export HOME=`mktemp -d`
@ -92,10 +92,9 @@ in rec {
''; '';
installPhase = installPhase =
'' ''
mkdir -p $out $out/nix-support mkdir $out $out/nix-support
ln -s target/release/nac3artiq.dll nac3artiq.pyd cp target/release/nac3artiq.dll $out/nac3artiq.pyd
zip $out/nac3artiq.zip nac3artiq.pyd echo file binary-dist $out/nac3artiq.pyd >> $out/nix-support/hydra-build-products
echo file binary-dist $out/nac3artiq.zip >> $out/nix-support/hydra-build-products
''; '';
checkPhase = checkPhase =
'' ''
@ -103,6 +102,24 @@ in rec {
''; '';
dontFixup = true; 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 { lld = pkgs.stdenvNoCC.mkDerivation rec {
pname = "lld-msys2"; pname = "lld-msys2";
version = "13.0.1"; version = "13.0.1";

2
nix/windows/makepkg.conf Normal file
View File

@ -0,0 +1,2 @@
PKGEXT='.pkg.tar.zst'
SRCEXT='.src.tar.gz'