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.1",
revision: "2d1f8f03fac5f6f8322d83ec838f3a4a003bf334"
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: "d41bae5bf1be43e4ef6098d77e8eb6b8a27ed7f1d52ae9490fc08cbced44a4b7"
sha256 cellar: :any, arm64_monterey: "386f151cf43da8872b18245209baf3b923b9f0719c999213afc24ca93eb31fe3"
sha256 cellar: :any, arm64_big_sur: "f8365b9e425afb615c7bdaf27b0ea5b5bd1a24bbb58b6184a9352fdf79a1b333"
sha256 cellar: :any, ventura: "3f901fa1496ad690a5e09addb5d98da9f9c8a51ef2e529c2237aeb6d384a04e2"
sha256 cellar: :any, monterey: "ff70245f73867cf5cc7234bb3bff2c3f1fc171644ed81a74b59f41ab137ae60e"
sha256 cellar: :any, big_sur: "5adb5441c94e0a4c2bde8f0084f48b8231d96682f195bdb0c489b69e3bd09862"
sha256 cellar: :any_skip_relocation, x86_64_linux: "df5852e6f0b51d9bc64ae95919d68bdf26476712a41c0c37730684c172c07547"
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