2023-11-23 21:54:48 +00:00
|
|
|
{ lib, stdenv, cmake, zlib, fetchFromGitHub, re2, abseil-cpp, protobuf, capstone, gtest, pkg-config, lit, llvmPackages_16 }:
|
2016-11-08 20:13:50 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "bloaty";
|
2023-11-18 17:05:16 +00:00
|
|
|
version = "1.1-unstable-2023-11-06";
|
2016-11-08 20:13:50 +00:00
|
|
|
|
2017-07-19 11:45:28 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "bloaty";
|
2023-11-18 17:05:16 +00:00
|
|
|
rev = "16f9fe54d9cd0e9abe1d25fc1a9b44c214cfaa9f";
|
2023-11-23 21:54:48 +00:00
|
|
|
hash = "sha256-mIVlNMKtJMfH2QdYZ6+oV7619oYzvKkq3fHY6uofqlM=";
|
2016-11-08 20:13:50 +00:00
|
|
|
};
|
|
|
|
|
2023-11-23 21:54:48 +00:00
|
|
|
# Old vendored package which has no other use than here, so not packaged in nixpkgs.
|
|
|
|
demumble = fetchFromGitHub {
|
|
|
|
owner = "nico";
|
|
|
|
repo = "demumble";
|
|
|
|
rev = "01098eab821b33bd31b9778aea38565cd796aa85";
|
|
|
|
hash = "sha256-605SsXd7TSdm3BH854ChHIZbOXcHI/n8RN+pFMz4Ex4=";
|
|
|
|
};
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DLIT_EXECUTABLE=${lit}/bin/lit"
|
|
|
|
"-DFILECHECK_EXECUTABLE=${llvmPackages_16.libllvm}/bin/FileCheck"
|
|
|
|
"-DYAML2OBJ_EXECUTABLE=${llvmPackages_16.libllvm}/bin/yaml2obj"
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# Build system relies on some of those source files
|
|
|
|
rm -rf third_party/googletest third_party/abseil-cpp third_party/demumble
|
|
|
|
ln -s ${gtest.src} third_party/googletest
|
|
|
|
ln -s ${abseil-cpp.src} third_party/abseil-cpp
|
|
|
|
ln -s ${demumble} third_party/demumble
|
|
|
|
substituteInPlace CMakeLists.txt \
|
|
|
|
--replace "find_package(Python COMPONENTS Interpreter)" "" \
|
|
|
|
--replace "if(Python_FOUND AND LIT_EXECUTABLE" "if(LIT_EXECUTABLE" \
|
|
|
|
--replace "COMMAND \''\${Python_EXECUTABLE} \''\${LIT_EXECUTABLE}" "COMMAND \''\${LIT_EXECUTABLE}"
|
|
|
|
# wasm test fail. Possibly due to LLVM version < 17. See https://github.com/google/bloaty/pull/354
|
|
|
|
rm -rf tests/wasm
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
2017-07-19 11:45:28 +00:00
|
|
|
|
2023-11-23 21:54:48 +00:00
|
|
|
buildInputs = [ zlib re2 abseil-cpp protobuf capstone gtest lit llvmPackages_16.libllvm ];
|
2016-11-08 20:13:50 +00:00
|
|
|
|
2017-07-19 11:45:28 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
2023-11-23 21:54:48 +00:00
|
|
|
postCheck = ''
|
|
|
|
# These lit tests need to be build seperatly.
|
|
|
|
# See https://github.com/google/bloaty/blob/main/tests/README.md
|
|
|
|
cmake --build . --target check-bloaty
|
|
|
|
'';
|
2016-11-08 20:13:50 +00:00
|
|
|
installPhase = ''
|
|
|
|
install -Dm755 {.,$out/bin}/bloaty
|
|
|
|
'';
|
|
|
|
|
2021-01-23 12:26:19 +00:00
|
|
|
meta = with lib; {
|
2016-11-08 20:13:50 +00:00
|
|
|
description = "a size profiler for binaries";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/google/bloaty";
|
2016-11-08 20:13:50 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.unix;
|
2020-05-26 22:15:55 +00:00
|
|
|
maintainers = with maintainers; [ dtzWill ];
|
2016-11-08 20:13:50 +00:00
|
|
|
};
|
|
|
|
}
|