windows: add nac3artiq derivation (WIP)

This commit is contained in:
Sebastien Bourdeauducq 2022-03-22 19:19:06 +08:00
parent 1114d11b34
commit 03f5b80153
2 changed files with 43 additions and 11 deletions

View File

@ -137,6 +137,7 @@
hydraJobs = { hydraJobs = {
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;
}; };
}; };

View File

@ -7,8 +7,31 @@ let
phases = [ "installPhase" ]; phases = [ "installPhase" ];
installPhase = (pkgs.lib.strings.concatStringsSep "\n" (["mkdir $out"] ++ (map (p: "tar xvf ${p} -C $out") srcs))); installPhase = (pkgs.lib.strings.concatStringsSep "\n" (["mkdir $out"] ++ (map (p: "tar xvf ${p} -C $out") srcs)));
}; };
in silenceFontconfig = # silence flood of "Fontconfig error: Cannot load default config file: No such file: (null)"
{ ''
export FONTCONFIG_PATH=$HOME/fonts
mkdir $FONTCONFIG_PATH
cat > $FONTCONFIG_PATH/fonts.conf << EOF
<fontconfig>
</fontconfig>
EOF
'';
pyo3-mingw-config = pkgs.writeTextFile {
name = "pyo3-mingw-config";
text =
''
implementation=CPython
version=3.9
shared=true
abi3=false
lib_name=python3.9
lib_dir=${msys2-env}/mingw64/lib
pointer_width=64
build_flags=WITH_THREAD
suppress_build_script_link_lines=false
'';
};
in rec {
llvm-nac3 = pkgs.stdenvNoCC.mkDerivation rec { llvm-nac3 = pkgs.stdenvNoCC.mkDerivation rec {
name = "llvm-nac3-msys2"; name = "llvm-nac3-msys2";
src-llvm = pkgs.fetchurl { src-llvm = pkgs.fetchurl {
@ -37,15 +60,7 @@ in
export HOME=`mktemp -d` export HOME=`mktemp -d`
export WINEDEBUG=-all export WINEDEBUG=-all
export WINEPATH=${msys2-env}/mingw64/bin export WINEPATH=${msys2-env}/mingw64/bin
${silenceFontconfig}
# silence flood of "Fontconfig error: Cannot load default config file: No such file: (null)"
export FONTCONFIG_PATH=$HOME/fonts
mkdir $FONTCONFIG_PATH
cat > $FONTCONFIG_PATH/fonts.conf << EOF
<fontconfig>
</fontconfig>
EOF
mkdir build mkdir build
cd build cd build
wine64 cmake .. -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_UNWIND_TABLES=OFF -DLLVM_ENABLE_THREADS=OFF -DLLVM_TARGETS_TO_BUILD=X86\;ARM\;RISCV -DLLVM_LINK_LLVM_DYLIB=OFF -DLLVM_ENABLE_FFI=OFF -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_INSTALL_PREFIX=$out wine64 cmake .. -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_UNWIND_TABLES=OFF -DLLVM_ENABLE_THREADS=OFF -DLLVM_TARGETS_TO_BUILD=X86\;ARM\;RISCV -DLLVM_LINK_LLVM_DYLIB=OFF -DLLVM_ENABLE_FFI=OFF -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_INSTALL_PREFIX=$out
@ -59,4 +74,20 @@ in
wine64 ninja install wine64 ninja install
''; '';
}; };
nac3artiq = pkgs.rustPlatform.buildRustPackage {
name = "nac3artiq";
src = ../.;
cargoLock = { lockFile = ../Cargo.lock; };
doCheck = false;
nativeBuildInputs = [ pkgs.wineWowPackages.stable ];
buildPhase =
''
export HOME=`mktemp -d`
export WINEDEBUG=-all
export WINEPATH=${msys2-env}/mingw64/bin
${silenceFontconfig}
export PYO3_CONFIG_FILE=Z:${pyo3-mingw-config}
wine64 cargo build --release -p nac3artiq
'';
};
} }