Unverified Commit 21fcca99 authored by Sergei Zimmerman's avatar Sergei Zimmerman
Browse files

eztrace: 1.1-11 -> 2.1.1, fix build, adopt

parent 1e4c23f5
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
diff --git a/cmake_modules/FindOTF2.cmake b/cmake_modules/FindOTF2.cmake
index 2853f92a..af1f3225 100644
--- a/cmake_modules/FindOTF2.cmake
+++ b/cmake_modules/FindOTF2.cmake
@@ -15,11 +15,11 @@ IF(NOT OTF2_CONFIG OR NOT EXISTS ${OTF2_CONFIG})
 ELSE()
   message(STATUS "OTF2 installation found. (using ${OTF2_CONFIG})")
 
-  execute_process(COMMAND ${OTF2_CONFIG} "--cppflags" OUTPUT_VARIABLE OTF2_INCLUDE_PATH)
+  execute_process(COMMAND ${OTF2_CONFIG} "--cppflags" "--target" "backend" OUTPUT_VARIABLE OTF2_INCLUDE_PATH)
   STRING(REPLACE "\n" "" OTF2_INCLUDE_PATH ${OTF2_INCLUDE_PATH})
   STRING(REPLACE "-I" "" OTF2_INCLUDE_PATH ${OTF2_INCLUDE_PATH})
   
-  execute_process(COMMAND ${OTF2_CONFIG} "--ldflags" OUTPUT_VARIABLE _LINK_LD_ARGS)
+  execute_process(COMMAND ${OTF2_CONFIG} "--ldflags" "--target" "backend" OUTPUT_VARIABLE _LINK_LD_ARGS)
   STRING( REPLACE " " ";" _LINK_LD_ARGS ${_LINK_LD_ARGS} )
   FOREACH( _ARG ${_LINK_LD_ARGS} )
     IF(${_ARG} MATCHES "^-L")
@@ -29,7 +29,7 @@ ELSE()
     ENDIF(${_ARG} MATCHES "^-L")
   ENDFOREACH(_ARG)
 
-  execute_process(COMMAND ${OTF2_CONFIG} "--libs" OUTPUT_VARIABLE _LINK_LD_ARGS)
+  execute_process(COMMAND ${OTF2_CONFIG} "--libs" "--target" "backend" OUTPUT_VARIABLE _LINK_LD_ARGS)
   STRING( REPLACE " " ";" _LINK_LD_ARGS ${_LINK_LD_ARGS} )
   FOREACH( _ARG ${_LINK_LD_ARGS} )
     IF(${_ARG} MATCHES "^-l")
+58 −19
Original line number Diff line number Diff line
@@ -2,43 +2,82 @@
  lib,
  stdenv,
  fetchFromGitLab,
  cmake,
  gfortran,
  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,
  otf2,
}:

stdenv.mkDerivation rec {
  pname = "EZTrace";
  version = "1.1-11";
stdenv.mkDerivation (finalAttrs: {
  pname = "eztrace";
  version = "2.1.1";

  outputs = [
    "out"
    "lib"
    "man"
  ];

  src = fetchFromGitLab {
    owner = "eztrace";
    repo = "eztrace";
    rev = "eztrace-${version}";
    hash = "sha256-A6HMr4ib5Ka1lTbbTQOdq3kIdCoN/CwAKRdXdv9wpfU=";
    tag = "${finalAttrs.version}";
    hash = "sha256-ccW4YjEf++tkdIJLze2x8B/SWbBBXnYt8UV9OH8+KGU=";
  };

  patches = [
    ./0001-otf2-backend-cross.patch # To fix cross.
  ];

  postPatch = ''
    substituteInPlace src/eztrace-lib/eztrace_otf2.c \
      --replace-fail "/bin/rm" "rm"
    substituteInPlace cmake_modules/FindOTF2.cmake \
      --replace-fail "find_program(OTF2_CONFIG otf2-config REQUIRED)" \
                     "find_program(OTF2_CONFIG "${lib.getExe' otf2 "otf2-config"}" REQUIRED)" \
      --replace-fail "find_program(OTF2_PRINT otf2-print REQUIRED)" \
                     "find_program(OTF2_PRINT "${lib.getExe' otf2 "otf2-print"}" REQUIRED)"
    patchShebangs test
  '';

  strictDeps = true;

  cmakeFlags = [
    (lib.cmakeBool "EZTRACE_ENABLE_MEMORY" true)
    # This test is somewhat flaky and fails once per several rebuilds.
    (lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" "--exclude-regex;memory_tests")
  ];

  nativeBuildInputs = [
    cmake
    gfortran
    autoreconfHook
  ];

  buildInputs = [
    libelf
    libiberty
    zlib
    libbfd_2_38
    libopcodes_2_38
    libbfd
    libopcodes
    otf2
  ];

  meta = with lib; {
  doCheck = true;
  nativeCheckInputs = [
    otf2 # `otf2-print` needed by compiler_instrumentation_tests,pthread_tests,posixio_tests
  ];

  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
    ];
  };
}
})