<commit_before>require 'formula'

class Gnupg2 < Formula
  homepage 'http://www.gnupg.org/'
  url 'ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-2.0.20.tar.bz2'
  sha1 '7ddfefa37ee9da89a8aaa8f9059d251b4cd02562'

  option '8192', 'Build with support for private keys of up to 8192 bits'

  depends_on 'libgpg-error'
  depends_on 'libgcrypt'
  depends_on 'libksba'
  depends_on 'libassuan'
  depends_on 'pinentry'
  depends_on 'pth'
  depends_on 'gpg-agent'
  depends_on 'dirmngr' => :recommended
  depends_on 'libusb-compat' => :recommended

  # Fix hardcoded runtime data location
  # upstream: http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;h=c3f08dc
  # Adjust package name to fit our scheme of packaging both gnupg 1.x and
  # 2.x, and gpg-agent separately, and adjust tests to fit this scheme
  # Fix typo that breaks compilation:
  # http://lists.gnupg.org/pipermail/gnupg-users/2013-May/046652.html
  def patches; DATA; end

  def install
    inreplace 'g10/keygen.c', 'max=4096', 'max=8192' if build.include? '8192'

    (var/'run').mkpath

    ENV.append 'LDFLAGS', '-lresolv'

    ENV['gl_cv_absolute_stdint_h'] = "#{MacOS.sdk_path}/usr/include/stdint.h"

    system "./configure", "--disable-dependency-tracking",
                          "--prefix=#{prefix}",
                          "--enable-symcryptrun",
                          "--disable-agent",
                          "--with-agent-pgm=#{Formula.factory('gpg-agent').opt_prefix}/bin/gpg-agent"
    system "make"
    system "make check"
    system "make install"
<commit_msg>gnupg2: optional readline support<commit_after>require 'formula'

class Gnupg2 < Formula
  homepage 'http://www.gnupg.org/'
  url 'ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-2.0.20.tar.bz2'
  sha1 '7ddfefa37ee9da89a8aaa8f9059d251b4cd02562'

  option '8192', 'Build with support for private keys of up to 8192 bits'

  depends_on 'libgpg-error'
  depends_on 'libgcrypt'
  depends_on 'libksba'
  depends_on 'libassuan'
  depends_on 'pinentry'
  depends_on 'pth'
  depends_on 'gpg-agent'
  depends_on 'dirmngr' => :recommended
  depends_on 'libusb-compat' => :recommended
  depends_on 'readline' => :optional

  # Fix hardcoded runtime data location
  # upstream: http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;h=c3f08dc
  # Adjust package name to fit our scheme of packaging both gnupg 1.x and
  # 2.x, and gpg-agent separately, and adjust tests to fit this scheme
  # Fix typo that breaks compilation:
  # http://lists.gnupg.org/pipermail/gnupg-users/2013-May/046652.html
  def patches; DATA; end

  def install
    inreplace 'g10/keygen.c', 'max=4096', 'max=8192' if build.include? '8192'

    (var/'run').mkpath

    ENV.append 'LDFLAGS', '-lresolv'

    ENV['gl_cv_absolute_stdint_h'] = "#{MacOS.sdk_path}/usr/include/stdint.h"

    args = %W[
      --disable-dependency-tracking
      --prefix=#{prefix}
      --enable-symcryptrun
      --disable-agent
      --with-agent-pgm=#{Formula.factory('gpg-agent').opt_prefix}/bin/gpg-agent
    ]

    if build.with? 'readline'
      args << "--with-readline=#{Formula.factory('readline').opt_prefix}"
    end

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

{'fraction_non_alphanumeric': 0.1348314606741573, 'fraction_numerical': 0.04088639200998752, 'mean_word_length': 3.2171052631578947, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7414645', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1184, 'n_words': 245}