nix: fix unicorn for apple arm64 VM (#3217)

* nix: fix unicorn for apple arm64 VM

* fix
pull/3222/head
patryk4815 4 months ago committed by GitHub
parent f9f90d9f02
commit 83de3e5bd5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -198,6 +198,7 @@ let
cctools,
stdenv,
fetchFromGitHub,
fetchpatch,
}:
prev.unicorn.overrideAttrs (
old:
@ -214,17 +215,22 @@ let
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace ./src/CMakeLists.txt \
--replace-fail 'set(CMAKE_C_COMPILER "/usr/bin/cc")' 'set(CMAKE_C_COMPILER "${stdenv.cc}/bin/cc")' || true
# Due to an issue with the Apple ARM64 Hypervisor on GitHub Actions,
# we need to force the `sprr` register check.
# Otherwise, Nix may cache broken builds.
# See:
# - https://github.com/actions/runner-images/issues/11127
# - https://github.com/unicorn-engine/unicorn/issues/2033
substituteInPlace ./src/qemu/configure \
--replace-fail "have_sprr_mrs='no'" "have_sprr_mrs='yes'"
--replace-fail 'set(CMAKE_C_COMPILER "/usr/bin/cc")' 'set(CMAKE_C_COMPILER "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc")'
'';
# Remove this block after upgrading to unicorn 2.2.0
patches = lib.optionals stdenv.hostPlatform.isDarwin [
(fetchpatch {
url = "https://github.com/unicorn-engine/unicorn/commit/79f910ea73220f4f603b6050593af86483573908.patch";
hash = "sha256-AIMetsuYx1wz2KNtHcsyBfue+dBIDMVdqIiPaQ3xfgs=";
includes = [
"src/qemu/configure"
"src/qemu/include/tcg/tcg-apple-jit.h"
];
stripLen = 1;
extraPrefix = "src/";
})
];
}
// lib.optionalAttrs stdenv.hostPlatform.isLoongArch64 {
# Remove this block after upgrading to unicorn 2.2.0

Loading…
Cancel
Save