From 497652997a41ab2968c6812bc28cd09f0f3126c8 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Tue, 11 Mar 2025 00:10:56 +0000 Subject: [PATCH] eztrace: 1.1-11 -> 2.1.1, fix build, adopt --- pkgs/by-name/ez/eztrace/0001-otf2.patch | 19 +++++++ pkgs/by-name/ez/eztrace/package.nix | 68 ++++++++++++++++++------- 2 files changed, 70 insertions(+), 17 deletions(-) create mode 100644 pkgs/by-name/ez/eztrace/0001-otf2.patch diff --git a/pkgs/by-name/ez/eztrace/0001-otf2.patch b/pkgs/by-name/ez/eztrace/0001-otf2.patch new file mode 100644 index 00000000000000..21c9cd9879dbc4 --- /dev/null +++ b/pkgs/by-name/ez/eztrace/0001-otf2.patch @@ -0,0 +1,19 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b36a8a94..61019e71 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -32,7 +32,13 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + # CMakeFind repository + list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules) + +-find_package (OTF2 REQUIRED) ++PKG_CHECK_MODULES(OTF2 REQUIRED otf2) ++SET(OTF2_INCLUDE_PATH ${OTF2_INCLUDE_DIRS}) ++SET(OTF2_LIBRARY ${OTF2_LIBRARIES}) ++STRING(REPLACE "." ";" _VERSION ${OTF2_VERSION}) ++LIST(GET _VERSION 0 OTF2_MAJOR_VERSION) ++LIST(GET _VERSION 1 OTF2_MINOR_VERSION) ++ + if (NOT OTF2_FOUND) + message(FATAL_ERROR "libotf2 not found.") + endif() diff --git a/pkgs/by-name/ez/eztrace/package.nix b/pkgs/by-name/ez/eztrace/package.nix index 8a5b3dbeb91c7c..dd00a79ec292d4 100644 --- a/pkgs/by-name/ez/eztrace/package.nix +++ b/pkgs/by-name/ez/eztrace/package.nix @@ -2,43 +2,77 @@ lib, stdenv, fetchFromGitLab, + cmake, gfortran, + pkg-config, libelf, libiberty, - zlib, - # Once https://gitlab.com/eztrace/eztrace/-/issues/41 - # is released we can switch to latest binutils. - libbfd_2_38, - libopcodes_2_38, - autoreconfHook, + libbfd, + libopcodes, + libotf2, }: stdenv.mkDerivation rec { - pname = "EZTrace"; - version = "1.1-11"; + pname = "eztrace"; + version = "2.1.1"; + + outputs = [ + "out" + "lib" + "man" + ]; src = fetchFromGitLab { owner = "eztrace"; repo = "eztrace"; - rev = "eztrace-${version}"; - hash = "sha256-A6HMr4ib5Ka1lTbbTQOdq3kIdCoN/CwAKRdXdv9wpfU="; + tag = "${version}"; + hash = "sha256-ccW4YjEf++tkdIJLze2x8B/SWbBBXnYt8UV9OH8+KGU="; }; + patches = [ + ./0001-otf2.patch + ]; + + postPatch = '' + substituteInPlace src/eztrace-lib/eztrace_otf2.c \ + --replace-fail "/bin/rm" "rm" + substituteInPlace cmake_modules/FindOTF2.cmake \ + --replace-fail otf2-config "${lib.getExe' libotf2 "otf2-config"}" + patchShebangs test + ''; + + strictDeps = true; + + cmakeFlags = [ + (lib.cmakeBool "EZTRACE_ENABLE_MEMORY" true) + ]; + nativeBuildInputs = [ + cmake + pkg-config + libotf2 gfortran - autoreconfHook ]; + buildInputs = [ libelf libiberty - zlib - libbfd_2_38 - libopcodes_2_38 + libbfd + libopcodes + libotf2 ]; - meta = with lib; { + doCheck = true; + + meta = { description = "Tool that aims at generating automatically execution trace from HPC programs"; - license = licenses.cecill-b; - maintainers = [ ]; + license = lib.licenses.cecill-b; + maintainers = [ lib.maintainers.xokdvium ]; + mainProgram = "eztrace"; + badPlatforms = [ + # Undefined symbols for architecture x86_64: + # > "___cyg_profile_func_enter", referenced from: + lib.systems.inspect.patterns.isDarwin + ]; }; }