2013-02-16 23:34:33 +00:00
|
|
|
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
|
|
|
|
|
2011-04-14 02:46:01 +00:00
|
|
|
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/"
|
2016-07-07 04:26:31 +00:00
|
|
|
url "https://ftpmirror.gnu.org/gdb/gdb-7.11.1.tar.xz"
|
|
|
|
mirror "https://ftp.gnu.org/gnu/gdb/gdb-7.11.1.tar.xz"
|
|
|
|
sha256 "e9216da4e3755e9f414c1aa0026b626251dfc57ffe572a266e98da4f6988fc70"
|
2011-02-14 19:21:59 +00:00
|
|
|
|
2015-02-12 19:27:11 +00:00
|
|
|
bottle do
|
2016-09-11 23:28:08 +00:00
|
|
|
sha256 "ce9602dbc92b1e1d986a1a5536fcef9baf3f703d08a86c4d18e4b411b20b2a4c" => :sierra
|
2016-07-07 04:58:09 +00:00
|
|
|
sha256 "90b608379fefd418b72e6b73ae1bde9014d94b9f366259cbc3fea99dc63985b1" => :el_capitan
|
|
|
|
sha256 "588dcb9acd832060e189004a4c7fef14b7a3bdeda3a7780b1f1bb8106c810327" => :yosemite
|
|
|
|
sha256 "07db094029ff33ec19e0b90633f9a2b8fcceaec14d2bf30f7824b618ce993a3e" => :mavericks
|
2015-02-12 19:27:11 +00:00
|
|
|
end
|
|
|
|
|
2015-12-20 16:04:42 +00:00
|
|
|
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"
|
|
|
|
|
2014-08-23 08:38:51 +00:00
|
|
|
depends_on "pkg-config" => :build
|
2015-12-20 16:04:42 +00:00
|
|
|
depends_on "python" => :optional
|
2014-08-23 08:38:51 +00:00
|
|
|
depends_on "guile" => :optional
|
2014-05-17 23:55:34 +00:00
|
|
|
|
2015-12-20 16:04:42 +00:00
|
|
|
if build.with? "python"
|
2013-02-16 23:34:33 +00:00
|
|
|
depends_on UniversalBrewedPython
|
|
|
|
end
|
|
|
|
|
2012-03-17 20:13:36 +00:00
|
|
|
def install
|
2013-02-21 23:34:33 +00:00
|
|
|
args = [
|
|
|
|
"--prefix=#{prefix}",
|
|
|
|
"--disable-debug",
|
|
|
|
"--disable-dependency-tracking",
|
|
|
|
]
|
2013-02-16 23:34:33 +00:00
|
|
|
|
2014-08-23 08:38:51 +00:00
|
|
|
args << "--with-guile" if build.with? "guile"
|
|
|
|
args << "--enable-targets=all" if build.with? "all-targets"
|
|
|
|
|
2015-12-20 16:04:42 +00:00
|
|
|
if build.with? "python"
|
2013-02-16 23:34:33 +00:00
|
|
|
args << "--with-python=#{HOMEBREW_PREFIX}"
|
|
|
|
else
|
|
|
|
args << "--with-python=/usr"
|
|
|
|
end
|
|
|
|
|
2014-05-17 23:55:34 +00:00
|
|
|
if build.with? "version-suffix"
|
2013-09-04 18:12:41 +00:00
|
|
|
args << "--program-suffix=-#{version.to_s.slice(/^\d/)}"
|
|
|
|
end
|
|
|
|
|
2013-02-16 23:34:33 +00:00
|
|
|
system "./configure", *args
|
2011-02-14 19:21:59 +00:00
|
|
|
system "make"
|
2013-09-04 18:12:41 +00:00
|
|
|
system "make", "install"
|
2013-08-18 07:48:26 +00:00
|
|
|
|
|
|
|
# Remove conflicting items with binutils
|
|
|
|
rm_rf include
|
|
|
|
rm_rf lib
|
2014-05-17 23:55:34 +00:00
|
|
|
rm_rf share/"locale"
|
2014-11-02 00:19:31 +00:00
|
|
|
rm_rf share/"info"
|
2011-02-14 19:21:59 +00:00
|
|
|
end
|
2011-05-01 02:20:20 +00:00
|
|
|
|
|
|
|
def caveats; <<-EOS.undent
|
2011-10-27 01:05:10 +00:00
|
|
|
gdb requires special privileges to access Mach ports.
|
|
|
|
You will need to codesign the binary. For instructions, see:
|
2011-05-01 02:20:20 +00:00
|
|
|
|
2016-02-27 21:06:28 +00:00
|
|
|
https://sourceware.org/gdb/wiki/BuildingOnDarwin
|
2011-05-01 02:20:20 +00:00
|
|
|
EOS
|
|
|
|
end
|
2015-12-12 17:07:02 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
system bin/"gdb", bin/"gdb", "-configuration"
|
|
|
|
end
|
2011-02-14 19:21:59 +00:00
|
|
|
end
|