Skip to content

Commit

Permalink
user/bloaty: new package
Browse files Browse the repository at this point in the history
  • Loading branch information
q66 committed Oct 27, 2024
1 parent f89b47d commit ba7ee22
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
20 changes: 20 additions & 0 deletions user/bloaty/patches/cpp17.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@
cmake_policy(SET CMP0048 NEW)
project (Bloaty VERSION 1.0)
project (Bloaty VERSION 1.1)
-set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD 17)

# Options we define for users.
option(BLOATY_ENABLE_ASAN "Enable address sanitizer." OFF)
@@ -93,7 +93,7 @@
include_directories("${CMAKE_CURRENT_BINARY_DIR}/src")

# Baseline build flags.
-set(CMAKE_CXX_FLAGS "-std=c++11 -W -Wall -Wno-sign-compare")
+set(CMAKE_CXX_FLAGS "-W -Wall -Wno-sign-compare")
set(CMAKE_CXX_FLAGS_DEBUG "-g1")
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g1")
58 changes: 58 additions & 0 deletions user/bloaty/patches/system-abseil.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,6 +35,12 @@
MESSAGE(STATUS "pkg-config not found, using bundled dependencies")
endif(${PKG_CONFIG_FOUND})
endif(UNIX)
+find_package(absl CONFIG)
+if(absl_FOUND)
+ MESSAGE(STATUS "System absl found, using")
+else()
+ MESSAGE(STATUS "System absl not found, using bundled version")
+endif()

# Set default build type.
if(NOT CMAKE_BUILD_TYPE)
@@ -89,7 +95,6 @@

include_directories(.)
include_directories(src)
-include_directories(third_party/abseil-cpp)
include_directories("${CMAKE_CURRENT_BINARY_DIR}/src")

# Baseline build flags.
@@ -159,24 +164,6 @@
src/macho.cc
src/range_map.cc
src/webassembly.cc
- # 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
- third_party/abseil-cpp/absl/numeric/int128.cc
- third_party/abseil-cpp/absl/strings/ascii.cc
- third_party/abseil-cpp/absl/strings/charconv.cc
- third_party/abseil-cpp/absl/strings/escaping.cc
- third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc
- third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc
- third_party/abseil-cpp/absl/strings/internal/memutil.cc
- third_party/abseil-cpp/absl/strings/internal/utf8.cc
- third_party/abseil-cpp/absl/strings/match.cc
- third_party/abseil-cpp/absl/strings/numbers.cc
- third_party/abseil-cpp/absl/strings/str_cat.cc
- third_party/abseil-cpp/absl/strings/string_view.cc
- third_party/abseil-cpp/absl/strings/str_split.cc
- third_party/abseil-cpp/absl/strings/substitute.cc
- 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
)
@@ -214,6 +201,9 @@
endif(${PROTOBUF_FOUND})
endif(UNIX)

+list(APPEND LIBBLOATY_LIBS absl::strings)
+list(APPEND LIBBLOATY_LIBS absl::optional)
+
if(DEFINED ENV{LIB_FUZZING_ENGINE})
message("LIB_FUZZING_ENGINE set, building fuzz_target instead of Bloaty")
add_executable(fuzz_target tests/fuzz_target.cc)
22 changes: 22 additions & 0 deletions user/bloaty/template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
pkgname = "bloaty"
pkgver = "1.1"
pkgrel = 0
build_style = "cmake"
hostmakedepends = ["cmake", "ninja", "pkgconf", "protobuf"]
makedepends = [
"abseil-cpp-devel",
"capstone-devel",
"protobuf-devel",
"re2-devel",
"zlib-ng-compat-devel",
]
pkgdesc = "Size profiler for binaries"
maintainer = "q66 <q66@chimera-linux.org>"
license = "Apache-2.0"
url = "https://github.com/google/bloaty"
source = f"{url}/releases/download/v{pkgver}/bloaty-{pkgver}.tar.bz2"
sha256 = "a308d8369d5812aba45982e55e7c3db2ea4780b7496a5455792fb3dcba9abd6f"


def install(self):
self.install_bin("build/bloaty")

0 comments on commit ba7ee22

Please sign in to comment.