libcpuid: fix cross compilation to NetBSD

Applies an upstreamed patch which works around a double definition of
popcount64. This change is all needed to cross compile nix to NetBSD, so
we can extend the cross-trunk jobset as well.
This commit is contained in:
sternenseemann 2021-12-02 11:22:44 +01:00
parent d4577bc68d
commit 8580bda686
2 changed files with 8 additions and 3 deletions

View file

@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
{ lib, stdenv, fetchFromGitHub, fetchpatch, autoreconfHook }:
stdenv.mkDerivation rec {
pname = "libcpuid";
@ -14,6 +14,12 @@ stdenv.mkDerivation rec {
patches = [
# Work around https://github.com/anrieff/libcpuid/pull/102.
./stdint.patch
# Fixes cross-compilation to NetBSD, remove me for libcpuid > 0.5.1
(fetchpatch {
name = "use-popcount-from-libc.patch";
url = "https://github.com/anrieff/libcpuid/commit/1acaf9980b55ae180cc08db218b9face28202519.patch";
sha256 = "0lvsv9baq0sria1f1ncn1b2783js29lfs5fv8milp54pg1wd5b7q";
})
];
nativeBuildInputs = [ autoreconfHook ];

View file

@ -166,8 +166,7 @@ in
i686-embedded = mapTestOnCross lib.systems.examples.i686-embedded embedded;
x86_64-embedded = mapTestOnCross lib.systems.examples.x86_64-embedded embedded;
# TODO: fix cross compilation of nix{,Unstable} to netbsd and switch to common
x86_64-netbsd = mapTestOnCross lib.systems.examples.x86_64-netbsd embedded;
x86_64-netbsd = mapTestOnCross lib.systems.examples.x86_64-netbsd common;
# we test `embedded` instead of `linuxCommon` because very few packages
# successfully cross-compile to Redox so far