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

75 lines
2.4 KiB
Nix
Raw Normal View History

2020-06-15 20:11:19 +08:00
{ pkgs, version, src, target }:
let
wfvm = import ../wfvm { inherit pkgs; };
libiconv-filename = "libiconv-1.15-h0c8e037_1006.tar.bz2";
libiconv = pkgs.fetchurl {
url = "https://anaconda.org/conda-forge/libiconv/1.15/download/win-64/${libiconv-filename}";
sha256 = "1jaxnpg5y5pkhvpp9kaq0kpvz7jlj5hynp567q35l7hpfk6xxghh";
};
build = wfvm.utils.wfvm-run {
name = "build-binutils";
image = wfvm.makeWindowsImage { installCommands = with wfvm.layers; [ anaconda3 msys2 msys2-packages ]; };
script = ''
ln -s ${libiconv} ${libiconv-filename}
${wfvm.utils.win-put}/bin/win-put ${libiconv-filename}
2020-06-15 20:11:19 +08:00
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda create -n build ${libiconv-filename}"
cat > meta.yaml << EOF
package:
name: binutils-${target}
version: ${version}
source:
url: ../src.tar.bz2
2020-06-15 20:11:19 +08:00
requirements:
run:
- libiconv
2020-06-15 20:11:19 +08:00
EOF
cat > bld.bat << EOF
2020-06-16 14:05:47 +08:00
set MSYS=C:\MSYS64
2020-06-16 13:29:40 +08:00
set TOOLPREF=mingw-w64-x86_64-
set TRIPLE=x86_64-pc-mingw64
set PATH=%MSYS%\usr\bin;%MSYS%\mingw64\bin;%PATH%
2020-06-15 20:11:19 +08:00
mkdir build
cd build
set CFLAGS=-I%PREFIX:\=/%/Library/include/
set LDFLAGS=-L%PREFIX:\=/%/Library/lib/
sh ../configure --build=%TRIPLE% ^
--prefix="%PREFIX:\=/%/Library" ^
--target=${target}
2020-06-15 20:11:19 +08:00
if errorlevel 1 exit 1
make -j4
if errorlevel 1 exit 1
make install
if errorlevel 1 exit 1
rem this is a copy of prefixed executables
rmdir /S /Q %PREFIX%\Library\${target}
2020-06-15 20:11:19 +08:00
EOF
${wfvm.utils.win-exec}/bin/win-exec "mkdir binutils"
${wfvm.utils.win-put}/bin/win-put meta.yaml binutils
${wfvm.utils.win-put}/bin/win-put bld.bat binutils
ln -s ${src} src.tar.bz2
${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 build && conda build --no-anaconda-upload --no-test binutils"
${wfvm.utils.win-get}/bin/win-get ".\Anaconda3\conda-bld\win-64\binutils-${target}-${version}-0.tar.bz2"
'';
};
in
pkgs.runCommand "conda-windows-binutils-${target}" { buildInputs = [ build ]; } ''
wfvm-run-build-binutils
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
''