Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 52 lines 1.7 kB view raw
1{ lib 2, stdenv 3, fetchurl 4, enableShared ? !stdenv.hostPlatform.isStatic 5, windows 6}: 7 8stdenv.mkDerivation (finalAttrs: { 9 version = "4.13.0"; 10 pname = "libpfm"; 11 12 src = fetchurl { 13 url = "mirror://sourceforge/perfmon2/libpfm4/libpfm-${finalAttrs.version}.tar.gz"; 14 sha256 = "sha256-0YuXdkx1VSjBBR03bjNUXQ62DG6/hWgENoE/pbBMw9E="; 15 }; 16 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 ]; 20 21 # Upstream uses "WINDOWS" instead of "Windows" which is incorrect 22 # See: https://github.com/NixOS/nixpkgs/pull/252982#discussion_r1314346216 23 postPatch = '' 24 substituteInPlace config.mk examples/Makefile \ 25 --replace '($(SYS),WINDOWS)' '($(SYS),Windows)' 26 ''; 27 28 makeFlags = [ 29 "PREFIX=${placeholder "out"}" 30 "LDCONFIG=true" 31 "ARCH=${stdenv.hostPlatform.uname.processor}" 32 "SYS=${stdenv.hostPlatform.uname.system}" 33 ]; 34 35 env.NIX_CFLAGS_COMPILE = "-Wno-error"; 36 env.CONFIG_PFMLIB_SHARED = if enableShared then "y" else "n"; 37 38 buildInputs = lib.optional stdenv.hostPlatform.isWindows windows.libgnurx; 39 40 meta = with lib; { 41 description = "Helper library to program the performance monitoring events"; 42 longDescription = '' 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. 47 ''; 48 license = licenses.gpl2; 49 maintainers = with maintainers; [ pierron t4ccer ]; 50 platforms = platforms.linux ++ platforms.windows; 51 }; 52})