homebrew-core/Formula/gdb.rb

84 lines
2.3 KiB
Ruby
Raw Normal View History

class UniversalBrewedPython < Requirement
satisfy { archs_for_command("python").universal? }
def message; <<-EOS.undent
A build of GDB using a brewed Python was requested, but Python is not
a universal build.
GDB requires Python to be built as a universal binary or it will fail
if attempting to debug a 32-bit binary on a 64-bit host.
EOS
end
end
class Gdb < Formula
2015-11-20 04:52:13 +00:00
desc "GNU debugger"
2015-01-19 04:34:35 +00:00
homepage "https://www.gnu.org/software/gdb/"
url "https://ftpmirror.gnu.org/gdb/gdb-7.12.tar.xz"
mirror "https://ftp.gnu.org/gnu/gdb/gdb-7.12.tar.xz"
sha256 "834ff3c5948b30718343ea57b11cbc3235d7995c6a4f3a5cecec8c8114164f94"
2015-02-12 19:27:11 +00:00
bottle do
2016-10-08 09:45:58 +00:00
sha256 "38aae1b524a1566336bcd42e1c84ec524efbc3d6980d8c63095b9c812dd8c846" => :sierra
sha256 "a970fdcb7003f578753bbbb83a920e2685bd72bc6cb376b431caacb049920b34" => :el_capitan
sha256 "249c3d6473a4b1fca3a0ee7f04bc7e82e2883f481e0e4661f1dd50f5ea78074b" => :yosemite
2015-02-12 19:27:11 +00:00
end
deprecated_option "with-brewed-python" => "with-python"
option "with-python", "Use the Homebrew version of Python; by default system Python is used"
2015-11-20 04:52:13 +00:00
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" => :optional
if build.with? "python"
depends_on UniversalBrewedPython
end
def install
2013-02-21 23:34:33 +00:00
args = [
"--prefix=#{prefix}",
"--disable-debug",
"--disable-dependency-tracking",
]
args << "--with-guile" if build.with? "guile"
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"
system "make", "install"
# Remove conflicting items with binutils
rm_rf include
rm_rf lib
rm_rf share/"locale"
rm_rf share/"info"
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
EOS
end
test do
system bin/"gdb", bin/"gdb", "-configuration"
end
end