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 = ''
|
2020-06-17 23:40:49 +08:00
|
|
|
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:
|
2020-06-15 20:20:37 +08:00
|
|
|
url: ../src.tar.bz2
|
2020-06-15 20:11:19 +08:00
|
|
|
|
2020-06-16 12:44:57 +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" ^
|
2020-06-16 12:52:42 +08:00
|
|
|
--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
|
2020-06-16 12:52:42 +08:00
|
|
|
rmdir /S /Q %PREFIX%\Library\${target}
|
2020-06-15 20:11:19 +08:00
|
|
|
EOF
|
|
|
|
|
|
|
|
${wfvm.utils.win-exec}/bin/win-exec "mkdir binutils"
|
2020-06-17 23:40:49 +08:00
|
|
|
${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"
|
|
|
|
|
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 *.tar.bz2 $out/win-64
|
|
|
|
echo file conda $out/win-64/*.tar.bz2 >> $out/nix-support/hydra-build-products
|
|
|
|
''
|