flake: Windows libs working

This commit is contained in:
Sebastien Bourdeauducq 2021-12-02 22:01:19 +08:00
parent 998f49261d
commit c0f8d5c602
1 changed files with 6 additions and 7 deletions

View File

@ -68,7 +68,7 @@
name = "nac3artiq"; name = "nac3artiq";
src = self; src = self;
inherit cargoSha256; inherit cargoSha256;
buildInputs = [ pkgs-mingw.libffi pkgs-mingw.zlib pkgs-mingw.windows.mcfgthreads ]; buildInputs = [ pkgs-mingw.libffi pkgs-mingw.zlib ];
configurePhase = configurePhase =
'' ''
export PYO3_CONFIG_FILE=${pyo3-mingw-config} export PYO3_CONFIG_FILE=${pyo3-mingw-config}
@ -78,20 +78,19 @@
#!${pkgs.bash}/bin/bash #!${pkgs.bash}/bin/bash
set -e set -e
# Gross hack to work around llvm-config asking for the wrong system libraries. # Gross hack to work around llvm-config asking for the wrong system libraries.
# Also add some other libraries we need here. exec ${pkgs-mingw.llvm_12.dev}/bin/llvm-config-native \$@ | ${pkgs.gnused}/bin/sed s/-lrt\ -ldl\ -lpthread\ -lm//
exec ${pkgs-mingw.llvm_12.dev}/bin/llvm-config-native \$@ | ${pkgs.gnused}/bin/sed s/-lrt\ -ldl\ -lpthread\ -lm/-lmcfgthread\ -lz\ -luuid\ -lole32/
EOF EOF
chmod +x llvm-cfg/llvm-config chmod +x llvm-cfg/llvm-config
export PATH=$PATH:`pwd`/llvm-cfg export PATH=$PATH:`pwd`/llvm-cfg
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUSTFLAGS="-C link-arg=-lz -C link-arg=-luuid -C link-arg=-lole32 -C link-arg=-lmcfgthread"
''; '';
cargoBuildFlags = [ "--package" "nac3artiq" ]; cargoBuildFlags = [ "--package" "nac3artiq" ];
doCheck = false; doCheck = false;
installPhase = installPhase =
'' ''
TARGET_DIR=$out/${pkgs.python3Packages.python.sitePackages} mkdir -p $out
mkdir -p $TARGET_DIR cp target/x86_64-pc-windows-gnu/release/nac3artiq.dll $out
#cp target/x86_64-unknown-linux-gnu/release/libnac3artiq.so $TARGET_DIR/nac3artiq.so
ls target
''; '';
meta.platforms = ["x86_64-windows"]; meta.platforms = ["x86_64-windows"];
} }