<commit_before>require 'formula'

class Djview4 < Formula
  homepage 'http://djvu.sourceforge.net/djview4.html'
  url 'https://downloads.sourceforge.net/project/djvu/DjView/4.8/djview-4.8.tar.gz'
  sha1 '266d207afb63a1ee63eed054190bf88888fda572'

  depends_on 'pkg-config' => :build
  depends_on 'djvulibre'
  depends_on 'qt'

  # Patch for Qt 4.8 compatibility. See:
  # https://build.opensuse.org/package/view_file?file=djview4-qt-4.8.patch&package=djvulibre-djview4&project=graphics&rev=8c40ae0f91469bb1af80f36c24516251
  # When updating this formula, check if this patch is still needed.
  def patches
    DATA
  end

  def install
    system "./configure", "--disable-debug",
                          "--prefix=#{prefix}",
                          "--with-x=no",
                          "--disable-desktopfiles"
    system "make", "CC=#{ENV.cc}", "CXX=#{ENV.cxx}"

    # From the djview4.8 README:
    # Note3: Do not use command "make install".
    # Simply copy the application bundle where you want it.
    prefix.install 'src/djview.app'
  end
end<commit_msg>djview4: use patch DSL<commit_after>require 'formula'

class Djview4 < Formula
  homepage 'http://djvu.sourceforge.net/djview4.html'
  url 'https://downloads.sourceforge.net/project/djvu/DjView/4.8/djview-4.8.tar.gz'
  sha1 '266d207afb63a1ee63eed054190bf88888fda572'

  depends_on 'pkg-config' => :build
  depends_on 'djvulibre'
  depends_on 'qt'

  # Patch for Qt 4.8 compatibility. See:
  # https://build.opensuse.org/package/view_file?file=djview4-qt-4.8.patch&package=djvulibre-djview4&project=graphics&rev=8c40ae0f91469bb1af80f36c24516251
  # When updating this formula, check if this patch is still needed.
  patch :DATA

  def install
    system "./configure", "--disable-debug",
                          "--prefix=#{prefix}",
                          "--with-x=no",
                          "--disable-desktopfiles"
    system "make", "CC=#{ENV.cc}", "CXX=#{ENV.cxx}"

    # From the djview4.8 README:
    # Note3: Do not use command "make install".
    # Simply copy the application bundle where you want it.
    prefix.install 'src/djview.app'
  end
end
{'fraction_non_alphanumeric': 0.12909260991580918, 'fraction_numerical': 0.05940130963517306, 'mean_word_length': 2.903284671532847, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '4113667', 'n_tokens_mistral': 840, 'n_tokens_neox': 747, 'n_words': 152}