选项在家庭资源中意味着什么?

时间:2013-01-09 14:13:29

标签: ruby macos homebrew

当我运行brew edit ejabberd

require 'formula'

class Ejabberd < Formula
  homepage 'http://www.ejabberd.im'
  url "http://www.process-one.net/downloads/ejabberd/2.1.11/ejabberd-2.1.11.tgz"
  md5 'a70b040c4e7602f47718c8afe8780d50'

  depends_on "openssl" if MacOS.leopard?
  depends_on "erlang"

  def options
    [
      ['--odbc', "Build with ODBC support."],
      ['--32-bit', "Build 32-bit only."]
    ]
  end

  def install
    ENV['TARGET_DIR'] = ENV['DESTDIR'] = "#{lib}/ejabberd/erlang/lib/ejabberd-#{version}"
    ENV['MAN_DIR'] = man
    ENV['SBIN_DIR'] = sbin

    if ARGV.build_32_bit?
      %w{ CFLAGS LDFLAGS }.each do |compiler_flag|
        ENV.remove compiler_flag, "-arch x86_64"
        ENV.append compiler_flag, "-arch i386"
      end
    end

    cd "src" do
      args = ["--prefix=#{prefix}",
              "--sysconfdir=#{etc}",
              "--localstatedir=#{var}"]

      if MacOS.leopard?
        openssl = Formula.factory('openssl')
        args << "--with-openssl=#{openssl.prefix}"
      end

      args << "--enable-odbc" if ARGV.include? '--odbc'

      system "./configure", *args
      system "make"
      system "make install"
    end

    (etc+"ejabberd").mkpath
    (var+"lib/ejabberd").mkpath
    (var+"spool/ejabberd").mkpath
  end

  def caveats; <<-EOS.undent
    If you face nodedown problems, concat your machine name to:
      /private/etc/hosts
    after 'localhost'.
    EOS
  end
end

我想知道选项方法的用途?是否会将--odbc--32-bit附加到./configure

  def options
    [
      ['--odbc', "Build with ODBC support."],
      ['--32-bit', "Build 32-bit only."]
    ]
  end

1 个答案:

答案 0 :(得分:0)

没有;它表示--odbc--32-bit是您可以传递给brew install命令本身的选项。

在脚本中进一步说明if ARGV.build_32_bit?if ARGV.include? '--odbc',它会检查您是否已通过其中一个选项,并相应地修改其构建过程。

我认为发出brew install命令行选项的可用性和检查信号的特定方式已不再使用;但我不是在我的Mac上检查目前的程序是什么。