<commit_before>require "formula"

class Valgrind < Formula
  homepage "http://www.valgrind.org/"

  stable do
    url "http://valgrind.org/downloads/valgrind-3.10.1.tar.bz2"
    sha1 "15518427de842547ffa84eff8b2b67f3b16581a8"

    # Look for headers in the SDK on Xcode-only systems: https://bugs.kde.org/show_bug.cgi?id=295084
    # Fix duplicate symbols error on Lion: https://bugs.kde.org/show_bug.cgi?id=307415
    patch do
      url "https://gist.githubusercontent.com/jacknagel/369bedc191e0a0795358/raw/a71e6c0fdcb786fdfde2fc33d71d555b18bcfe8d/valgrind-sdk-paths-Makefile-in.diff"
      sha1 "4210431e2a12c191875391b144b9a45cc76496c1"
    end

    # Revisit the below requirement with each release
    depends_on MaximumMacOSRequirement => :mavericks
  end

  bottle do
    sha1 "db2fd4ccbd7fb2d58a38480c76a312d00292f5d8" => :mavericks
    sha1 "98f60f0a39a6c97633ed5c6ff5a675979fc92861" => :mountain_lion
  end

  head do
    url "svn://svn.valgrind.org/valgrind/trunk"

    depends_on "autoconf" => :build
    depends_on "automake" => :build
    depends_on "libtool" => :build

    # Look for headers in the SDK on Xcode-only systems: https://bugs.kde.org/show_bug.cgi?id=295084
    # Fix duplicate symbols error on Lion: https://bugs.kde.org/show_bug.cgi?id=307415
    patch do
      url "https://gist.githubusercontent.com/jacknagel/cd26a902d72aabd0b51d/raw/1a61a328a87a728dccbeef0594f6fe335e9bf917/valgrind-sdk-paths-Makefile-am.diff"
      sha1 "d004d6af97f7f74d49d09dc513b4c67488da0a45"
    end
  end

  depends_on :macos => :snow_leopard

  # Valgrind needs vcpreload_core-*-darwin.so to have execute permissions.
  # See #2150 for more information.
  skip_clean "lib/valgrind"

  def install
    args = %W[
      --disable-dependency-tracking
      --prefix=#{prefix}
    ]
    if MacOS.prefer_64_bit?
      args << "--enable-only64bit" << "--build=amd64-darwin"
    else
      args << "--enable-only32bit"
    end

    ext = build.head? ? "am" : "in"
    inreplace "coregrind/Makefile.#{ext}", "@@HOMEBREW_SDKROOT@@", MacOS.sdk_path.to_s

    system "./autogen.sh" if build.head?
    system "./configure", *args
    system "make"
    system "make", "install"
  end

  test do
    system "#{bin}/valgrind", "ls", "-l"
  end
end
<commit_msg>valgrind 3.10.1: Fix for Linuxbrew<commit_after>require "formula"

class Valgrind < Formula
  homepage "http://www.valgrind.org/"

  stable do
    url "http://valgrind.org/downloads/valgrind-3.10.1.tar.bz2"
    sha1 "15518427de842547ffa84eff8b2b67f3b16581a8"

    # Look for headers in the SDK on Xcode-only systems: https://bugs.kde.org/show_bug.cgi?id=295084
    # Fix duplicate symbols error on Lion: https://bugs.kde.org/show_bug.cgi?id=307415
    patch do
      url "https://gist.githubusercontent.com/jacknagel/369bedc191e0a0795358/raw/a71e6c0fdcb786fdfde2fc33d71d555b18bcfe8d/valgrind-sdk-paths-Makefile-in.diff"
      sha1 "4210431e2a12c191875391b144b9a45cc76496c1"
    end

    # Revisit the below requirement with each release
    depends_on MaximumMacOSRequirement => :mavericks
  end

  bottle do
    sha1 "db2fd4ccbd7fb2d58a38480c76a312d00292f5d8" => :mavericks
    sha1 "98f60f0a39a6c97633ed5c6ff5a675979fc92861" => :mountain_lion
  end

  head do
    url "svn://svn.valgrind.org/valgrind/trunk"

    depends_on "autoconf" => :build
    depends_on "automake" => :build
    depends_on "libtool" => :build

    # Look for headers in the SDK on Xcode-only systems: https://bugs.kde.org/show_bug.cgi?id=295084
    # Fix duplicate symbols error on Lion: https://bugs.kde.org/show_bug.cgi?id=307415
    patch do
      url "https://gist.githubusercontent.com/jacknagel/cd26a902d72aabd0b51d/raw/1a61a328a87a728dccbeef0594f6fe335e9bf917/valgrind-sdk-paths-Makefile-am.diff"
      sha1 "d004d6af97f7f74d49d09dc513b4c67488da0a45"
    end
  end

  depends_on :macos => :snow_leopard

  # Valgrind needs vcpreload_core-*-darwin.so to have execute permissions.
  # See #2150 for more information.
  skip_clean "lib/valgrind"

  def install
    args = %W[
      --disable-dependency-tracking
      --prefix=#{prefix}
    ]
    if MacOS.prefer_64_bit?
      args << "--enable-only64bit"
      args << "--build=amd64-darwin" if OS.mac?
    else
      args << "--enable-only32bit"
    end

    ext = build.head? ? "am" : "in"
    inreplace "coregrind/Makefile.#{ext}", "@@HOMEBREW_SDKROOT@@", MacOS.sdk_path.to_s

    system "./autogen.sh" if build.head?
    system "./configure", *args
    system "make"
    system "make", "install"
  end

  test do
    system "#{bin}/valgrind", "ls", "-l"
  end
end

{'fraction_non_alphanumeric': 0.11706567098616297, 'fraction_numerical': 0.10806061937184275, 'mean_word_length': 3.4690873405299314, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 12, 'lorem ipsum': 0, 'www.': 2, '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': '1158363', 'n_tokens_mistral': 2099, 'n_tokens_neox': 1824, 'n_words': 319}