homebrew-core/Formula/ppsspp.rb

103 lines
3.7 KiB
Ruby

class Ppsspp < Formula
desc "PlayStation Portable emulator"
homepage "https://ppsspp.org/"
url "https://github.com/hrydgard/ppsspp.git",
tag: "v1.14.4",
revision: "cd535263c1ad65fd03869591a8bd706680cbf04b"
license all_of: ["GPL-2.0-or-later", "BSD-3-Clause"]
head "https://github.com/hrydgard/ppsspp.git", branch: "master"
bottle do
sha256 cellar: :any, arm64_ventura: "12eb34a29c2d4dca85b14d53e0143315d9721f46eb48d2ca04b489fba7d546a1"
sha256 cellar: :any, arm64_monterey: "6c2e98b136aeac198bb244e74d14028d53931b1c1c0e411dbff4fa18c8c1ea69"
sha256 cellar: :any, arm64_big_sur: "71257d8d85c12d5d095ce55f3465cb66ccc2dd9432b8b707c661766d45d0d7ed"
sha256 cellar: :any, ventura: "a2ff1c001e74f000159f7cc2d2016c827dee9f5339eb3d43d1c91392238ffbe6"
sha256 cellar: :any, monterey: "d6bddfb72e3568f424c3f0d4237fd444b52d03b921ecf292cd5cf62fe45a4863"
sha256 cellar: :any, big_sur: "e3221b806f94a9a1d3cd447342d6862035075e1055eef040c47ddba6a7a31688"
sha256 cellar: :any_skip_relocation, x86_64_linux: "cfecd0667593b18ddcac5726a42e5ad6229d1e5ee1ebcacdc943241c5d028a5b"
end
depends_on "cmake" => :build
depends_on "nasm" => :build
depends_on "pkg-config" => :build
depends_on "python@3.11" => :build
depends_on "libzip"
depends_on "miniupnpc"
depends_on "sdl2"
depends_on "snappy"
depends_on "zstd"
uses_from_macos "zlib"
on_macos do
depends_on "molten-vk"
end
on_linux do
depends_on "glew"
end
on_intel do
# ARM uses a bundled, unreleased libpng.
# Make unconditional when we have libpng 1.7.
depends_on "libpng"
end
def install
# Build PPSSPP-bundled ffmpeg from source. Changes in more recent
# versions in ffmpeg make it unsuitable for use with PPSSPP, so
# upstream ships a modified version of ffmpeg 3.
# See https://github.com/Homebrew/homebrew-core/issues/84737.
cd "ffmpeg" do
if OS.mac?
rm_rf "macosx"
system "./mac-build.sh"
else
rm_rf "linux"
system "./linux_x86-64.sh"
end
end
# Replace bundled MoltenVK dylib with symlink to Homebrew-managed dylib
vulkan_frameworks = buildpath/"ext/vulkan/macOS/Frameworks"
(vulkan_frameworks/"libMoltenVK.dylib").unlink
vulkan_frameworks.install_symlink Formula["molten-vk"].opt_lib/"libMoltenVK.dylib"
mkdir "build" do
args = std_cmake_args + %w[
-DUSE_SYSTEM_LIBZIP=ON
-DUSE_SYSTEM_SNAPPY=ON
-DUSE_SYSTEM_LIBSDL2=ON
-DUSE_SYSTEM_LIBPNG=ON
-DUSE_SYSTEM_ZSTD=ON
-DUSE_SYSTEM_MINIUPNPC=ON
]
system "cmake", "..", *args
system "make"
if OS.mac?
prefix.install "PPSSPPSDL.app"
bin.write_exec_script "#{prefix}/PPSSPPSDL.app/Contents/MacOS/PPSSPPSDL"
mv "#{bin}/PPSSPPSDL", "#{bin}/ppsspp"
# Replace app bundles with symlinks to allow dependencies to be updated
app_frameworks = prefix/"PPSSPPSDL.app/Contents/Frameworks"
ln_sf (Formula["molten-vk"].opt_lib/"libMoltenVK.dylib").relative_path_from(app_frameworks), app_frameworks
ln_sf (Formula["sdl2"].opt_lib/"libSDL2-2.0.0.dylib").relative_path_from(app_frameworks), app_frameworks
else
bin.install "PPSSPPSDL" => "ppsspp"
end
end
end
test do
system "#{bin}/ppsspp", "--version"
if OS.mac?
app_frameworks = prefix/"PPSSPPSDL.app/Contents/Frameworks"
assert_predicate app_frameworks/"libMoltenVK.dylib", :exist?, "Broken linkage with `molten-vk`"
assert_predicate app_frameworks/"libSDL2-2.0.0.dylib", :exist?, "Broken linkage with `sdl2`"
end
end
end