Unverified Commit 9d0b8ae5 authored by Yohann Boniface's avatar Yohann Boniface Committed by GitHub
Browse files

usbtop: fix build against CMake >= 4.0 (#449129)

parents aa3fae86 dabf8f70
Loading
Loading
Loading
Loading
+19 −7
Original line number Diff line number Diff line
@@ -7,29 +7,41 @@
  boost,
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "usbtop";
  version = "1.0";

  src = fetchFromGitHub {
    owner = "aguinet";
    repo = "usbtop";
    rev = "release-${version}";
    sha256 = "0qbad0aq6j4jrh90l6a0akk71wdzhyzmy6q8wl138axyj2bp9kss";
    tag = "release-${finalAttrs.version}";
    hash = "sha256-Ws90l5C+KzQC5QgbX7+Hv/Fw5lRAGQoSzJJIgxVoamE=";
  };

  postPatch =
    # fix compatibility with CMake (https://cmake.org/cmake/help/v4.0/command/cmake_minimum_required.html)
    # TODO: drop when https://github.com/aguinet/usbtop/pull/45 is merged
    ''
      substituteInPlace CMakeLists.txt \
        --replace-fail \
          'cmake_minimum_required(VERSION 2.8)' \
          'cmake_minimum_required(VERSION 2.8...4.0)'
    '';

  nativeBuildInputs = [ cmake ];

  buildInputs = [
    libpcap
    boost
  ];

  meta = with lib; {
  meta = {
    homepage = "https://github.com/aguinet/usbtop";
    changelog = "https://github.com/aguinet/usbtop/raw/${finalAttrs.src.rev}/CHANGELOG";
    description = "Top utility that shows an estimated instantaneous bandwidth on USB buses and devices";
    mainProgram = "usbtop";
    maintainers = [ ];
    license = licenses.bsd3;
    platforms = platforms.linux;
    license = lib.licenses.bsd3;
    platforms = lib.platforms.linux;
  };
}
})