From b2e40e0594ea0a0f9562843e4a70e61c30992ff7 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 22 Jun 2020 12:33:36 +0800 Subject: [PATCH] conda-windows: new attempt at binutils --- .../binutils-hack-libiconv.patch | 11 +++ .../conda-windows/binutils-recipe/bld.bat | 21 +++++ .../conda-windows/binutils-recipe/meta.yaml | 17 +++++ artiq-fast/conda-windows/binutils.nix | 76 +++++++------------ artiq-fast/default.nix | 26 ++++++- 5 files changed, 101 insertions(+), 50 deletions(-) create mode 100644 artiq-fast/conda-windows/binutils-hack-libiconv.patch create mode 100644 artiq-fast/conda-windows/binutils-recipe/bld.bat create mode 100644 artiq-fast/conda-windows/binutils-recipe/meta.yaml diff --git a/artiq-fast/conda-windows/binutils-hack-libiconv.patch b/artiq-fast/conda-windows/binutils-hack-libiconv.patch new file mode 100644 index 0000000..a2ab319 --- /dev/null +++ b/artiq-fast/conda-windows/binutils-hack-libiconv.patch @@ -0,0 +1,11 @@ +--- a/intl/relocatable.c 2018-02-28 18:19:46.318224392 +0000 ++++ b/intl/relocatable.c 2018-02-28 18:19:37.614224749 +0000 +@@ -145,7 +145,7 @@ + libcharset_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg); + #endif + #if DEPENDS_ON_LIBICONV && HAVE_ICONV && _LIBICONV_VERSION >= 0x0109 +- libiconv_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg); ++ // libiconv_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg); + #endif + #if DEPENDS_ON_LIBINTL && ENABLE_NLS && defined libintl_set_relocation_prefix + libintl_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg); diff --git a/artiq-fast/conda-windows/binutils-recipe/bld.bat b/artiq-fast/conda-windows/binutils-recipe/bld.bat new file mode 100644 index 0000000..0971d9b --- /dev/null +++ b/artiq-fast/conda-windows/binutils-recipe/bld.bat @@ -0,0 +1,21 @@ +set MSYS=C:\MSYS64 +set TRIPLE=x86_64-pc-mingw64 +set PATH=%MSYS%\usr\bin;%MSYS%\mingw64\bin;%PATH% + +mkdir build +cd build +set CFLAGS=-I%PREFIX:\=/%/Library/include/ +set LDFLAGS=-L%PREFIX:\=/%/Library/lib/ +sh ../configure --build=%TRIPLE% ^ + --prefix="%PREFIX:\=/%/Library" ^ + --target=or1k-linux +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\or1k-linux diff --git a/artiq-fast/conda-windows/binutils-recipe/meta.yaml b/artiq-fast/conda-windows/binutils-recipe/meta.yaml new file mode 100644 index 0000000..230fa70 --- /dev/null +++ b/artiq-fast/conda-windows/binutils-recipe/meta.yaml @@ -0,0 +1,17 @@ +package: + name: binutils-or1k-linux + version: 2.30 + +source: + url: ../src.tar.bz2 + +requirements: + build: + - libiconv + run: + - libiconv + +about: + home: https://www.gnu.org/software/binutils/ + license: GPL + summary: 'A set of programming tools for creating and managing binary programs, object files, libraries, profile data, and assembly source code.' diff --git a/artiq-fast/conda-windows/binutils.nix b/artiq-fast/conda-windows/binutils.nix index e949415..3d2baee 100644 --- a/artiq-fast/conda-windows/binutils.nix +++ b/artiq-fast/conda-windows/binutils.nix @@ -2,65 +2,43 @@ let wfvm = import ../wfvm { inherit pkgs; }; - libiconv-filename = "libiconv-1.15-h0c8e037_1006.tar.bz2"; + libiconv-filename = "libiconv-1.15-h1df5818_7.tar.bz2"; libiconv = pkgs.fetchurl { - url = "https://anaconda.org/conda-forge/libiconv/1.15/download/win-64/${libiconv-filename}"; - sha256 = "1jaxnpg5y5pkhvpp9kaq0kpvz7jlj5hynp567q35l7hpfk6xxghh"; + 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"; }; build = wfvm.utils.wfvm-run { name = "build-binutils"; image = wfvm.makeWindowsImage { installCommands = with wfvm.layers; [ anaconda3 msys2 msys2-packages ]; }; script = '' + # 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} - ${wfvm.utils.win-put}/bin/win-put ${libiconv-filename} - ${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda create -n build ${libiconv-filename}" + ${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" - cat > meta.yaml << EOF - package: - name: binutils-${target} - version: ${version} - - source: - url: ../src.tar.bz2 - - requirements: - run: - - libiconv - - EOF - - cat > bld.bat << EOF - set MSYS=C:\MSYS64 - set TOOLPREF=mingw-w64-x86_64- - set TRIPLE=x86_64-pc-mingw64 - set PATH=%MSYS%\usr\bin;%MSYS%\mingw64\bin;%PATH% - - 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} - 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} - 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 + ln -s ${./binutils-recipe} binutils + ${wfvm.utils.win-put}/bin/win-put binutils . + tar xjf ${src} + patch -d binutils-2.30 -p1 < ${./binutils-hack-libiconv.patch} + tar cjf src.tar.bz2 binutils-2.30 ${wfvm.utils.win-put}/bin/win-put src.tar.bz2 . - ${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate build && conda build --no-anaconda-upload --no-test binutils" + ${wfvm.utils.win-exec}/bin/win-exec "set MSYS=C:\MSYS64 && set PATH=%MSYS%\usr\bin;%MSYS%\mingw64\bin;%PATH% && .\Anaconda3\scripts\activate && conda build --no-anaconda-upload --no-test -c file:///C:/users/wfvm/fake-channel --override-channels binutils" ${wfvm.utils.win-get}/bin/win-get "Anaconda3/conda-bld/win-64/binutils-${target}-${version}-0.tar.bz2" ''; diff --git a/artiq-fast/default.nix b/artiq-fast/default.nix index c8c5410..a21c25f 100644 --- a/artiq-fast/default.nix +++ b/artiq-fast/default.nix @@ -93,7 +93,7 @@ let }; }; - condaWindows = { + condaWindowsLegacy = { conda-windows-binutils-or1k = import ./conda-windows/redistribute.nix { inherit pkgs; name = "binutils-or1k"; @@ -116,5 +116,29 @@ let sha256 = "10w24w5ljvan06pbvwqj4pzal072jnyynmwm42dn06pq88ryz9wj"; }; }; + + condaWindowsExperimental = { + conda-windows-binutils-or1k = import ./conda-windows/binutils.nix { + inherit pkgs; + inherit (mainPackages.binutils-or1k) version src; + target = "or1k-linux"; + }; + conda-windows-llvm-or1k = import ./conda-windows/redistribute.nix { + inherit pkgs; + name = "llvm-or1k"; + filename = "llvm-or1k-6.0.0-25.tar.bz2"; + baseurl = "https://anaconda.org/m-labs/llvm-or1k/6.0.0/download/win-64/"; + sha256 = "06mnrg79rn9ni0d5z0x3jzb300nhqhbc2h9qbq5m50x3sgm8km63"; + }; + conda-windows-llvmlite-artiq = import ./conda-windows/redistribute.nix { + inherit pkgs; + name = "llvmlite-artiq"; + filename = "llvmlite-artiq-0.23.0.dev-py35_5.tar.bz2"; + baseurl = "https://anaconda.org/m-labs/llvmlite-artiq/0.23.0.dev/download/win-64/"; + sha256 = "10w24w5ljvan06pbvwqj4pzal072jnyynmwm42dn06pq88ryz9wj"; + }; + }; + + condaWindows = if (pkgs.lib.strings.versionAtLeast mainPackages.artiq.version "6.0") then condaWindowsExperimental else condaWindowsLegacy; in mainPackages // condaWindows // boardPackages