1
0
Fork 0
nix-scripts/artiq-fast/conda-windows/binutils.nix

55 lines
2.7 KiB
Nix
Raw Normal View History

2020-06-15 20:11:19 +08:00
{ pkgs, version, src, target }:
let
wfvm = import ../wfvm { inherit pkgs; };
2020-06-22 12:33:36 +08:00
libiconv-filename = "libiconv-1.15-h1df5818_7.tar.bz2";
2020-06-15 20:11:19 +08:00
libiconv = pkgs.fetchurl {
2020-06-22 12:33:36 +08:00
url = "https://anaconda.org/anaconda/libiconv/1.15/download/win-64/${libiconv-filename}";
sha256 = "0p431madykrjmi9sbl2sy9kzb0l3vhgs677i8q7cx8g210ab5g52";
};
vc14-filename = "vc-14.1-h0510ff6_4.tar.bz2";
vc14 = pkgs.fetchurl {
url = "https://anaconda.org/anaconda/vc/14.1/download/win-64/${vc14-filename}";
sha256 = "0nsyxph667x8ky1nybakpnk816dkrzbf1684jd7pp6wm5x73p34v";
};
vs2015_runtime-filename = "vs2015_runtime-14.16.27012-hf0eaf9b_2.tar.bz2";
vs2015_runtime = pkgs.fetchurl {
url = "https://anaconda.org/anaconda/vs2015_runtime/14.16.27012/download/win-64/${vs2015_runtime-filename}";
sha256 = "1gbm6i6nkp8linmak5mm42hj1nzqd5ppak8kv1n3wfn52p21ngvs";
2020-06-15 20:11:19 +08:00
};
build = wfvm.utils.wfvm-run {
name = "build-binutils";
image = wfvm.makeWindowsImage { installCommands = with wfvm.layers; [ anaconda3 msys2 msys2-packages ]; };
script = ''
2020-06-22 12:33:36 +08:00
# Create a fake channel to work around another pile of bugs and cretinous design decisions from conda.
${wfvm.utils.win-exec}/bin/win-exec "mkdir fake-channel && mkdir fake-channel\win-64"
ln -s ${libiconv} ${libiconv-filename}
2020-06-22 12:33:36 +08:00
${wfvm.utils.win-put}/bin/win-put ${libiconv-filename} ./fake-channel/win-64
ln -s ${vc14} ${vc14-filename}
${wfvm.utils.win-put}/bin/win-put ${vc14-filename} ./fake-channel/win-64
ln -s ${vs2015_runtime} ${vs2015_runtime-filename}
${wfvm.utils.win-put}/bin/win-put ${vs2015_runtime-filename} ./fake-channel/win-64
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda index fake-channel"
2020-06-22 12:57:29 +08:00
cp --no-preserve=mode,ownership -R ${./binutils-recipe} binutils
sed -i s/##TARGET##/${target}/g binutils/*
sed -i s/##VERSION##/${version}/g binutils/*
2020-06-22 12:33:36 +08:00
${wfvm.utils.win-put}/bin/win-put binutils .
tar xjf ${src}
2020-06-22 12:57:29 +08:00
patch -d binutils-${version} -p1 < ${./binutils-hack-libiconv.patch}
tar cjf src.tar.bz2 binutils-${version}
${wfvm.utils.win-put}/bin/win-put src.tar.bz2 .
2020-06-15 20:11:19 +08:00
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda build --no-anaconda-upload --no-test -c file:///C:/users/wfvm/fake-channel --override-channels binutils"
2020-06-15 20:11:19 +08:00
2020-06-18 00:10:33 +08:00
${wfvm.utils.win-get}/bin/win-get "Anaconda3/conda-bld/win-64/binutils-${target}-${version}-0.tar.bz2"
2020-06-15 20:11:19 +08:00
'';
};
in
pkgs.runCommand "conda-windows-binutils-${target}" { buildInputs = [ build ]; } ''
wfvm-run-build-binutils
mkdir -p $out/win-64 $out/nix-support
cp binutils-*.tar.bz2 $out/win-64
2020-06-15 20:11:19 +08:00
echo file conda $out/win-64/*.tar.bz2 >> $out/nix-support/hydra-build-products
''