<commit_before>class Supermodel < Formula
  desc "Sega Model 3 arcade emulator"
  homepage "https://www.supermodel3.com/"
  url "https://www.supermodel3.com/Files/Supermodel_0.2a_Src.zip"
  sha256 "ecaf3e7fc466593e02cbf824b722587d295a7189654acb8206ce433dcff5497b"
  head "https://svn.code.sf.net/p/model3emu/code/trunk"

  livecheck do
    url "https://www.supermodel3.com/Download.html"
    regex(/href=.*?Supermodel[._-]v?(\d+(?:\.\d+)+[a-z]?)[._-]Src\.zip/i)
  end

  bottle do
    rebuild 1
    sha256 arm64_monterey: "39a3704617ad57088a5c883145b774c9233db881ead9879cc06224961b6432cf"
    sha256 arm64_big_sur:  "ad8d438a1f18582da559bc8474e8219b81c695afba907bd99f40c1d960957687"
    sha256 monterey:       "a19638ba055b4e08ce2fb26ac7a8d8c0c5979b56962411cb51ed6fb2c5dc923a"
    sha256 big_sur:        "672d2a2500076ae34e896fb21f84b1237ae9d80c6b7858afe4316c55831f6ce7"
    sha256 catalina:       "16ce3b8995d5c9036111032cdbbde5dfc2fefc18c6f841e722242c9b791c92ac"
    sha256 mojave:         "85678e40606c4bff6ff454ec15bafd2ab317887b2fb48865433d8cb0cdae7a3a"
    sha256 high_sierra:    "83c0dbca7a5c28564eba4e7a73894746004aab5025071b350c3c47271fc42625"
    sha256 sierra:         "1203bb3d289e36e1ca15720dbcd4e63ffcf4fa4d09588cb4fb81092cb72399ec"
    sha256 el_capitan:     "78cf8e9fb973e3cd136a212936bdc8003d9897a1bb8a6a1eba3cc7ff0fba3c88"
  end

  depends_on "sdl"

  def install
    makefile_dir = build.head? ? "Makefiles/Makefile.OSX" : "Makefiles/Makefile.SDL.OSX.GCC"
    if OS.mac?
      inreplace makefile_dir do |s|
        # Set up SDL library correctly
        s.gsub! "-framework SDL", "`sdl-config --libs`"
        s.gsub!(/(\$\(COMPILER_FLAGS\))/, "\\1 -I#{Formula["sdl"].opt_prefix}/include")
      end
    else
      makefile_dir = "Makefiles/Makefile.SDL.UNIX.GCC"
    end

    inreplace makefile_dir do |s|
      # Fix missing label issue for auto-generated code<commit_msg>supermodel: fix build on Linux (#101244)<commit_after>class Supermodel < Formula
  desc "Sega Model 3 arcade emulator"
  homepage "https://www.supermodel3.com/"
  url "https://www.supermodel3.com/Files/Supermodel_0.2a_Src.zip"
  sha256 "ecaf3e7fc466593e02cbf824b722587d295a7189654acb8206ce433dcff5497b"
  head "https://svn.code.sf.net/p/model3emu/code/trunk"

  livecheck do
    url "https://www.supermodel3.com/Download.html"
    regex(/href=.*?Supermodel[._-]v?(\d+(?:\.\d+)+[a-z]?)[._-]Src\.zip/i)
  end

  bottle do
    rebuild 1
    sha256 arm64_monterey: "39a3704617ad57088a5c883145b774c9233db881ead9879cc06224961b6432cf"
    sha256 arm64_big_sur:  "ad8d438a1f18582da559bc8474e8219b81c695afba907bd99f40c1d960957687"
    sha256 monterey:       "a19638ba055b4e08ce2fb26ac7a8d8c0c5979b56962411cb51ed6fb2c5dc923a"
    sha256 big_sur:        "672d2a2500076ae34e896fb21f84b1237ae9d80c6b7858afe4316c55831f6ce7"
    sha256 catalina:       "16ce3b8995d5c9036111032cdbbde5dfc2fefc18c6f841e722242c9b791c92ac"
    sha256 mojave:         "85678e40606c4bff6ff454ec15bafd2ab317887b2fb48865433d8cb0cdae7a3a"
    sha256 high_sierra:    "83c0dbca7a5c28564eba4e7a73894746004aab5025071b350c3c47271fc42625"
    sha256 sierra:         "1203bb3d289e36e1ca15720dbcd4e63ffcf4fa4d09588cb4fb81092cb72399ec"
    sha256 el_capitan:     "78cf8e9fb973e3cd136a212936bdc8003d9897a1bb8a6a1eba3cc7ff0fba3c88"
  end

  depends_on "sdl"

  uses_from_macos "zlib"

  on_linux do
    depends_on "mesa"
    depends_on "mesa-glu"
  end

  def install
    makefile_dir = build.head? ? "Makefiles/Makefile.OSX" : "Makefiles/Makefile.SDL.OSX.GCC"
    if OS.mac?
      inreplace makefile_dir do |s|
        # Set up SDL library correctly
        s.gsub! "-framework SDL", "`sdl-config --libs`"
        s.gsub!(/(\$\(COMPILER_FLAGS\))/, "\\1 -I#{Formula["sdl"].opt_prefix}/include")
      end
    else
      makefile_dir = "Makefiles/Makefile.SDL.UNIX.GCC"
    end

    inreplace makefile_dir do |s|
      # Fix missing label issue for auto-generated code
{'fraction_non_alphanumeric': 0.09800409416581371, 'fraction_numerical': 0.2292732855680655, 'mean_word_length': 4.184350132625995, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 6, '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': '6572671', 'n_tokens_mistral': 2214, 'n_tokens_neox': 1737, 'n_words': 209}