mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-11 21:20:39 +02:00
Merge bitcoin/bitcoin#35877: build: ci/doc win64-cross build via nix
fa8762da62build: ci/doc win64-cross build via nix (MarcoFalke)fafe7205ccdoc: Clarify that cygwin/msys2 are not tested/supported (MarcoFalke) Pull request description: Release cross-builds to win64 are done in guix. There are also docs to use Debian/Ubuntu for those cross-builds and this approach is used in CI. However, there are many problems: * The CI is intended to mirror the guix build, but often it is not possible to find the major versions used for mingw and GCC in the guix build in the `apt` packages for an LTS distro. * Users on older distro releases may lack released bugfixes, such as8e06daa36din mingw 13 (e.g. Debian Trixie with mingw 12, https://packages.debian.org/trixie/mingw-w64-x86-64-dev). * When using the UCRT variant of the build, this uncovers bugs such as https://bugs.launchpad.net/ubuntu/+source/mingw-w64/+bug/2106420 or https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1121403. So add a way to use nix to do the cross build. This allows to closer mimic the guix build. Also, clarify that cygwin/msys2 are not tested/supported. ACKs for top commit: willcl-ark: reACKfa8762da62hebasto: re-ACKfa8762da62. Tree-SHA512: de94f8bc4bb6ed9a75352cd909aa227c5954e336bf9b14969d7412b5cedfbe6cd6b2d8b476d5b1b0bcfc93bdb32fc229015855082350c8c507189e34b9b3ef3f
This commit is contained in:
45
contrib/devtools/shell-win64-cross.nix
Normal file
45
contrib/devtools/shell-win64-cross.nix
Normal file
@@ -0,0 +1,45 @@
|
||||
# Copyright (c) The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
{ pkgs ? import (builtins.fetchTarball {
|
||||
# Pin, to keep the versions of the toolchain aligned with the versions used by Guix.
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/531670d871c0e29724a02f3cbcac170adc65b58c.tar.gz";
|
||||
}) {} }:
|
||||
|
||||
let
|
||||
host = builtins.getEnv "HOST";
|
||||
crossPkgs = if host == "x86_64-w64-mingw32ucrt"
|
||||
then pkgs.pkgsCross.ucrt64
|
||||
else if host == "x86_64-w64-mingw32"
|
||||
then pkgs.pkgsCross.mingwW64
|
||||
else throw "Unsupported HOST: ${host}";
|
||||
toolchain = crossPkgs.stdenv.cc.targetPrefix;
|
||||
pthreads = crossPkgs.windows.pthreads;
|
||||
in
|
||||
|
||||
pkgs.mkShellNoCC {
|
||||
packages = [
|
||||
crossPkgs.gcc14
|
||||
pkgs.nsis
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
export NIX_CFLAGS_COMPILE="-isystem ${pthreads}/include $NIX_CFLAGS_COMPILE"
|
||||
export NIX_LDFLAGS="-L${pthreads}/lib $NIX_LDFLAGS"
|
||||
export CC=$(command -v ${toolchain}gcc)
|
||||
export CXX=$(command -v ${toolchain}g++)
|
||||
export LD=$(command -v ${toolchain}ld)
|
||||
export AR=$(command -v ${toolchain}ar)
|
||||
export AS=$(command -v ${toolchain}as)
|
||||
export RANLIB=$(command -v ${toolchain}ranlib)
|
||||
export NM=$(command -v ${toolchain}nm)
|
||||
export STRIP=$(command -v ${toolchain}strip)
|
||||
export OBJCOPY=$(command -v ${toolchain}objcopy)
|
||||
export OBJDUMP=$(command -v ${toolchain}objdump)
|
||||
export READELF=$(command -v ${toolchain}readelf)
|
||||
export SIZE=$(command -v ${toolchain}size)
|
||||
export WINDRES=$(command -v ${toolchain}windres)
|
||||
export RC=$(command -v ${toolchain}windres)
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user