class Gdb < Formula desc "GNU debugger" homepage "https://www.gnu.org/software/gdb/" url "https://ftp.gnu.org/gnu/gdb/gdb-8.0.tar.xz" mirror "https://ftpmirror.gnu.org/gdb/gdb-8.0.tar.xz" sha256 "f6a24ffe4917e67014ef9273eb8b547cb96a13e5ca74895b06d683b391f3f4ee" bottle do sha256 "b96357f0123e05b7e7ce81a9de3c62b28266de974d84e783cba967e87de45e2e" => :sierra sha256 "f8691947439aeb3c87f4fd4f58881f2b936d38fe23c0b2091669034785bfecab" => :el_capitan sha256 "4d17723734c2754c62d6e15ef95098427e2a3651cae9ea0a28a1747d78b87b2c" => :yosemite end deprecated_option "with-brewed-python" => "with-python" deprecated_option "with-guile" => "with-guile@2.0" option "with-python", "Use the Homebrew version of Python; by default system Python is used" option "with-version-suffix", "Add a version suffix to program" option "with-all-targets", "Build with support for all targets" depends_on "pkg-config" => :build depends_on "python" => :optional depends_on "guile@2.0" => :optional def install args = [ "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking", ] args << "--with-guile" if build.with? "guile@2.0" args << "--enable-targets=all" if build.with? "all-targets" if build.with? "python" args << "--with-python=#{HOMEBREW_PREFIX}" else args << "--with-python=/usr" end if build.with? "version-suffix" args << "--program-suffix=-#{version.to_s.slice(/^\d/)}" end system "./configure", *args system "make" # Don't install bfd or opcodes, as they are provided by binutils inreplace ["bfd/Makefile", "opcodes/Makefile"], /^install:/, "dontinstall:" system "make", "install" end def caveats; <<-EOS.undent gdb requires special privileges to access Mach ports. You will need to codesign the binary. For instructions, see: https://sourceware.org/gdb/wiki/BuildingOnDarwin On 10.12 (Sierra) or later with SIP, you need to run this: echo "set startup-with-shell off" >> ~/.gdbinit EOS end test do system bin/"gdb", bin/"gdb", "-configuration" end end