ruby 让gdb在OSX 10.10或更高版本上执行python3脚本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby 让gdb在OSX 10.10或更高版本上执行python3脚本相关的知识,希望对你有一定的参考价值。

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 UniversalBrewedPython3 < Requirement
  satisfy { archs_for_command("python3").universal? }

  def message; <<-EOS.undent
    A build of GDB using a brewed Python3 was requested, but Python3 is not
    a universal build.

    GDB requires Python3 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
  desc "GNU debugger"
  homepage "https://www.gnu.org/software/gdb/"
  url "http://ftpmirror.gnu.org/gdb/gdb-7.10.1.tar.xz"
  mirror "https://ftp.gnu.org/gnu/gdb/gdb-7.10.1.tar.xz"
  sha256 "25c72f3d41c7c8554d61cacbeacd5f40993276d2ccdec43279ac546e3993d6d5"

  bottle do
    revision 1
    sha256 "c465704eadcac21448ca0308bf5236ac85621dc88c293262433e0779b97d8e1d" => :el_capitan
    sha256 "d90d5fd1152b6552887acae5a096d1caa76097069862dbb75c69af813b4900f0" => :yosemite
    sha256 "5d9bd02c50846d289629d8ec503a41d84aeb4bc9df638c6c66d98e16263d089e" => :mavericks
  end

  deprecated_option "with-brewed-python" => "with-python"

  option "with-python3", "Use the Homebrew version of Python3"
  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" => :optional

  if build.with? "python"
    depends_on UniversalBrewedPython
  end

  if build.with? "python3"
    depends_on UniversalBrewedPython3
    patch :p1, :DATA
  end

  def install
    args = [
      "--prefix=#{prefix}",
      "--disable-debug",
      "--disable-dependency-tracking",
      "--with-lzma",
    ]

    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}"
    elsif build.with? "python3"
      args << "--with-python=#{HOMEBREW_PREFIX}/bin/python3"
    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:

      http://sourceware.org/gdb/wiki/BuildingOnDarwin
    EOS
  end

  test do
    system bin/"gdb", bin/"gdb", "-configuration"
  end
end
__END__
diff --git a/gdb/python/python-config.py b/gdb/python/python-config
--- a/gdb/python/python-config.py	2015-12-18 22:46:55.000000000 +0800
+++ b/gdb/python/python-config.py	2015-12-18 22:47:22.000000000 +0800
@@ -72,7 +72,5 @@
                     libs.insert(0, '-L' + getvar('LIBPL'))
                 elif os.name == 'nt':
                     libs.insert(0, '-L' + sysconfig.PREFIX + '/libs')
-            if getvar('LINKFORSHARED') is not None:
-                libs.extend(getvar('LINKFORSHARED').split())
         print (to_unix_path(' '.join(libs)))

以上是关于ruby 让gdb在OSX 10.10或更高版本上执行python3脚本的主要内容,如果未能解决你的问题,请参考以下文章

在 OSX 10.10 Yosemite 上安装 Nokogiri

ruby Capistrano部署策略支持git子模块(需要Capistrano v3.1.0或更高版本)

markdown Ruby on Rails的安装环境(Mac OS X 10.9或更高版本)

[尝试部署]:您必须使用带有此锁定文件的 Bundler 2 或更高版本

如何使使用旧 Java 版本开发的应用程序在 jdk 9 或更高版本上运行? [复制]

QtCreator:`clang:-stdlib=libc++ 的无效部署目标(需要 OS X 10.7 或更高版本)`