<commit_before>require "formula"

class SwiProlog < Formula
  homepage "http://www.swi-prolog.org/"
  url "http://www.swi-prolog.org/download/stable/src/pl-6.6.6.tar.gz"
  sha1 "38cc6772a48fd412f50fc06e24e6e4673eb71d3b"

  devel do
    url "http://www.swi-prolog.org/download/devel/src/pl-7.1.20.tar.gz"
    sha1 "f9d5152bb53ce956dff1eb01e41c05cc8a8e98e0"
  end

  head do
    url "git://www.swi-prolog.org/home/pl/git/pl.git"

    depends_on "autoconf" => :build
  end

  option "lite", "Disable all packages"
  option "with-jpl", "Enable JPL (Java Prolog Bridge)"
  option "with-xpce", "Enable XPCE (Prolog Native GUI Library)"

  depends_on "readline"
  depends_on "gmp"
  depends_on "libarchive" => :optional

  if build.with? "xpce"
    depends_on "pkg-config" => :build
    depends_on :x11
    depends_on "jpeg"
  end

  # 10.5 versions of these are too old
  if MacOS.version <= :leopard
    depends_on "fontconfig"
    depends_on "expat"
  end

  fails_with :llvm do
    build 2335
    cause "Exported procedure chr_translate:chr_translate_line_info/3 is not defined"
  end

  def install
    # The archive package hard-codes a check for MacPort libarchive
    # Replace this with a check for Homebrew's libarchive, or nowhere
    if build.with? "libarchive"
      inreplace "packages/archive/configure.in", "/opt/local",
                                                 Formula["libarchive"].opt_prefix<commit_msg>swi-prolog 7.1.21<commit_after>require "formula"

class SwiProlog < Formula
  homepage "http://www.swi-prolog.org/"
  url "http://www.swi-prolog.org/download/stable/src/pl-6.6.6.tar.gz"
  sha1 "38cc6772a48fd412f50fc06e24e6e4673eb71d3b"

  devel do
    url "http://www.swi-prolog.org/download/devel/src/pl-7.1.21.tar.gz"
    sha1 "8babb3a043aaa29f17d15a34cf8b7d3891967d0d"
  end

  head do
    url "git://www.swi-prolog.org/home/pl/git/pl.git"

    depends_on "autoconf" => :build
  end

  option "lite", "Disable all packages"
  option "with-jpl", "Enable JPL (Java Prolog Bridge)"
  option "with-xpce", "Enable XPCE (Prolog Native GUI Library)"

  depends_on "pkg-config" => :build
  depends_on "readline"
  depends_on "gmp"
  depends_on "libarchive" => :optional

  if build.with? "xpce"
    depends_on :x11
    depends_on "jpeg"
  end

  # 10.5 versions of these are too old
  if MacOS.version <= :leopard
    depends_on "fontconfig"
    depends_on "expat"
  end

  fails_with :llvm do
    build 2335
    cause "Exported procedure chr_translate:chr_translate_line_info/3 is not defined"
  end

  def install
    # The archive package hard-codes a check for MacPort libarchive
    # Replace this with a check for Homebrew's libarchive, or nowhere
    if build.with? "libarchive"
      inreplace "packages/archive/configure.in", "/opt/local",
                                                 Formula["libarchive"].opt_prefix
{'fraction_non_alphanumeric': 0.10919943820224719, 'fraction_numerical': 0.04810393258426966, 'mean_word_length': 3.064194008559201, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5860958', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1033, 'n_words': 240}