4 , enableShared ? !stdenv.hostPlatform.isStatic
8 stdenv.mkDerivation (finalAttrs: {
13 url = "mirror://sourceforge/perfmon2/libpfm4/libpfm-${finalAttrs.version}.tar.gz";
14 sha256 = "sha256-0YuXdkx1VSjBBR03bjNUXQ62DG6/hWgENoE/pbBMw9E=";
17 # Don't install libpfm.so on windows as it doesn't exist
18 # This target is created only if `ifeq ($(SYS),Linux)` passes
19 patches = [ ./fix-windows.patch ];
21 # Upstream uses "WINDOWS" instead of "Windows" which is incorrect
22 # See: https://github.com/NixOS/nixpkgs/pull/252982#discussion_r1314346216
24 substituteInPlace config.mk examples/Makefile \
25 --replace '($(SYS),WINDOWS)' '($(SYS),Windows)'
29 "PREFIX=${placeholder "out"}"
31 "ARCH=${stdenv.hostPlatform.uname.processor}"
32 "SYS=${stdenv.hostPlatform.uname.system}"
35 env.NIX_CFLAGS_COMPILE = "-Wno-error";
36 env.CONFIG_PFMLIB_SHARED = if enableShared then "y" else "n";
38 buildInputs = lib.optional stdenv.hostPlatform.isWindows windows.libgnurx;
41 description = "Helper library to program the performance monitoring events";
43 This package provides a library, called libpfm4 which is used to
44 develop monitoring tools exploiting the performance monitoring
45 events such as those provided by the Performance Monitoring Unit
46 (PMU) of modern processors.
48 license = licenses.gpl2;
49 maintainers = with maintainers; [ pierron t4ccer ];
50 platforms = platforms.linux ++ platforms.windows;