From 20925a3d8de0e0a3b87b793399e63d3bf187436d Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 16 Jun 2020 15:32:48 +0800 Subject: [PATCH] conda-windows: build llvm-or1k --- artiq-fast/conda-windows/llvm-or1k.nix | 66 ++++++++++++++++++++++++++ artiq-fast/default.nix | 5 ++ 2 files changed, 71 insertions(+) create mode 100644 artiq-fast/conda-windows/llvm-or1k.nix diff --git a/artiq-fast/conda-windows/llvm-or1k.nix b/artiq-fast/conda-windows/llvm-or1k.nix new file mode 100644 index 0000000..217fbab --- /dev/null +++ b/artiq-fast/conda-windows/llvm-or1k.nix @@ -0,0 +1,66 @@ +{ pkgs, version, src }: + +let + wfvm = import ../wfvm { inherit pkgs; }; + build = wfvm.utils.wfvm-run { + name = "build-llvm-or1k"; + image = wfvm.makeWindowsImage { installCommands = with wfvm.layers; [ anaconda3 msys2 msys2-packages ]; }; + script = '' + ${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda create -n build --offline" + + cat > meta.yaml << EOF + package: + name: llvm-or1k + version: ${version} + + source: + url: ../src.tar + + EOF + + cat > bld.bat << EOF + set MSYS=C:\MSYS64 + set PATH=%MSYS%\usr\bin;%MSYS%\mingw64\bin;%PATH% + + set BUILD_TYPE=Release + set CMAKE_GENERATOR=MinGW Makefiles + + mkdir build + cd build + cmake .. -G "%CMAKE_GENERATOR%" ^ + -DCMAKE_BUILD_TYPE="%BUILD_TYPE%" ^ + -DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^ + -DLLVM_BUILD_LLVM_DYLIB=ON ^ + -DLLVM_TARGETS_TO_BUILD=X86;ARM ^ + -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=OR1K ^ + -DLLVM_ENABLE_ASSERTIONS=OFF ^ + -DLLVM_INSTALL_UTILS=ON ^ + -DLLVM_INCLUDE_TESTS=OFF ^ + -DLLVM_INCLUDE_DOCS=OFF ^ + -DLLVM_INCLUDE_EXAMPLES=OFF + if errorlevel 1 exit 1 + cmake --build . --config "%BUILD_TYPE%" --parallel 4 + if errorlevel 1 exit 1 + cmake --build . --config "%BUILD_TYPE%" --target install + if errorlevel 1 exit 1 + EOF + + ${wfvm.utils.win-exec}/bin/win-exec "mkdir llvm-or1k" + ${wfvm.utils.win-put}/bin/win-put meta.yaml ".\llvm-or1k" + ${wfvm.utils.win-put}/bin/win-put bld.bat ".\llvm-or1k" + ln -s ${src} src + tar chf src.tar src + ${wfvm.utils.win-put}/bin/win-put src.tar ".\src.tar" + + ${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate build && conda build --no-anaconda-upload --no-test llvm-or1k" + + ${wfvm.utils.win-get}/bin/win-get ".\Anaconda3\conda-bld\win-64\llvm-or1k-${version}-0.tar.bz2" + ''; + }; +in + pkgs.runCommand "conda-windows-llvm-or1k" { buildInputs = [ build ]; } '' + wfvm-run-build-llvm-or1k + mkdir -p $out/win-64 $out/nix-support + cp *.tar.bz2 $out/win-64 + echo file conda $out/win-64/*.tar.bz2 >> $out/nix-support/hydra-build-products + '' diff --git a/artiq-fast/default.nix b/artiq-fast/default.nix index 903b87b..b47f86a 100644 --- a/artiq-fast/default.nix +++ b/artiq-fast/default.nix @@ -101,6 +101,11 @@ let inherit (binutils-arm) version src; target = "armv7-unknown-linux-gnueabihf"; }; + conda-windows-llvm-or1k = import ./conda-windows/llvm-or1k.nix { + inherit pkgs; + inherit (llvm-or1k) version; + src = llvm-or1k.llvm-src; + }; }; in mainPackages // boardPackages