From f1742db24f91c3d94ceacc476803c1336abed6a4 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 10 Jun 2020 11:53:43 +0800 Subject: [PATCH] conda: add llvmlite-artiq --- artiq-fast/conda/llvmlite-artiq.nix | 69 +++++++++++++++++++++++++++++ artiq-fast/default.nix | 4 ++ artiq-fast/pkgs/llvmlite-artiq.nix | 1 + 3 files changed, 74 insertions(+) create mode 100644 artiq-fast/conda/llvmlite-artiq.nix diff --git a/artiq-fast/conda/llvmlite-artiq.nix b/artiq-fast/conda/llvmlite-artiq.nix new file mode 100644 index 0000000..3e90076 --- /dev/null +++ b/artiq-fast/conda/llvmlite-artiq.nix @@ -0,0 +1,69 @@ +{ pkgs, conda-llvm-or1k, version, src }: + +let + condaBuilderEnv = import ./builder-env.nix { inherit pkgs; }; + fake-src = pkgs.runCommand "conda-fake-source-llvmlite-artiq" { } + '' + mkdir -p $out/fake-conda; + + # work around yet more idiotic conda behavior - build breaks if write permissions aren't set on source files. + cp --no-preserve=mode,ownership -R ${src} workaround-conda + pushd workaround-conda + tar cf $out/src.tar . + popd + rm -rf workaround-conda + + cat << EOF > $out/fake-conda/meta.yaml + package: + name: llvmlite-artiq + version: ${version} + + source: + url: ../src.tar + + # Again, we don't specify build dependencies since the conda garbage mistakenly thinks + # that they are not there if they have been installed from files. + requirements: + run: + - python + - ncurses [linux] + EOF + + cat << EOF > $out/fake-conda/build.sh + #!/bin/bash + set -e + + export LD_LIBRARY_PATH=/lib + python setup.py install \ + --prefix=\$PREFIX \ + --single-version-externally-managed \ + --record=record.txt \ + --no-compile + + EOF + chmod 755 $out/fake-conda/build.sh + ''; +in + pkgs.stdenv.mkDerivation { + name = "conda-llvmlite-artiq"; + src = fake-src; + buildCommand = + '' + HOME=`pwd` + mkdir $out + cat << EOF > conda-commands.sh + set -e + + conda create --prefix ./conda_tmp ${conda-llvm-or1k}/*/*.tar.bz2 + conda init + source .bashrc + conda activate ./conda_tmp + + conda build --no-anaconda-upload --no-test --output-folder $out $src/fake-conda + EOF + ${condaBuilderEnv}/bin/conda-builder-env conda-commands.sh + + mkdir -p $out/nix-support + echo file conda $out/*/*.tar.bz2 >> $out/nix-support/hydra-build-products + ''; + } diff --git a/artiq-fast/default.nix b/artiq-fast/default.nix index 9722b30..5449ce5 100644 --- a/artiq-fast/default.nix +++ b/artiq-fast/default.nix @@ -59,6 +59,10 @@ let inherit (llvm-or1k) version; src = llvm-or1k.llvm-src; }; + conda-llvmlite-artiq = import ./conda/llvmlite-artiq.nix { + inherit pkgs conda-llvm-or1k; + inherit (llvmlite-artiq) version src; + }; conda-sipyco = import ./conda/build.nix { inherit pkgs; } { name = "conda-sipyco"; src = import ./conda/fake-source.nix { inherit pkgs; } { diff --git a/artiq-fast/pkgs/llvmlite-artiq.nix b/artiq-fast/pkgs/llvmlite-artiq.nix index 0a26893..9ec5c2c 100644 --- a/artiq-fast/pkgs/llvmlite-artiq.nix +++ b/artiq-fast/pkgs/llvmlite-artiq.nix @@ -1,6 +1,7 @@ { stdenv, fetchFromGitHub, llvm-or1k, makeWrapper, python3, ncurses, zlib, python3Packages }: python3Packages.buildPythonPackage rec { name = "llvmlite-artiq"; + version = "0.23.0.dev"; src = fetchFromGitHub { rev = "158f9d3a898dbf055ca513d69505df288c681fea"; owner = "m-labs";