<commit_before>class Lua < Formula
  desc "Powerful, lightweight programming language"
  homepage "https://www.lua.org/"
  url "https://www.lua.org/ftp/lua-5.3.4.tar.gz"
  sha256 "f681aa518233bc407e23acf0f5887c884f17436f000d453b2491a9f11a52400c"
  revision 2

  bottle do
    cellar :any
    sha256 "6312fdaa1a4ce5bbabc19352a5db6777715568f8840d6b28f74b5caac99b555c" => :high_sierra
    sha256 "ff0a15af61df2a80d41740586df41ebe93cb2c0a1c91f28cf291ae051764e0c7" => :sierra
    sha256 "5d6e7dc0b597bd81493e02e77e35ef13efbc29823d2dd0bd8fbeb30166f1365b" => :el_capitan
  end

  option "without-luarocks", "Don't build with Luarocks support embedded"

  unless OS.mac?
    depends_on "unzip"
    depends_on "readline"
  end

  # Be sure to build a dylib, or else runtime modules will pull in another static copy of liblua = crashy
  # See: https://github.com/Homebrew/legacy-homebrew/pull/5043
  # ***Update me with each version bump!***
  patch :DATA if OS.mac?

  # Add shared library for linux
  patch do
    url "https://gist.githubusercontent.com/rwhogg/51b19615fc619bf980d7200a51f3875a/raw/cf7aea1ea6cb904975758aa66e0488ce2b7679da/lua.patch"
    sha256 "82a7781c37afc6f8363a8c62c691a4fc64072201366a2fc8c9879092ac4e40fb"
  end if OS.linux?

  # Don't use the https://luarocks.org/releases/luarocks-x.y.z.tar.gz URL
  # directly as it redirects to the HTTP version of the below URL.
  resource "luarocks" do
    url "https://luarocks.github.io/luarocks/releases/luarocks-2.4.3.tar.gz"
    sha256 "4d414d32fed5bb121c72d3ff1280b7f2dc9027a9bc012e41dfbffd5b519b362e"
  end

  def install
    # Subtitute formula prefix in `src/Makefile` for install name (dylib ID).
    # Use our CC/CFLAGS to compile.
    inreplace "src/Makefile" do |s|
      s.gsub! "@LUA_PREFIX@", prefix if OS.mac?
      s.remove_make_var! "CC"
      s.change_make_var! "CFLAGS", "#{ENV.cflags} -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)"
      s.change_make_var! "MYLDFLAGS", ENV.ldflags
    end

    # Fix path in the config header
    inreplace "src/luaconf.h", "/usr/local", HOMEBREW_PREFIX

    # We ship our own pkg-config file as Lua no longer provide them upstream.
    arch = OS.mac? ? "macosx" : "linux"
    system "make", arch, "INSTALL_TOP=#{prefix}", "INSTALL_MAN=#{man1}"<commit_msg>lua: Remove patch for Linuxbrew.<commit_after>class Lua < Formula
  desc "Powerful, lightweight programming language"
  homepage "https://www.lua.org/"
  url "https://www.lua.org/ftp/lua-5.3.4.tar.gz"
  sha256 "f681aa518233bc407e23acf0f5887c884f17436f000d453b2491a9f11a52400c"
  revision 2

  bottle do
    cellar :any
    sha256 "6312fdaa1a4ce5bbabc19352a5db6777715568f8840d6b28f74b5caac99b555c" => :high_sierra
    sha256 "ff0a15af61df2a80d41740586df41ebe93cb2c0a1c91f28cf291ae051764e0c7" => :sierra
    sha256 "5d6e7dc0b597bd81493e02e77e35ef13efbc29823d2dd0bd8fbeb30166f1365b" => :el_capitan
  end

  option "without-luarocks", "Don't build with Luarocks support embedded"

  unless OS.mac?
    depends_on "unzip"
    depends_on "readline"
  end

  # Be sure to build a dylib, or else runtime modules will pull in another static copy of liblua = crashy
  # See: https://github.com/Homebrew/legacy-homebrew/pull/5043
  # ***Update me with each version bump!***
  patch :DATA if OS.mac?

  # Don't use the https://luarocks.org/releases/luarocks-x.y.z.tar.gz URL
  # directly as it redirects to the HTTP version of the below URL.
  resource "luarocks" do
    url "https://luarocks.github.io/luarocks/releases/luarocks-2.4.3.tar.gz"
    sha256 "4d414d32fed5bb121c72d3ff1280b7f2dc9027a9bc012e41dfbffd5b519b362e"
  end

  def install
    # Subtitute formula prefix in `src/Makefile` for install name (dylib ID).
    # Use our CC/CFLAGS to compile.
    inreplace "src/Makefile" do |s|
      s.gsub! "@LUA_PREFIX@", prefix if OS.mac?
      s.remove_make_var! "CC"
      s.change_make_var! "CFLAGS", "#{ENV.cflags} -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)"
      s.change_make_var! "MYLDFLAGS", ENV.ldflags
    end

    # Fix path in the config header
    inreplace "src/luaconf.h", "/usr/local", HOMEBREW_PREFIX

    # We ship our own pkg-config file as Lua no longer provide them upstream.
    arch = OS.mac? ? "macosx" : "linux"
    system "make", arch, "INSTALL_TOP=#{prefix}", "INSTALL_MAN=#{man1}"
{'fraction_non_alphanumeric': 0.10378023010096267, 'fraction_numerical': 0.1263207325663301, 'mean_word_length': 4.089605734767025, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 11, 'lorem ipsum': 0, 'www.': 4, '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': '2794281', 'n_tokens_mistral': 2004, 'n_tokens_neox': 1705, 'n_words': 359}