homebrew-core/Formula/mupen64plus.rb

102 lines
3.1 KiB
Ruby

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-or-later"
revision 3
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 cellar: :any, ventura: "b8ea3824da04307420df3869d8d11d7658335f4c9543d06472fc764dc779568c"
sha256 cellar: :any, monterey: "2eb73488a405767005c7bfa38827477a3af3750f6a0b89ecdf83426c0c5569bf"
sha256 cellar: :any, big_sur: "609e68da8f0f86b81330a41b2fd8e8b38b3c1ac6e3523137ebf7b8b2036bdc70"
sha256 cellar: :any, catalina: "f12ab0580cb949f04b44fb14d9607b1fd6dfe707b1eeec67e7c6429a49f48115"
sha256 cellar: :any_skip_relocation, x86_64_linux: "84ce051c633e46df34386a95ac16d6f7ebfd732b3d91f545898b611ca6969e97"
end
depends_on "pkg-config" => :build
depends_on arch: :x86_64
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"
if OS.linux?
ENV.append "CFLAGS", "-fcommon"
ENV.append "CFLAGS", "-fpie"
end
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, "PIE=1"
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