-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
/
rom-tools.rb
99 lines (89 loc) 路 3.45 KB
/
rom-tools.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
class RomTools < Formula
desc "Tools for Multiple Arcade Machine Emulator"
homepage "https://mamedev.org/"
url "https://github.com/mamedev/mame/archive/refs/tags/mame0265.tar.gz"
version "0.265"
sha256 "3de68db66efb783eb5c5d7ccad1f4a4f5eadc6c7a29c1a9c2097e532c3e0b8b1"
license "GPL-2.0-or-later"
head "https://github.com/mamedev/mame.git", branch: "master"
livecheck do
formula "mame"
end
bottle do
sha256 cellar: :any, arm64_sonoma: "281e40ccb9d8f486c8c1ef51d93ce7bb2fd3e12b117e12c92fa3bb22b59efb16"
sha256 cellar: :any, arm64_ventura: "4d2d018f44c09c676ab675922c099e2a75ce5d354a3e1a6bfc571cd14a7ff51f"
sha256 cellar: :any, arm64_monterey: "efbc7862c32912a041ef48094aff1b349c0e90d4cd59e60bf9735055d5e1ef90"
sha256 cellar: :any, sonoma: "9067436ce28bc3ee0c070aa9beeb175dd8f002a4904bf17f7604f8539df9a816"
sha256 cellar: :any, ventura: "cb3cbcdc56593d4b110aabf537bf9d7f09b0b83971d33a69c4527454ecefd315"
sha256 cellar: :any, monterey: "485ad57a8418b387a424774897840f26a953313d01ea184ececefe34f0de5c4d"
sha256 cellar: :any_skip_relocation, x86_64_linux: "135d2044295db9d309c644033281a24c952253a4b8e8ffbf4e8ce682473a806b"
end
depends_on "asio" => :build
depends_on "pkg-config" => :build
depends_on "flac"
# Need C++ compiler and standard library support C++17.
depends_on macos: :high_sierra
depends_on "sdl2"
depends_on "utf8proc"
depends_on "zstd"
uses_from_macos "python" => :build
uses_from_macos "expat"
uses_from_macos "zlib"
on_linux do
depends_on "portaudio" => :build
depends_on "portmidi" => :build
depends_on "pulseaudio" => :build
depends_on "qt@5" => :build
depends_on "sdl2_ttf" => :build
end
fails_with gcc: "5" # for C++17
fails_with gcc: "6"
def install
# Cut sdl2-config's invalid option.
inreplace "scripts/src/osd/sdl.lua", "--static", ""
args = %W[
PYTHON_EXECUTABLE=#{which("python3")}
TOOLS=1
EMULATOR=0
USE_LIBSDL=1
USE_SYSTEM_LIB_EXPAT=1
USE_SYSTEM_LIB_ZLIB=1
USE_SYSTEM_LIB_ASIO=1
USE_SYSTEM_LIB_FLAC=1
USE_SYSTEM_LIB_UTF8PROC=1
USE_SYSTEM_LIB_ZSTD=1
VERBOSE=1
]
if OS.linux?
args << "USE_SYSTEM_LIB_PORTAUDIO=1"
args << "USE_SYSTEM_LIB_PORTMIDI=1"
end
system "make", *args
bin.install %w[
castool chdman floptool imgtool jedutil ldresample ldverify
nltool nlwav pngcmp regrep romcmp srcclean testkeys unidasm
]
bin.install "split" => "rom-split"
bin.install "aueffectutil" if OS.mac?
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