homebrew-core/Formula/rom-tools.rb

81 lines
3.2 KiB
Ruby

class RomTools < Formula
desc "Tools for Multiple Arcade Machine Emulator"
homepage "https://mamedev.org/"
# NOTE: Please keep these values in sync with mame.rb when updating.
url "https://github.com/mamedev/mame/archive/mame0229.tar.gz"
version "0.229"
sha256 "414921771ada0804a8c7f3540e33338e8495e16a3bca78a5a2b355abafa51e6a"
license "GPL-2.0-or-later"
head "https://github.com/mamedev/mame.git"
# MAME tags (and filenames) are formatted like `mame0226`, so livecheck will
# report the version like `0226`. We work around this by matching the link
# text for the release title, since it contains the properly formatted version
# (e.g., 0.226).
livecheck do
url :stable
strategy :github_latest
regex(%r{release-header.*?/releases/tag/mame[._-]?\d+(?:\.\d+)*["' >]>MAME v?(\d+(?:\.\d+)+)}im)
end
bottle do
sha256 cellar: :any, arm64_big_sur: "c5f28651dc57cb59edb9c676454e2da56f645c86af93a38142abf1c3aafa1b9f"
sha256 cellar: :any, big_sur: "1db31d340cd27fd37dc2cdf9357a30e7e43309e2a1e23b227916f495fb686fec"
sha256 cellar: :any, catalina: "b8568dae7da9d8757a2090977e3a0de54b2af9e2789f9c037a6f82ff58b93950"
sha256 cellar: :any, mojave: "f142061a46b8dee3bc77d4afb1984a1b9bee119f71acf40dee50b61f8af079a8"
end
depends_on "pkg-config" => :build
depends_on "python@3.9" => :build
depends_on "flac"
# Need C++ compiler and standard library support C++17.
depends_on macos: :high_sierra
depends_on "sdl2"
depends_on "utf8proc"
uses_from_macos "expat"
uses_from_macos "zlib"
def install
# Cut sdl2-config's invalid option.
inreplace "scripts/src/osd/sdl.lua", "--static", ""
# Use bundled asio instead of latest version.
# See: <https://github.com/mamedev/mame/issues/5721>
system "make", "PYTHON_EXECUTABLE=#{Formula["python@3.9"].opt_bin}/python3",
"TOOLS=1",
"USE_LIBSDL=1",
"USE_SYSTEM_LIB_EXPAT=1",
"USE_SYSTEM_LIB_ZLIB=1",
"USE_SYSTEM_LIB_ASIO=",
"USE_SYSTEM_LIB_FLAC=1",
"USE_SYSTEM_LIB_UTF8PROC=1"
bin.install %w[
aueffectutil castool chdman floptool imgtool jedutil ldresample ldverify
nltool nlwav pngcmp regrep romcmp srcclean testkeys unidasm
]
bin.install "split" => "rom-split"
man1.install Dir["docs/man/*.1"]
end
# Needs more comprehensive tests
test do
# system "#{bin}/aueffectutil" # segmentation fault
system "#{bin}/castool"
assert_match "chdman info", shell_output("#{bin}/chdman help info", 1)
system "#{bin}/floptool"
system "#{bin}/imgtool", "listformats"
system "#{bin}/jedutil", "-viewlist"
assert_match "linear equation", shell_output("#{bin}/ldresample 2>&1", 1)
assert_match "avifile.avi", shell_output("#{bin}/ldverify 2>&1", 1)
system "#{bin}/nltool", "--help"
system "#{bin}/nlwav", "--help"
assert_match "image1", shell_output("#{bin}/pngcmp 2>&1", 10)
assert_match "summary", shell_output("#{bin}/regrep 2>&1", 1)
system "#{bin}/romcmp"
system "#{bin}/rom-split"
system "#{bin}/srcclean"
assert_match "architecture", shell_output("#{bin}/unidasm", 1)
end
end