diff --git a/pkgs/development/tools/misc/libtree/default.nix b/pkgs/development/tools/misc/libtree/default.nix new file mode 100644 index 000000000000..f852b7ea7adf --- /dev/null +++ b/pkgs/development/tools/misc/libtree/default.nix @@ -0,0 +1,57 @@ +{ lib +, stdenv +, fetchFromGitHub +, fetchpatch +, binutils +, chrpath +, cmake +, cxxopts +, elfio +, termcolor +, gtest +}: + +stdenv.mkDerivation rec { + pname = "libtree"; + version = "2.0.0"; + + src = fetchFromGitHub { + owner = "haampie"; + repo = "libtree"; + rev = "v${version}"; + sha256 = "sha256-j54fUwMkX4x4MwL8gMraguK9GqQRBjCC+W6ojFnQdHQ="; + }; + + patches = [ + # add missing include + # https://github.com/haampie/libtree/pull/42 + (fetchpatch { + url = "https://github.com/haampie/libtree/commit/219643ff6edcae42c9546b8ba38cfec9d19b034e.patch"; + sha256 = "sha256-vdFmmBdBiOT3QBcwd3SuiolcaFTFAb88kU1KN8229K0="; + }) + ]; + + postPatch = '' + substituteInPlace src/main.cpp \ + --replace "std::string strip = \"strip\";" "std::string strip = \"${binutils}/bin/strip\";" \ + --replace "std::string chrpath = \"chrpath\";" "std::string chrpath = \"${chrpath}/bin/chrpath\";" + ''; + + nativeBuildInputs = [ cmake ]; + + buildInputs = [ cxxopts elfio termcolor ]; + + doCheck = true; + + checkInputs = [ gtest ]; + + cmakeFlags = [ "-DLIBTREE_BUILD_TESTS=ON" ]; + + meta = with lib; { + description = "Tree ldd with an option to bundle dependencies into a single folder"; + homepage = "https://github.com/haampie/libtree"; + license = licenses.mit; + platforms = platforms.linux; + maintainers = with maintainers; [ prusnak rardiol ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0653b93b25d8..c95890bc6334 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7312,6 +7312,8 @@ with pkgs; libtins = callPackage ../development/libraries/libtins { }; + libtree = callPackage ../development/tools/misc/libtree { }; + libshout = callPackage ../development/libraries/libshout { }; libqb = callPackage ../development/libraries/libqb { };