<commit_before>require 'formula'

class Weechat < Formula
  homepage 'http://www.weechat.org'
  url 'http://www.weechat.org/files/src/weechat-0.3.7.tar.bz2'
  md5 '62bb5002b2ba9e5816dfeededc3fa276'

  head 'git://git.sv.gnu.org/weechat.git'

  depends_on 'cmake' => :build
  depends_on 'gnutls'

  def install
    # Remove all arch flags from the PERL_*FLAGS as we specify them ourselves.
    # This messes up because the system perl is a fat binary with 32, 64 and PPC
    # compiles, but our deps don't have that.
    archs = ['-arch ppc', '-arch i386', '-arch x86_64'].join('|')

    inreplace  "src/plugins/scripts/perl/CMakeLists.txt",
      'IF(PERL_FOUND)',
      'IF(PERL_FOUND)' +
      %Q{\n  STRING(REGEX REPLACE "#{archs}" "" PERL_CFLAGS "${PERL_CFLAGS}")} +
      %Q{\n  STRING(REGEX REPLACE "#{archs}" "" PERL_LFLAGS "${PERL_LFLAGS}")}

    # -DPREFIX has to be specified because weechat devs enjoy being non-standard
    # Compiling langauge module doesn't work. Feel free to add options to enable these.
    system "cmake", "-DPREFIX=#{prefix}",
                    "-DENABLE_RUBY=OFF",
                    "-DENABLE_PERL=OFF",
                    "-DENABLE_PYTHON=OFF",
                    std_cmake_parameters,
                    "."
    system "make install"
  end
end<commit_msg>weechat: options to enable script language plugins<commit_after>require 'formula'

class Weechat < Formula
  homepage 'http://www.weechat.org'
  url 'http://www.weechat.org/files/src/weechat-0.3.7.tar.bz2'
  md5 '62bb5002b2ba9e5816dfeededc3fa276'

  head 'git://git.sv.gnu.org/weechat.git'

  depends_on 'cmake' => :build
  depends_on 'gnutls'

  def options
    [
      ["--enable-ruby", "Enable Ruby module"],
      ["--enable-perl", "Enable Perl module"],
      ["--enable-python", "Enable Python module"],
    ]
  end

  def install
    # Remove all arch flags from the PERL_*FLAGS as we specify them ourselves.
    # This messes up because the system perl is a fat binary with 32, 64 and PPC
    # compiles, but our deps don't have that.
    archs = ['-arch ppc', '-arch i386', '-arch x86_64'].join('|')

    inreplace  "src/plugins/scripts/perl/CMakeLists.txt",
      'IF(PERL_FOUND)',
      'IF(PERL_FOUND)' +
      %Q{\n  STRING(REGEX REPLACE "#{archs}" "" PERL_CFLAGS "${PERL_CFLAGS}")} +
      %Q{\n  STRING(REGEX REPLACE "#{archs}" "" PERL_LFLAGS "${PERL_LFLAGS}")}

    args = []

    if ARGV.include? "--enable-ruby"
      args << "-DENABLE_RUBY=ON"
    else
      args << "-DENABLE_RUBY=OFF"
    end

    if ARGV.include? "--enable-perl"
      args << "-DENABLE_PERL=ON"
    else
      args << "-DENABLE_PERL=OFF"
    end

    if ARGV.include? "--enable-python"
      args << "-DENABLE_PYTHON=ON"
    else
      args << "-DENABLE_PYTHON=OFF"
    end

    # -DPREFIX has to be specified because weechat devs enjoy being non-standard
    system "cmake", "-DPREFIX=#{prefix}",
                    args.join(" "),
                    std_cmake_parameters,
                    "."
    system "make install"
  end
end
{'fraction_non_alphanumeric': 0.13983471074380166, 'fraction_numerical': 0.02115702479338843, 'mean_word_length': 2.572609208972845, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5478764', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1069, 'n_words': 261}