diff options
author | Patrick McLean <patrick.mclean@sony.com> | 2019-03-11 19:15:59 -0700 |
---|---|---|
committer | Patrick McLean <chutzpah@gentoo.org> | 2019-03-11 19:15:59 -0700 |
commit | 8ba9e3e616b62ef293d2223b347e2cea6e25b1eb (patch) | |
tree | 783b5cc2125a299f99e60a113622b4a223bf34c4 /dev-util/bpftrace | |
parent | media-radio/js8call: bump (diff) | |
download | gentoo-8ba9e3e616b62ef293d2223b347e2cea6e25b1eb.tar.gz gentoo-8ba9e3e616b62ef293d2223b347e2cea6e25b1eb.tar.bz2 gentoo-8ba9e3e616b62ef293d2223b347e2cea6e25b1eb.zip |
dev-util/bpftrace: New package
Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
Diffstat (limited to 'dev-util/bpftrace')
-rw-r--r-- | dev-util/bpftrace/Manifest | 1 | ||||
-rw-r--r-- | dev-util/bpftrace/bpftrace-0.9_pre20190311.ebuild | 58 | ||||
-rw-r--r-- | dev-util/bpftrace/bpftrace-9999.ebuild | 58 | ||||
-rw-r--r-- | dev-util/bpftrace/files/bpftrace-0.9_pre20190311-bcc-0.9.patch | 13 | ||||
-rw-r--r-- | dev-util/bpftrace/files/bpftrace-0.9_pre20190311-install-libs.patch | 111 | ||||
-rw-r--r-- | dev-util/bpftrace/files/bpftrace-mandir.patch | 22 | ||||
-rw-r--r-- | dev-util/bpftrace/metadata.xml | 10 |
7 files changed, 273 insertions, 0 deletions
diff --git a/dev-util/bpftrace/Manifest b/dev-util/bpftrace/Manifest new file mode 100644 index 000000000000..fbf71324c932 --- /dev/null +++ b/dev-util/bpftrace/Manifest @@ -0,0 +1 @@ +DIST bpftrace-0.9_pre20190311.tar.xz 613856 BLAKE2B 7f670647305e61d9a11a87be44bc2228fee6b474bd920b460ecd6375f23d371e2cc8b0bb22eb4473807b92fc44c4f13eb3be72d048f75f3f59e814c201eddba6 SHA512 7091b16ef1dafdc75dd8e6f172da68ea31d0a89ad42192dc86ced6d22a3c200a385a3e63f5a829cfad42ee5ba44e806b50ac450d17a96ef438ed5668d5b0c55f diff --git a/dev-util/bpftrace/bpftrace-0.9_pre20190311.ebuild b/dev-util/bpftrace/bpftrace-0.9_pre20190311.ebuild new file mode 100644 index 000000000000..1f874815e93c --- /dev/null +++ b/dev-util/bpftrace/bpftrace-0.9_pre20190311.ebuild @@ -0,0 +1,58 @@ +# Copyright 2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit toolchain-funcs cmake-utils + +DESCRIPTION="High-level tracing language for eBPF" +HOMEPAGE="https://github.com/iovisor/bpftrace" + +if [[ ${PV} =~ 9{4,} ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/iovisor/${PN}" + BDEPEND="" +else + SRC_URI="mirror://gentoo/${P}.tar.xz" + #SRC_URI="https://github.com/iovisor/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64 ~x86" + BDEPEND="app-arch/xz-utils " +fi + +LICENSE="Apache-2.0" +SLOT="0" +IUSE="test" + +COMMON_DEPEND="sys-devel/clang:= + >=sys-devel/llvm-3.7.1:=[llvm_targets_BPF(+)] + >=dev-util/bcc-0.9.0:= + virtual/libelf" +DEPEND="${COMMON_DEPEND} + test? ( dev-cpp/gtest )" +RDEPEND="${COMMON_DEPEND}" +BDEPEND+="dev-util/cmake + sys-devel/flex + sys-devel/bison" + +PATCHES=( + "${FILESDIR}/bpftrace-0.9_pre20190311-bcc-0.9.patch" + "${FILESDIR}/bpftrace-0.9_pre20190311-install-libs.patch" + "${FILESDIR}/bpftrace-mandir.patch" +) + +# lots of fixing needed +RESTRICT="test" + +src_prepare() { + cmake-utils_src_prepare +} + +src_configure() { + local -a mycmakeargs + mycmakeargs=( + "-DSTATIC_LINKING:BOOL=OFF" + "-DBUILD_TESTING:BOOL=OFF" + ) + + cmake-utils_src_configure +} diff --git a/dev-util/bpftrace/bpftrace-9999.ebuild b/dev-util/bpftrace/bpftrace-9999.ebuild new file mode 100644 index 000000000000..1f874815e93c --- /dev/null +++ b/dev-util/bpftrace/bpftrace-9999.ebuild @@ -0,0 +1,58 @@ +# Copyright 2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit toolchain-funcs cmake-utils + +DESCRIPTION="High-level tracing language for eBPF" +HOMEPAGE="https://github.com/iovisor/bpftrace" + +if [[ ${PV} =~ 9{4,} ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/iovisor/${PN}" + BDEPEND="" +else + SRC_URI="mirror://gentoo/${P}.tar.xz" + #SRC_URI="https://github.com/iovisor/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64 ~x86" + BDEPEND="app-arch/xz-utils " +fi + +LICENSE="Apache-2.0" +SLOT="0" +IUSE="test" + +COMMON_DEPEND="sys-devel/clang:= + >=sys-devel/llvm-3.7.1:=[llvm_targets_BPF(+)] + >=dev-util/bcc-0.9.0:= + virtual/libelf" +DEPEND="${COMMON_DEPEND} + test? ( dev-cpp/gtest )" +RDEPEND="${COMMON_DEPEND}" +BDEPEND+="dev-util/cmake + sys-devel/flex + sys-devel/bison" + +PATCHES=( + "${FILESDIR}/bpftrace-0.9_pre20190311-bcc-0.9.patch" + "${FILESDIR}/bpftrace-0.9_pre20190311-install-libs.patch" + "${FILESDIR}/bpftrace-mandir.patch" +) + +# lots of fixing needed +RESTRICT="test" + +src_prepare() { + cmake-utils_src_prepare +} + +src_configure() { + local -a mycmakeargs + mycmakeargs=( + "-DSTATIC_LINKING:BOOL=OFF" + "-DBUILD_TESTING:BOOL=OFF" + ) + + cmake-utils_src_configure +} diff --git a/dev-util/bpftrace/files/bpftrace-0.9_pre20190311-bcc-0.9.patch b/dev-util/bpftrace/files/bpftrace-0.9_pre20190311-bcc-0.9.patch new file mode 100644 index 000000000000..0f3706fadf5f --- /dev/null +++ b/dev-util/bpftrace/files/bpftrace-0.9_pre20190311-bcc-0.9.patch @@ -0,0 +1,13 @@ +diff --git a/src/attached_probe.cpp b/src/attached_probe.cpp +index d7905cd..adbd40c 100644 +--- a/src/attached_probe.cpp ++++ b/src/attached_probe.cpp +@@ -376,7 +376,7 @@ void AttachedProbe::load_prog() + void AttachedProbe::attach_kprobe() + { + int perf_event_fd = bpf_attach_kprobe(progfd_, attachtype(probe_.type), +- eventname().c_str(), probe_.attach_point.c_str(), 0); ++ eventname().c_str(), probe_.attach_point.c_str(), 0, -1); + + if (perf_event_fd < 0) { + if (probe_.orig_name != probe_.name) { diff --git a/dev-util/bpftrace/files/bpftrace-0.9_pre20190311-install-libs.patch b/dev-util/bpftrace/files/bpftrace-0.9_pre20190311-install-libs.patch new file mode 100644 index 000000000000..68bd82559443 --- /dev/null +++ b/dev-util/bpftrace/files/bpftrace-0.9_pre20190311-install-libs.patch @@ -0,0 +1,111 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8ff6e1f..a276ba2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -43,9 +43,10 @@ find_package(FLEX REQUIRED) + bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc) + flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc) + add_flex_bison_dependency(flex_lexer bison_parser) +-add_library(parser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS}) +-target_compile_options(parser PRIVATE "-w") +-target_include_directories(parser PUBLIC src src/ast ${CMAKE_BINARY_DIR}) ++add_library(bpftraceparser ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS}) ++target_compile_options(bpftraceparser PRIVATE "-w") ++target_include_directories(bpftraceparser PUBLIC src src/ast ${CMAKE_BINARY_DIR}) ++install(TARGETS bpftraceparser LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + include(CheckSymbolExists) + set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) +diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt +index b8b0d96..0803c1e 100644 +--- a/resources/CMakeLists.txt ++++ b/resources/CMakeLists.txt +@@ -1,6 +1,7 @@ +-add_library(resources headers.cpp) ++add_library(bpftraceresources headers.cpp) + +-target_include_directories(resources PUBLIC ../src) ++target_include_directories(bpftraceresources PUBLIC ../src) ++install(TARGETS bpftraceresources LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + function(embed_headers output) + file(WRITE ${output} "#include \"headers.h\"\n\nnamespace bpftrace {\n") +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index b47f66d..36de26b 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -27,7 +27,8 @@ endif(HAVE_BCC_CREATE_MAP) + if(HAVE_GET_CURRENT_CGROUP_ID) + target_compile_definitions(bpftrace PRIVATE HAVE_GET_CURRENT_CGROUP_ID) + endif(HAVE_GET_CURRENT_CGROUP_ID) +-target_link_libraries(bpftrace arch ast parser resources) ++target_link_libraries(bpftrace bpftracearch bpftraceast bpftraceparser ++ bpftraceresources) + + if (STATIC_LINKING) + target_link_libraries(bpftrace ${LIBBCC_LIBRARIES}) +diff --git a/src/arch/CMakeLists.txt b/src/arch/CMakeLists.txt +index 425926e..13b5d31 100644 +--- a/src/arch/CMakeLists.txt ++++ b/src/arch/CMakeLists.txt +@@ -1,5 +1,7 @@ + if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64") +- add_library(arch aarch64.cpp) ++ add_library(bpftracearch aarch64.cpp) + else() +- add_library(arch x86_64.cpp) ++ add_library(bpftracearch x86_64.cpp) + endif() ++ ++install(TARGETS bpftracearch LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt +index 64db7b9..1a2eb6e 100644 +--- a/src/ast/CMakeLists.txt ++++ b/src/ast/CMakeLists.txt +@@ -1,4 +1,4 @@ +-add_library(ast ++add_library(bpftraceast + ast.cpp + codegen_llvm.cpp + irbuilderbpf.cpp +@@ -6,12 +6,13 @@ add_library(ast + semantic_analyser.cpp + ) + +-target_include_directories(ast PUBLIC ${CMAKE_SOURCE_DIR}/src) +-target_include_directories(ast PUBLIC ${CMAKE_SOURCE_DIR}/src/ast) +-target_include_directories(ast PUBLIC ${CMAKE_BINARY_DIR}) +-target_link_libraries(ast arch) ++target_include_directories(bpftraceast PUBLIC ${CMAKE_SOURCE_DIR}/src) ++target_include_directories(bpftraceast PUBLIC ${CMAKE_SOURCE_DIR}/src/ast) ++target_include_directories(bpftraceast PUBLIC ${CMAKE_BINARY_DIR}) ++target_link_libraries(bpftraceast bpftracearch) + +-add_dependencies(ast parser) ++add_dependencies(bpftraceast bpftraceparser) ++install(TARGETS bpftraceast LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + if (STATIC_LINKING) + set(clang_libs +@@ -31,16 +32,16 @@ if (STATIC_LINKING) + clangSerialization + clangToolingCore) + llvm_map_components_to_libnames(llvm_libs bpfcodegen ipo irreader mcjit orcjit ${LLVM_TARGETS_TO_BUILD}) +- target_link_libraries(ast ${clang_libs}) +- target_link_libraries(ast ${llvm_libs}) ++ target_link_libraries(bpftraceast ${clang_libs}) ++ target_link_libraries(bpftraceast ${llvm_libs}) + else() + find_library(found_LLVM LLVM HINTS ${LLVM_LIBRARY_DIRS}) + if(found_LLVM) +- target_link_libraries(ast LLVM) ++ target_link_libraries(bpftraceast LLVM) + else() + llvm_map_components_to_libnames(_llvm_libs bpfcodegen ipo irreader mcjit orcjit ${LLVM_TARGETS_TO_BUILD}) + llvm_expand_dependencies(llvm_libs ${_llvm_libs}) +- target_link_libraries(ast ${llvm_libs}) ++ target_link_libraries(bpftraceast ${llvm_libs}) + endif() +- target_link_libraries(ast libclang) ++ target_link_libraries(bpftraceast libclang) + endif() diff --git a/dev-util/bpftrace/files/bpftrace-mandir.patch b/dev-util/bpftrace/files/bpftrace-mandir.patch new file mode 100644 index 000000000000..d18c1e2f3210 --- /dev/null +++ b/dev-util/bpftrace/files/bpftrace-mandir.patch @@ -0,0 +1,22 @@ +diff --git a/man/man8/CMakeLists.txt b/man/man8/CMakeLists.txt +index 45cfe5d..d13229e 100644 +--- a/man/man8/CMakeLists.txt ++++ b/man/man8/CMakeLists.txt +@@ -1,12 +1,12 @@ +-find_program(GZIP gzip) ++find_program(CAT cat) + file(GLOB FILES *.8) + set(GZFILES "") + foreach(FIL ${FILES}) + get_filename_component(NAME ${FIL} NAME) +- add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz +- COMMAND ${GZIP} -c ${FIL} > ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz ++ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME} ++ COMMAND ${CAT} ${FIL} > ${CMAKE_CURRENT_BINARY_DIR}/${NAME} + DEPENDS ${FIL}) +- list(APPEND GZFILES "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.gz") ++ list(APPEND GZFILES "${CMAKE_CURRENT_BINARY_DIR}/${NAME}") + endforeach() + add_custom_target(man ALL DEPENDS ${GZFILES}) +-install(FILES ${GZFILES} DESTINATION man/man8) ++install(FILES ${GZFILES} DESTINATION share/man/man8) diff --git a/dev-util/bpftrace/metadata.xml b/dev-util/bpftrace/metadata.xml new file mode 100644 index 000000000000..777f99f832ca --- /dev/null +++ b/dev-util/bpftrace/metadata.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>chutzpah@gentoo.org</email> + </maintainer> + <upstream> + <remote-id type="github">iovisor/bpftrace</remote-id> + </upstream> +</pkgmetadata> |