2011-02-14 19:21:59 +00:00
|
|
|
require 'formula'
|
|
|
|
|
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
|
2011-02-14 19:21:59 +00:00
|
|
|
homepage 'http://www.gnu.org/software/gdb/'
|
2013-09-10 09:08:06 +00:00
|
|
|
url 'http://ftpmirror.gnu.org/gdb/gdb-7.6.1.tar.bz2'
|
|
|
|
mirror 'http://ftp.gnu.org/gnu/gdb/gdb-7.6.1.tar.bz2'
|
|
|
|
sha1 '0e38633b3902070d9c6755e4c54602148a094361'
|
2011-02-14 19:21:59 +00:00
|
|
|
|
2012-03-17 20:13:36 +00:00
|
|
|
depends_on 'readline'
|
2013-02-16 23:34:33 +00:00
|
|
|
if build.include? 'with-brewed-python'
|
|
|
|
depends_on UniversalBrewedPython
|
|
|
|
end
|
|
|
|
|
|
|
|
option 'with-brewed-python', 'Use the Homebrew version of Python'
|
2013-09-04 18:12:41 +00:00
|
|
|
option 'with-version-suffix', 'Add a version suffix to program'
|
2011-05-01 02:20:20 +00:00
|
|
|
|
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",
|
|
|
|
"--with-system-readline"
|
|
|
|
]
|
2013-02-16 23:34:33 +00:00
|
|
|
|
|
|
|
if build.include? 'with-brewed-python'
|
|
|
|
args << "--with-python=#{HOMEBREW_PREFIX}"
|
|
|
|
else
|
|
|
|
args << "--with-python=/usr"
|
|
|
|
end
|
|
|
|
|
2013-09-04 18:12:41 +00:00
|
|
|
if build.include? 'with-version-suffix'
|
|
|
|
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
|
|
|
|
rm_rf share/'locale'
|
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
|
|
|
|
2011-10-27 01:05:10 +00:00
|
|
|
http://sourceware.org/gdb/wiki/BuildingOnDarwin
|
2011-05-01 02:20:20 +00:00
|
|
|
EOS
|
|
|
|
end
|
2011-02-14 19:21:59 +00:00
|
|
|
end
|