diff options
author | Rasmus Thomsen <oss@cogitri.dev> | 2020-03-01 23:47:53 +0100 |
---|---|---|
committer | Leo <thinkabit.ukim@gmail.com> | 2020-03-02 01:26:07 -0300 |
commit | 1e4f09f914e119b53d73930769fac94a658596c3 (patch) | |
tree | 16685faec4253497a143810b247ea6d3e2493d15 /community/bloaty | |
parent | e0ec81cf49186a71b9bd35a478ac1306b2edc77c (diff) | |
download | aports-1e4f09f914e119b53d73930769fac94a658596c3.tar.bz2 aports-1e4f09f914e119b53d73930769fac94a658596c3.tar.xz |
community/bloaty: move from testing
Diffstat (limited to 'community/bloaty')
-rw-r--r-- | community/bloaty/2aec85618e91af975af3146563333c2c2e97260.patch | 213 | ||||
-rw-r--r-- | community/bloaty/APKBUILD | 41 | ||||
-rw-r--r-- | community/bloaty/f66077506462bf96fee79f7f20516ca5d1e02f8a.patch | 22 |
3 files changed, 276 insertions, 0 deletions
diff --git a/community/bloaty/2aec85618e91af975af3146563333c2c2e97260.patch b/community/bloaty/2aec85618e91af975af3146563333c2c2e97260.patch new file mode 100644 index 0000000000..939ea01146 --- /dev/null +++ b/community/bloaty/2aec85618e91af975af3146563333c2c2e97260.patch @@ -0,0 +1,213 @@ +From 2aec85618e91af975af3146563333c2c2e972607 Mon Sep 17 00:00:00 2001 +From: Steve Wills <steve@mouf.net> +Date: Fri, 4 Jan 2019 14:12:40 -0500 +Subject: [PATCH] Use system deps for protobuf, capstone and re2 + +Also, add option to disable setting build id for systems where this flag +is not supported by ld and an option to disable installing cmake target +files in case they aren't needed. +--- + CMakeLists.txt | 140 ++++++++++++++++++++++++++++++++++++++++++------- + 1 file changed, 120 insertions(+), 20 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6f8da51..b61ffea 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,6 +5,34 @@ project (Bloaty VERSION 1.0) + # Options we define for users. + option(BLOATY_ENABLE_ASAN "Enable address sanitizer." OFF) + option(BLOATY_ENABLE_UBSAN "Enable undefined behavior sanitizer." OFF) ++option(BLOATY_ENABLE_CMAKETARGETS "Enable installing cmake target files." ON) ++option(BLOATY_ENABLE_BUILDID "Enable build id." ON) ++ ++if(UNIX) ++find_package(PkgConfig) ++if(${PKG_CONFIG_FOUND}) ++pkg_search_module(RE2 re2) ++pkg_search_module(CAPSTONE capstone) ++pkg_search_module(PROTOBUF protobuf) ++if(${RE2_FOUND}) ++ MESSAGE(STATUS "System re2 found, using") ++else(${RE2_FOUND}) ++ MESSAGE(STATUS "System re2 not found, using bundled version") ++endif(${RE2_FOUND}) ++if(${CAPSTONE_FOUND}) ++ MESSAGE(STATUS "System capstone found, using") ++else(${CAPSTONE_FOUND}) ++ MESSAGE(STATUS "System capstone not found, using bundled version") ++endif(${CAPSTONE_FOUND}) ++if(${PROTOBUF_FOUND}) ++ MESSAGE(STATUS "System protobuf found, using") ++else(${PROTOBUF_FOUND}) ++ MESSAGE(STATUS "System protobuf not found, using bundled version") ++endif(${PROTOBUF_FOUND}) ++else(${PKG_CONFIG_FOUND}) ++ MESSAGE(STATUS "pkg-config not found, using bundled dependencies") ++endif(${PKG_CONFIG_FOUND}) ++endif(UNIX) + + # Set default build type. + if(NOT CMAKE_BUILD_TYPE) +@@ -21,19 +49,42 @@ if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules") + endif() + + # Add third_party libraries, disabling as much as we can of their builds. +-set(RE2_BUILD_TESTING OFF CACHE BOOL "enable testing for RE2" FORCE) +-set(CAPSTONE_BUILD_SHARED OFF CACHE BOOL "Build shared library" FORCE) +-set(CAPSTONE_BUILD_TESTS OFF CACHE BOOL "Build tests" FORCE) +-set(protobuf_BUILD_TESTS OFF CACHE BOOL "enable tests for proto2" FORCE) +-set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "enable shared libs for proto2" FORCE) ++ + add_definitions(-D_LIBCXXABI_FUNC_VIS=) # For Demumble. +-add_subdirectory(third_party/re2) +-add_subdirectory(third_party/capstone) +-add_subdirectory(third_party/protobuf/cmake) + +-include_directories(third_party/capstone/include) +-include_directories(third_party/re2) +-include_directories(third_party/protobuf/src) ++if(UNIX) ++ if(${RE2_FOUND}) ++ include_directories(${RE2_INCLUDE_DIRS}) ++ else(${RE2_FOUND}) ++ set(RE2_BUILD_TESTING OFF CACHE BOOL "enable testing for RE2" FORCE) ++ add_subdirectory(third_party/re2) ++ include_directories(third_party/re2) ++ endif(${RE2_FOUND}) ++ if(${CAPSTONE_FOUND}) ++ include_directories(${CAPSTONE_INCLUDE_DIRS}) ++ else(${CAPSTONE_FOUND}) ++ set(CAPSTONE_BUILD_SHARED OFF CACHE BOOL "Build shared library" FORCE) ++ set(CAPSTONE_BUILD_TESTS OFF CACHE BOOL "Build tests" FORCE) ++ add_subdirectory(third_party/capstone) ++ include_directories(third_party/capstone/include) ++ endif(${CAPSTONE_FOUND}) ++ if(${PROTOBUF_FOUND}) ++ include_directories(${PROTOBUF_INCLUDE_DIRS}) ++ else(${PROTOBUF_FOUND}) ++ set(protobuf_BUILD_TESTS OFF CACHE BOOL "enable tests for proto2" FORCE) ++ set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "enable shared libs for proto2" FORCE) ++ add_subdirectory(third_party/protobuf/cmake) ++ include_directories(third_party/protobuf/src) ++ endif(${PROTOBUF_FOUND}) ++else(UNIX) ++ add_subdirectory(third_party/re2) ++ add_subdirectory(third_party/capstone) ++ add_subdirectory(third_party/protobuf/cmake) ++ include_directories(third_party/re2) ++ include_directories(third_party/capstone/include) ++ include_directories(third_party/protobuf/src) ++endif(UNIX) ++ + include_directories(.) + include_directories(src) + include_directories(third_party/abseil-cpp) +@@ -47,7 +98,9 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g1") + + if(APPLE) + elseif(UNIX) +- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--build-id") ++ if(BLOATY_ENABLE_BUILDID) ++ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--build-id") ++ endif(BLOATY_ENABLE_BUILDID) + endif() + + # When using Ninja, compiler output won't be colorized without this. +@@ -73,6 +126,7 @@ if(DEFINED ENV{CXXFLAGS}) + endif() + + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/src) ++if(${PROTOC_FOUND}) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/src/bloaty.pb.cc + DEPENDS protoc ${CMAKE_CURRENT_SOURCE_DIR}/src/bloaty.proto +@@ -80,6 +134,14 @@ add_custom_command( + --cpp_out=${CMAKE_CURRENT_BINARY_DIR}/src + -I${CMAKE_CURRENT_SOURCE_DIR}/src + ) ++else(${PROTOC_FOUND}) ++add_custom_command( ++ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/src/bloaty.pb.cc ++ COMMAND protoc ${CMAKE_CURRENT_SOURCE_DIR}/src/bloaty.proto ++ --cpp_out=${CMAKE_CURRENT_BINARY_DIR}/src ++ -I${CMAKE_CURRENT_SOURCE_DIR}/src ++) ++endif(${PROTOC_FOUND}) + + add_library(libbloaty + src/bloaty.cc +@@ -112,9 +174,38 @@ add_library(libbloaty + third_party/demumble/third_party/libcxxabi/cxa_demangle.cpp + ) + ++if(UNIX) ++ set(LIBBLOATY_LIBS libbloaty) ++ if(${PROTOBUF_FOUND}) ++ set(LIBBLOATY_LIBS ${LIBBLOATY_LIBS} ${PROTOBUF_LIBRARIES}) ++ else(${PROTOBUF_FOUND}) ++ set(LIBBLOATY_LIBS ${LIBBLOATY_LIBS} libprotoc) ++ endif(${PROTOBUF_FOUND}) ++ if(${RE2_FOUND}) ++ set(LIBBLOATY_LIBS ${LIBBLOATY_LIBS} ${RE2_LIBRARIES}) ++ else(${RE2_FOUND}) ++ set(LIBBLOATY_LIBS ${LIBBLOATY_LIBS} re2) ++ endif(${RE2_FOUND}) ++ if(${CAPSTONE_FOUND}) ++ set(LIBBLOATY_LIBS ${LIBBLOATY_LIBS} ${CAPSTONE_LIBRARIES}) ++ else(${CAPSTONE_FOUND}) ++ set(LIBBLOATY_LIBS ${LIBBLOATY_LIBS} capstone-static) ++ endif(${CAPSTONE_FOUND}) ++else(UNIX) ++ set(LIBBLOATY_LIBS libbloaty libprotoc re2 capstone-static) ++endif(UNIX) + +-set(LIBBLOATY_LIBS libbloaty libprotoc re2 capstone-static) +- ++if(UNIX) ++ if(${RE2_FOUND}) ++ link_directories(${RE2_LIBRARY_DIRS}) ++ endif(${RE2_FOUND}) ++ if(${CAPSTONE_FOUND}) ++ link_directories(${CAPSTONE_LIBRARY_DIRS}) ++ endif(${CAPSTONE_FOUND}) ++ if(${PROTOBUF_FOUND}) ++ link_directories(${PROTOBUF_LIBRARY_DIRS}) ++ endif(${PROTOBUF_FOUND}) ++endif(UNIX) + + if(DEFINED ENV{LIB_FUZZING_ENGINE}) + message("LIB_FUZZING_ENGINE set, building fuzz_target instead of Bloaty") +@@ -134,11 +225,18 @@ else() + target_link_libraries(bloaty "${CMAKE_THREAD_LIBS_INIT}") + endif() + +- install( +- TARGETS bloaty +- EXPORT ${PROJECT_NAME}Targets +- RUNTIME DESTINATION bin +- ) ++ if(BLOATY_ENABLE_CMAKETARGETS) ++ install( ++ TARGETS bloaty ++ EXPORT ${PROJECT_NAME}Targets ++ RUNTIME DESTINATION bin ++ ) ++ else(BLOATY_ENABLE_CMAKETARGETS) ++ install( ++ TARGETS bloaty ++ RUNTIME DESTINATION bin ++ ) ++ endif(BLOATY_ENABLE_CMAKETARGETS) + + if (IS_DIRECTORY "${PROJECT_SOURCE_DIR}/tests") + enable_testing() +@@ -172,5 +270,7 @@ else() + endif() + endif() + +- install(EXPORT ${PROJECT_NAME}Targets NAMESPACE ${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME}) ++ if(BLOATY_ENABLE_CMAKETARGETS) ++ install(EXPORT ${PROJECT_NAME}Targets NAMESPACE ${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME}) ++ endif(BLOATY_ENABLE_CMAKETARGETS) + endif() diff --git a/community/bloaty/APKBUILD b/community/bloaty/APKBUILD new file mode 100644 index 0000000000..671c4b29b9 --- /dev/null +++ b/community/bloaty/APKBUILD @@ -0,0 +1,41 @@ +# Contributor: Rasmus Thomsen <oss@cogitri.dev> +# Maintainer: Rasmus Thomsen <oss@cogitri.dev> +pkgname=bloaty +pkgver=1.0 +pkgrel=1 +pkgdesc="Bloaty McBloatface: a size profiler for binaries" +url="https://github.com/google/bloaty" +arch="all" +license="Apache-2.0" +makedepends="cmake protobuf-dev re2-dev capstone-dev" +options="!check" # no test suite +source="https://github.com/google/bloaty/releases/download/v$pkgver/bloaty-$pkgver.tar.bz2 + f66077506462bf96fee79f7f20516ca5d1e02f8a.patch + 2aec85618e91af975af3146563333c2c2e97260.patch" + +build() { + if [ "$CBUILD" != "$CHOST" ]; then + CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux" + fi + cmake \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DBUILD_SHARED_LIBS=True \ + -DCMAKE_BUILD_TYPE=None \ + -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ + -DCMAKE_C_FLAGS="$CFLAGS" \ + ${CMAKE_CROSSOPTS} . + make +} + +package() { + make DESTDIR="$pkgdir" install + # Upstream forgot to install this via CMake. + install -m755 liblibbloaty.so "$pkgdir"/usr/lib/liblibbloaty.so.1.0.0 + ln -s liblibbloaty.so.1.0.0 "$pkgdir"/usr/lib/liblibbloaty.so.1 + ln -s liblibbloaty.so.1 "$pkgdir"/usr/lib/liblibbloaty.so +} + +sha512sums="3dd6cd25f5fdffc8702ac84fc87d7ab79c5fc0662a2ece3df0b531ebca368f78155b3f2eb646077e0ba91205b5bf8c4727587097b90162af6066ca6bfb3d4084 bloaty-1.0.tar.bz2 +fdb6b116bdc8cff8c00e73306d110a08e47bb28c8df280c292ecdb4bf0ed683fa3a6a08f21863afb0bb3552b3520a10047f08efc0e9f522f7f6cf03f1d55f527 f66077506462bf96fee79f7f20516ca5d1e02f8a.patch +ef5231aec33e2e2db9b7c793d92af5ea97c29d6bf874b6a1356ea2b77f79b2d592c553e145aa4b8e65d93c2abf71cbb51d493e6d77cdb46805afaa9a34a7f0e4 2aec85618e91af975af3146563333c2c2e97260.patch" diff --git a/community/bloaty/f66077506462bf96fee79f7f20516ca5d1e02f8a.patch b/community/bloaty/f66077506462bf96fee79f7f20516ca5d1e02f8a.patch new file mode 100644 index 0000000000..8ebc442895 --- /dev/null +++ b/community/bloaty/f66077506462bf96fee79f7f20516ca5d1e02f8a.patch @@ -0,0 +1,22 @@ +From f66077506462bf96fee79f7f20516ca5d1e02f8a Mon Sep 17 00:00:00 2001 +From: Julie Hockett <juliehockett@google.com> +Date: Fri, 17 Aug 2018 12:50:22 -0700 +Subject: [PATCH] Propagate linker flags from the command line + +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5ae4569..918b2fc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -46,7 +46,7 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g1") + + if(APPLE) + elseif(UNIX) +- set(CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id") ++ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--build-id") + endif() + + # When using Ninja, compiler output won't be colorized without this. |