class Stella < Formula desc "Atari 2600 VCS emulator" homepage "https://stella-emu.github.io/" url "https://github.com/stella-emu/stella/releases/download/release-4.7.3/stella-4.7.3-src.tar.xz" sha256 "93a75d1b343b1e66b6dc526c0f9d8a0c3678d346033f7cdfe76dc93f14d956ad" head "https://github.com/stella-emu/stella.git" bottle do cellar :any sha256 "8676b1b5b17837ee8db1f76abede2f8605c931b1d297acfa4fd6e8906533ff7a" => :sierra sha256 "b3b2418a60067ed1d59564f11046aded090fee197c1359669b98998577b868a7" => :el_capitan sha256 "122a3eb83c9fcf7a9c094664595fd4a4265338dd25a08e72dfa99d1496591606" => :yosemite end depends_on :xcode => :build depends_on "sdl2" depends_on "libpng" def install cd "src/macosx" do inreplace "stella.xcodeproj/project.pbxproj" do |s| s.gsub! %r{(\w{24} \/\* SDL2\.framework)}, '//\1' s.gsub! %r{(\w{24} \/\* png)}, '//\1' s.gsub! /(HEADER_SEARCH_PATHS) = \(/, "\\1 = (#{Formula["sdl2"].include}/SDL2, #{Formula["libpng"].include}," s.gsub! /(LIBRARY_SEARCH_PATHS) = \.;/, "\\1 = (#{Formula["sdl2"].lib}, #{Formula["libpng"].lib}, .);" s.gsub! /(OTHER_LDFLAGS) = "((-\w+)*)"/, '\1 = "-lSDL2 -lpng \2"' end xcodebuild "SYMROOT=build" prefix.install "build/Default/Stella.app" bin.write_exec_script "#{prefix}/Stella.app/Contents/MacOS/Stella" end end test do assert_match /Stella version #{version}/, shell_output("#{bin}/Stella -help").strip end end