93 lines
3 KiB
Ruby
93 lines
3 KiB
Ruby
class Gdb < Formula
|
|
desc "GNU debugger"
|
|
homepage "https://www.gnu.org/software/gdb/"
|
|
url "https://ftp.gnu.org/gnu/gdb/gdb-8.1.tar.xz"
|
|
mirror "https://ftpmirror.gnu.org/gdb/gdb-8.1.tar.xz"
|
|
sha256 "af61a0263858e69c5dce51eab26662ff3d2ad9aa68da9583e8143b5426be4b34"
|
|
|
|
bottle do
|
|
sha256 "43a6d6cca157ef70d13848f35c04e11d832dc0c96f5bcf53a43330f524b3ac40" => :high_sierra
|
|
sha256 "fe7c6261f9164e7a744c9c512ba7e5afff0e74e373ece9b5aa19d5da6443bfc2" => :sierra
|
|
sha256 "cd89001bcf8c93b5d6425ab91a400aeffe0cd5bbb0eccd8ab38c719ab5ca34ba" => :el_capitan
|
|
end
|
|
|
|
deprecated_option "with-brewed-python" => "with-python@2"
|
|
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-python@2", "Use the Homebrew version of Python 2; 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 "python@2" => :optional
|
|
depends_on "guile@2.0" => :optional
|
|
|
|
fails_with :clang do
|
|
build 800
|
|
cause <<~EOS
|
|
probe.c:63:28: error: default initialization of an object of const type
|
|
'const any_static_probe_ops' without a user-provided default constructor
|
|
EOS
|
|
end
|
|
|
|
fails_with :clang do
|
|
build 600
|
|
cause <<~EOS
|
|
clang: error: unable to execute command: Segmentation fault: 11
|
|
Test done on: Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
|
|
EOS
|
|
end
|
|
|
|
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@2") && build.with?("python")
|
|
odie "Options --with-python and --with-python@2 are mutually exclusive."
|
|
elsif build.with?("python@2")
|
|
args << "--with-python=#{Formula["python@2"].opt_bin}/python2"
|
|
ENV.append "CPPFLAGS", "-I#{Formula["python@2"].opt_libexec}"
|
|
elsif build.with?("python")
|
|
args << "--with-python=#{Formula["python"].opt_bin}/python3"
|
|
ENV.append "CPPFLAGS", "-I#{Formula["python"].opt_libexec}"
|
|
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
|
|
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
|