|
| 1 | +class Cpptrace < Formula |
| 2 | + desc "Simple, portable, and self-contained stacktrace library for C++11 and newer" |
| 3 | + homepage "https://github.com/jeremy-rifkin/cpptrace" |
| 4 | + url "https://github.com/jeremy-rifkin/cpptrace/archive/refs/tags/v1.0.4.tar.gz" |
| 5 | + sha256 "5c9f5b301e903714a4d01f1057b9543fa540f7bfcc5e3f8bd1748e652e24f9ea" |
| 6 | + license "MIT" |
| 7 | + |
| 8 | + bottle do |
| 9 | + sha256 cellar: :any, arm64_tahoe: "714c67c234ab6bd2171290fd8d6738e1a79baf2ac93f3fb9ddcba22f510b8492" |
| 10 | + sha256 cellar: :any, arm64_sequoia: "1e2015f8f8175f025a2afef193c218f2bcf6491a597b3a24383680cd608511d2" |
| 11 | + sha256 cellar: :any, arm64_sonoma: "ca98f143e04d55612619460edaec82fc6645d9ee938efe0ed63fc988a7acea2a" |
| 12 | + sha256 cellar: :any, sonoma: "6c3fa5f1410a4005238b36afa5c1e444f8e8716b540731dec1092a1a70dad5e3" |
| 13 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "14595a27d917a2b8d41000b814f5db6dfcadec7b7a0b6a6c3ecd5ac020114e3e" |
| 14 | + end |
| 15 | + |
| 16 | + depends_on "cmake" => :build |
| 17 | + depends_on "pkgconf" => :build |
| 18 | + depends_on "dwarfutils" |
| 19 | + depends_on "zstd" |
| 20 | + |
| 21 | + def install |
| 22 | + args = %W[ |
| 23 | + -DBUILD_SHARED_LIBS=ON |
| 24 | + -DCMAKE_INSTALL_RPATH=#{rpath} |
| 25 | + -DCPPTRACE_DEMANGLE_WITH_CXXABI=ON |
| 26 | + -DCPPTRACE_FIND_LIBDWARF_WITH_PKGCONFIG=ON |
| 27 | + -DCPPTRACE_GET_SYMBOLS_WITH_LIBDWARF=ON |
| 28 | + -DCPPTRACE_UNWIND_WITH_EXECINFO=ON |
| 29 | + -DCPPTRACE_USE_EXTERNAL_GTEST=ON |
| 30 | + -DCPPTRACE_USE_EXTERNAL_LIBDWARF=ON |
| 31 | + -DCPPTRACE_USE_EXTERNAL_ZSTD=ON |
| 32 | + ] |
| 33 | + system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args |
| 34 | + system "cmake", "--build", "build" |
| 35 | + system "cmake", "--install", "build" |
| 36 | + end |
| 37 | + |
| 38 | + test do |
| 39 | + (testpath/"test.cpp").write <<~CPP |
| 40 | + #include <cpptrace/cpptrace.hpp> |
| 41 | +
|
| 42 | + int main() { |
| 43 | + cpptrace::generate_trace().print(); |
| 44 | + return 0; |
| 45 | + } |
| 46 | + CPP |
| 47 | + system ENV.cxx, "test.cpp", "-std=c++11", "-I#{include}", "-L#{lib}", "-o", "test", "-lcpptrace" |
| 48 | + system "./test" |
| 49 | + end |
| 50 | +end |
0 commit comments