homebrew-core/Formula/rom-tools.rb

82 lines
3.1 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/mame0227.tar.gz"
version "0.227"
sha256 "95dbce00a4f05a35f66ef966fe9efad1e4e78ce62e0eba3f7031dfa6737829a5"
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
cellar :any
sha256 "a3e44ba13e3b5ac1364b8e9f8dd69f94a80c04f9c2f32618ad4d92cca22b6089" => :big_sur
sha256 "ee6184ba808b242ccd16c67dad339734fa23f1c18701cd90ab0c7af5e9a833cd" => :arm64_big_sur
sha256 "01f4834ddf14b8104b3897be4a7a26afc8ed23448ccb4dee8eb3349922b46f42" => :catalina
sha256 "711ea5647b19ed358c6f0c5c2a2f9b4a3b08e9713d84ce307ca191e85719a242" => :mojave
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