Files
jungle/pkgs/papi/default.nix
2026-03-19 12:13:46 +01:00

30 lines
1.0 KiB
Nix

{
stdenv,
papi,
}:
if stdenv.hostPlatform == stdenv.buildPlatform then
papi
else
papi.overrideAttrs (old: {
configureFlags = (old.configureFlags or [ ]) ++ [
# Only perf-events works when cross compiling, since for the rest, papi's
# configure.in uses `test -f` which is not allowed when cross-compiling.
# FIXME: patch configure.in to skip the faulty checks when cross-compiling
"--disable-perf_event_uncore"
"--with-sysdetect=no"
# Flags below are adapted from "cross compile sample" in papi's
# src/configure.in. (--host is already set by nix). Verified to
# cross-compile in both riscv64 and aarch64-multiplatform targets.
"--with-ffsll"
"--with-tls=__thread"
"--with-virtualtimer=clock_thread_cputime_id"
"--with-walltimer=clock_realtime"
"--with-perf-events"
"--with-CPU=${stdenv.hostPlatform.uname.processor}"
"--with-arch=${stdenv.hostPlatform.uname.processor}"
];
patches = (old.patches or [ ]) ++ [ ./fix-ar-cross.patch ];
})