<commit_before>require 'formula'

class Gnuplot < Formula
  homepage 'http://www.gnuplot.info'
  url 'http://downloads.sourceforge.net/project/gnuplot/gnuplot/4.6.0/gnuplot-4.6.0.tar.gz'
  sha1 '9a43ae13546d97d4b174533ddac31a14e0edc9b2'

  head 'cvs://:pserver:anonymous@gnuplot.cvs.sourceforge.net:/cvsroot/gnuplot:gnuplot', :using => :cvs

  option 'pdf', 'Build with pdflib-lite support.'
  option 'wx', 'Build with wxWidgets support.'
  option 'nolua', 'Build without lua support.'
  option 'nogd', 'Build without gd support.'
  option 'with-x', 'Build with X support.'

  if build.head?
    depends_on :automake
    depends_on :libtool
  end

  depends_on 'pkg-config' => :build
  depends_on 'readline'
  depends_on 'pango' unless build.include? 'with-x' or MacOS::X11.installed?
  depends_on :x11 if build.include? 'with-x' or MacOS::X11.installed?
  depends_on 'pdflib-lite' if build.include? 'pdf'
  depends_on 'lua' unless build.include? 'nolua'
  depends_on 'gd' unless build.include? 'nogd'
  depends_on 'wxmac' if build.include? 'wx'

  def patches
    # MacPorts patch --without-aquaterm as a configuration option. Submitted
    # upstream:
    #   http://sourceforge.net/tracker/?func=detail&aid=3476165&group_id=2055&atid=302055
    {:p0 => 'https://trac.macports.org/export/96897/trunk/dports/math/gnuplot/files/patch-configure-aquaterm.diff'}
  end

  def install
    # Help configure find libraries
    readline = Formula.factory 'readline'
    pdflib = Formula.factory 'pdflib-lite'
    gd = Formula.factory 'gd'

    # Aquaterm disabled due to breakage. See:
    #   https://github.com/mxcl/homebrew/issues/14647
    args = %W[
      --disable-debug
      --disable-dependency-tracking
      --prefix=#{prefix}
      --with-readline=#{readline.prefix}
      --without-aquaterm
    ]

    args << '--disable-wxwidgets' unless build.include? 'wx'
    args << "--with-pdf=#{pdflib.prefix}" if build.include? 'pdf'
    args << '--without-lua' if build.include? 'nolua'

    if build.include? 'nogd'
      args << '--without-gd'
    else
      args << "--with-gd=#{gd.prefix}"
    end

    system 'autoreconf' if build.head?

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

  def test
    system "#{bin}/gnuplot", "--version"
  end
end
<commit_msg>gnu-plot: add option to skip building emacs lisp files<commit_after>require 'formula'

class Gnuplot < Formula
  homepage 'http://www.gnuplot.info'
  url 'http://downloads.sourceforge.net/project/gnuplot/gnuplot/4.6.0/gnuplot-4.6.0.tar.gz'
  sha1 '9a43ae13546d97d4b174533ddac31a14e0edc9b2'

  head 'cvs://:pserver:anonymous@gnuplot.cvs.sourceforge.net:/cvsroot/gnuplot:gnuplot', :using => :cvs

  option 'pdf', 'Build with pdflib-lite support'
  option 'wx', 'Build with wxWidgets support'
  option 'nolua', 'Build without lua support'
  option 'nogd', 'Build without gd support'
  option 'with-x', 'Build with X support'
  option 'without-emacs', 'Do not build Emacs lisp files'

  if build.head?
    depends_on :automake
    depends_on :libtool
  end

  depends_on 'pkg-config' => :build
  depends_on 'readline'
  depends_on 'pango' unless build.include? 'with-x' or MacOS::X11.installed?
  depends_on :x11 if build.include? 'with-x' or MacOS::X11.installed?
  depends_on 'pdflib-lite' if build.include? 'pdf'
  depends_on 'lua' unless build.include? 'nolua'
  depends_on 'gd' unless build.include? 'nogd'
  depends_on 'wxmac' if build.include? 'wx'

  def patches
    # MacPorts patch --without-aquaterm as a configuration option. Submitted
    # upstream:
    #   http://sourceforge.net/tracker/?func=detail&aid=3476165&group_id=2055&atid=302055
    {:p0 => 'https://trac.macports.org/export/96897/trunk/dports/math/gnuplot/files/patch-configure-aquaterm.diff'}
  end

  def install
    # Help configure find libraries
    readline = Formula.factory 'readline'
    pdflib = Formula.factory 'pdflib-lite'
    gd = Formula.factory 'gd'

    # Aquaterm disabled due to breakage. See:
    # https://github.com/mxcl/homebrew/issues/14647
    args = %W[
      --disable-debug
      --disable-dependency-tracking
      --prefix=#{prefix}
      --with-readline=#{readline.prefix}
      --without-aquaterm
    ]

    args << "--disable-wxwidgets" unless build.include? 'wx'
    args << "--with-pdf=#{pdflib.prefix}" if build.include? 'pdf'
    args << "--without-lua" if build.include? 'nolua'
    args << "--without-lisp-files" if build.include? 'without-emacs'

    if build.include? 'nogd'
      args << '--without-gd'
    else
      args << "--with-gd=#{gd.prefix}"
    end

    system 'autoreconf' if build.head?

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

  def test
    system "#{bin}/gnuplot", "--version"
  end
end

{'fraction_non_alphanumeric': 0.14191908493963143, 'fraction_numerical': 0.02753653886888371, 'mean_word_length': 3.3480662983425415, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6673384', 'n_tokens_mistral': 1777, 'n_tokens_neox': 1682, 'n_words': 375}