Initial import

This commit is contained in:
Rich Mattes 2020-06-28 00:02:08 -04:00
parent 8b0f589a06
commit 92201dae82
4 changed files with 130 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/bloaty-1.1.tar.gz

65
bloaty-1.1-absl.patch Normal file
View File

@ -0,0 +1,65 @@
diff -up ./CMakeLists.txt.1 ./CMakeLists.txt
--- ./CMakeLists.txt.1 2020-05-24 00:36:23.000000000 -0400
+++ ./CMakeLists.txt 2020-05-26 21:06:16.035802108 -0400
@@ -36,6 +36,8 @@ else(${PKG_CONFIG_FOUND})
endif(${PKG_CONFIG_FOUND})
endif(UNIX)
+find_package(absl)
+
# Set default build type.
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
@@ -89,7 +91,6 @@ endif(UNIX)
include_directories(.)
include_directories(src)
-include_directories(third_party/abseil-cpp)
include_directories("${CMAKE_CURRENT_BINARY_DIR}/src")
# Baseline build flags.
@@ -159,6 +160,13 @@ add_library(libbloaty
src/macho.cc
src/range_map.cc
src/webassembly.cc
+)
+
+if (absl_FOUND)
+ target_link_libraries(libbloaty PUBLIC absl::base absl::strings absl::numeric)
+else()
+ include_directories(third_party/abseil-cpp)
+ target_sources(libbloaty
# Until Abseil has a proper CMake build system
third_party/abseil-cpp/absl/base/internal/raw_logging.cc # Grrrr...
third_party/abseil-cpp/absl/base/internal/throw_delegate.cc
@@ -179,7 +187,8 @@ add_library(libbloaty
third_party/abseil-cpp/absl/types/bad_optional_access.cc
# One source file, no special build system needed.
third_party/demumble/third_party/libcxxabi/cxa_demangle.cpp
- )
+ )
+endif()
if(UNIX)
set(LIBBLOATY_LIBS libbloaty)
@@ -249,9 +258,8 @@ else()
enable_testing()
if(BUILD_TESTING)
- add_subdirectory(third_party/googletest)
- include_directories(third_party/googletest/googletest/include)
- include_directories(third_party/googletest/googlemock/include)
+ find_package(GTest)
+ pkg_search_module(GMock gmock)
set(TEST_TARGETS
bloaty_test
@@ -261,7 +269,7 @@ else()
foreach(target ${TEST_TARGETS})
add_executable(${target} tests/${target}.cc)
- target_link_libraries(${target} "${LIBBLOATY_LIBS}" gtest_main gmock "${CMAKE_THREAD_LIBS_INIT}")
+ target_link_libraries(${target} "${LIBBLOATY_LIBS}" GTest::Main GTest::GTest ${GMock_LIBRARIES} "${CMAKE_THREAD_LIBS_INIT}")
endforeach(target)
add_executable(fuzz_test tests/fuzz_target.cc tests/fuzz_driver.cc)

63
bloaty.spec Normal file
View File

@ -0,0 +1,63 @@
Name: bloaty
Version: 1.1
Release: 2%{?dist}
Summary: A size profiler for binaries
License: ASL 2.0
URL: https://github.com/google/bloaty
Source0: https://github.com/google/bloaty/archive/v%{version}/%{name}-%{version}.tar.gz
# Patch to use system versions of abseil, google-test and google-mock
Patch0: bloaty-1.1-absl.patch
BuildRequires: abseil-cpp-devel
BuildRequires: capstone-devel
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: gmock-devel
BuildRequires: gtest-devel
BuildRequires: pkgconfig
BuildRequires: protobuf-devel
BuildRequires: re2-devel
%description
Ever wondered what's making your binary big? Bloaty McBloatface will show
you a size profile of the binary so you can understand what's taking up
space inside.
Bloaty works on binaries, shared objects, object files, and static
libraries. Bloaty supports the ELF and Mach-O formats, and has experimental
support for WebAssembly.
%prep
%autosetup -S gendiff
%build
%cmake . \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_SHARED_LIBS=OFF \
-DBLOATY_ENABLE_CMAKETARGETS=OFF \
-DBUILD_TESTING=ON
%make_build
%install
%make_install
%check
make test
%files
%license LICENSE
%doc README.md how-bloaty-works.md
%{_bindir}/bloaty
%changelog
* Wed May 27 2020 Rich Mattes <richmattes@gmail.com> - 1.1-2
- Don't remove buildroot in install
- Patch to use system gtest and gmock, enable tests
* Sat May 23 2020 Rich Mattes <richmattes@gmail.com> - 1.1-1
- Inital Package

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (bloaty-1.1.tar.gz) = b02f8b75ac7e88f64c93be770d207936cfcd5085d3b62be1cd08a39741d57bb06dc8f96e3ef08de936a514d2d570700bbc24727cfb54d541233aaa91b0c87171