class Mupen64plus < Formula desc "Cross-platform plugin-based N64 emulator" homepage "https://www.mupen64plus.org/" url "https://github.com/mupen64plus/mupen64plus-core/releases/download/2.5/mupen64plus-bundle-src-2.5.tar.gz" sha256 "9c75b9d826f2d24666175f723a97369b3a6ee159b307f7cc876bbb4facdbba66" license "GPL-2.0" revision 2 livecheck do url :stable strategy :github_latest end bottle do sha256 cellar: :any, monterey: "6b86a8fd100955661cd1425b27df33df0bf7949ef164a401e7066425c8022a77" sha256 cellar: :any, big_sur: "da9aa98b919af2324eb868de2c5fa5cdbb4809d84cbf238ea56a7a99deb92402" sha256 cellar: :any, catalina: "33554823abe8df4c756c48d9956c7edd66f6009b9ab4c57829bc2084f2a4b96f" sha256 cellar: :any_skip_relocation, x86_64_linux: "84c9544695c149cbdb1d0a662e9dccc1fc004b984e3e53b0537be1fe653566ad" end depends_on "pkg-config" => :build depends_on "boost" depends_on "freetype" depends_on "libpng" depends_on "sdl2" on_linux do depends_on "mesa" depends_on "mesa-glu" end resource "rom" do url "https://github.com/mupen64plus/mupen64plus-rom/raw/76ef14c876ed036284154444c7bdc29d19381acc/m64p_test_rom.v64" sha256 "b5fe9d650a67091c97838386f5102ad94c79232240f9c5bcc72334097d76224c" end def install # Prevent different C++ standard library warning inreplace Dir["source/mupen64plus-**/projects/unix/Makefile"], /(-mmacosx-version-min)=\d+\.\d+/, "\\1=#{MacOS.version}" # Fix build with Xcode 9 using upstream commit: # https://github.com/mupen64plus/mupen64plus-video-glide64mk2/commit/5ac11270 # Remove in next version inreplace "source/mupen64plus-video-glide64mk2/src/Glide64/3dmath.cpp", "__builtin_ia32_storeups", "_mm_storeu_ps" args = ["install", "PREFIX=#{prefix}"] args << if OS.mac? "INSTALL_STRIP_FLAG=-S" else "USE_GLES=1" end cd "source/mupen64plus-core/projects/unix" do system "make", *args end cd "source/mupen64plus-audio-sdl/projects/unix" do system "make", *args, "NO_SRC=1", "NO_SPEEX=1" end cd "source/mupen64plus-input-sdl/projects/unix" do system "make", *args end cd "source/mupen64plus-rsp-hle/projects/unix" do system "make", *args end cd "source/mupen64plus-video-glide64mk2/projects/unix" do system "make", *args end cd "source/mupen64plus-video-rice/projects/unix" do system "make", *args end cd "source/mupen64plus-ui-console/projects/unix" do system "make", *args end end test do # Disable test in Linux CI because it hangs because a display is not available. return if OS.linux? && ENV["HOMEBREW_GITHUB_ACTIONS"] resource("rom").stage do system bin/"mupen64plus", "--testshots", "1", "m64p_test_rom.v64" end end end