summaryrefslogtreecommitdiff
path: root/dev-util/bpftrace/files/bpftrace-0.9.4-install-libs.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dev-util/bpftrace/files/bpftrace-0.9.4-install-libs.patch')
-rw-r--r--dev-util/bpftrace/files/bpftrace-0.9.4-install-libs.patch141
1 files changed, 141 insertions, 0 deletions
diff --git a/dev-util/bpftrace/files/bpftrace-0.9.4-install-libs.patch b/dev-util/bpftrace/files/bpftrace-0.9.4-install-libs.patch
new file mode 100644
index 000000000000..fe3fc29fd9b4
--- /dev/null
+++ b/dev-util/bpftrace/files/bpftrace-0.9.4-install-libs.patch
@@ -0,0 +1,141 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2b214c1..a787d7d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -85,9 +85,10 @@ find_package(FLEX REQUIRED)
+ bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc VERBOSE)
+ 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 a95c60a..f5c4d67 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 5b9a95d..b1ccf7a 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -68,7 +68,8 @@ if (ALLOW_UNSAFE_PROBE)
+ target_compile_definitions(bpftrace PRIVATE HAVE_UNSAFE_PROBE)
+ endif(ALLOW_UNSAFE_PROBE)
+
+-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 edb0654..e57c8c5 100644
+--- a/src/arch/CMakeLists.txt
++++ b/src/arch/CMakeLists.txt
+@@ -1,8 +1,10 @@
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
+- add_library(arch aarch64.cpp)
++ add_library(bpftracearch aarch64.cpp)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64" OR
+ CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
+- add_library(arch ppc64.cpp)
++ add_library(bpftracearch ppc64.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 f280f47..5db9246 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
+ field_analyser.cpp
+@@ -7,12 +7,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
+@@ -36,26 +37,26 @@ if (STATIC_LINKING)
+ if(EMBED_LIBCLANG_ONLY)
+ unlink_transitive_dependency("${CLANG_EXPORTED_TARGETS}" "LLVM")
+ endif()
+- target_link_libraries(ast ${CLANG_EMBEDDED_CMAKE_TARGETS})
++ target_link_libraries(bpftraceast ${CLANG_EMBEDDED_CMAKE_TARGETS})
+ else()
+ list(INSERT clang_libs 0 libclang.a)
+ endif()
+
+ if(EMBED_LLVM)
+- target_link_libraries(ast ${LLVM_EMBEDDED_CMAKE_TARGETS})
++ target_link_libraries(bpftraceast ${LLVM_EMBEDDED_CMAKE_TARGETS})
+ else()
+ 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})
+ endif()
+ 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/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 211c47b..2fb73ef 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -88,7 +88,8 @@ if(HAVE_BFD_DISASM)
+ endif(STATIC_LINKING)
+ endif(HAVE_BFD_DISASM)
+
+-target_link_libraries(bpftrace_test arch ast parser resources)
++target_link_libraries(bpftrace_test bpftracearch bpftraceast bpftraceparser
++ bpftraceresources)
+
+ if (STATIC_LINKING)
+ if(EMBED_LLVM OR EMBED_CLANG)