diff --git a/Formula/gotraceui.rb b/Formula/gotraceui.rb new file mode 100644 index 0000000..4a6775d --- /dev/null +++ b/Formula/gotraceui.rb @@ -0,0 +1,60 @@ +class Gotraceui < Formula + desc "Efficient frontend for Go execution traces" + homepage "https://gotraceui.dev" + url "https://github.com/dominikh/gotraceui/archive/bfc5b70255cae54a74929a1e2394d57d4a3bc9d8.tar.gz" + version "20251215" + sha256 "35955954b8ae323a16ef764bc70fba851cbec92f3cdff15688e1670aa564b68e" + license "MIT" + + head "https://github.com/dominikh/gotraceui.git", branch: "master" + + depends_on "go" => :build + depends_on "pkg-config" => :build + + on_linux do + depends_on "vulkan-headers" => :build + depends_on "libx11" + depends_on "libxcb" + depends_on "libxcursor" + depends_on "libxfixes" + depends_on "libxkbcommon" + depends_on "llvm" + depends_on "mesa" + depends_on "wayland" + end + + def install + if OS.linux? + ENV["CC"] = Formula["llvm"].opt_bin/"clang" + ENV["CXX"] = Formula["llvm"].opt_bin/"clang++" + ENV["CGO_ENABLED"] = "1" + ENV.prepend_path "PATH", Formula["llvm"].opt_bin + + # Pkg Config + Formula["gotraceui"].recursive_dependencies.each do |dep| + f = dep.to_formula + + # pkg-config directories + pc = f.opt_lib/"pkgconfig" + ENV.prepend_path "PKG_CONFIG_PATH", pc if pc.directory? + + # include directories + inc = f.opt_include + ENV.prepend_path "C_INCLUDE_PATH", inc if inc.directory? + end + end + ldflags = %w[ + -s -w + -X gioui.org/app.ID=co.honnef.Gotraceui + ] + + system "go", "build", *std_go_args(output: libexec/"gotraceui", ldflags: ldflags), "./cmd/gotraceui" + + unless OS.mac? + (bin/"gotraceui").write_env_script libexec/"gotraceui", + XLOCALEDIR: Formula["libx11"].opt_share/"X11/locale" + end + + pkgshare.install "share" + end +end diff --git a/README.md b/README.md index 99ae1cf..7e08719 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,9 @@ brew install tyhal/tap/klar ``` ### Others + +- **[gotraceui](https://gotraceui.dev/)** – An efficient frontend for Go execution traces ( Dominik Honnef ) + +``` +brew install --build-from-source --HEAD tyhal/tap/gotraceui +```