homebrew-core/Formula/onscripter.rb

79 lines
2.9 KiB
Ruby

class Onscripter < Formula
desc "NScripter-compatible visual novel engine"
homepage "https://onscripter.osdn.jp/onscripter.html"
url "https://onscripter.osdn.jp/onscripter-20220123.tar.gz"
sha256 "5da41dc3471eeec8c93153906b39dac0a32edbb2bcefce0fa0a976c148b448ca"
license "GPL-2.0-or-later"
livecheck do
url :homepage
regex(/href=.*?onscripter[._-]v?(\d+(?:\.\d+)*)\.t/i)
end
bottle do
sha256 cellar: :any, arm64_monterey: "6df121cc439c63ec6804ab3c781c0062b4bca08af5362bc866a1ca0565da8982"
sha256 cellar: :any, arm64_big_sur: "608b9e37d9da7ec4edb68d3542fe45d0593b6bd52d64e234caa5c681086ff993"
sha256 cellar: :any, monterey: "4b917a20089f1917708e638862a7b09034409e65b6309b2cce72351d62fff52d"
sha256 cellar: :any, big_sur: "a76c2fb8593c7e5d66c281ba69b59e8c4ee763eef572763ec44c2cca1bace610"
sha256 cellar: :any, catalina: "be36e240be9435dc871afeddb024aa23aec53364d8843d19ba88a7bd260915c7"
sha256 cellar: :any_skip_relocation, x86_64_linux: "f37f7590b3c8e52cc551875e0cef051e922d51a0d0fbc28eae1e6a9637868444"
end
depends_on "pkg-config" => :build
depends_on "jpeg"
depends_on "lua"
depends_on "sdl"
depends_on "sdl_image"
depends_on "sdl_mixer"
depends_on "sdl_ttf"
depends_on "smpeg"
def install
# Configuration is done through editing of Makefiles.
# Comment out optional libavifile dependency on Linux as it is old and unmaintained.
inreplace "Makefile.Linux" do |s|
s.gsub!("DEFS += -DUSE_AVIFILE", "#DEFS += -DUSE_AVIFILE")
s.gsub!("INCS += `avifile-config --cflags`", "#INCS += `avifile-config --cflags`")
s.gsub!("LIBS += `avifile-config --libs`", "#LIBS += `avifile-config --libs`")
s.gsub!("TARGET += simple_aviplay$(EXESUFFIX)", "#TARGET += simple_aviplay$(EXESUFFIX)")
s.gsub!("EXT_OBJS += AVIWrapper$(OBJSUFFIX)", "#EXT_OBJS += AVIWrapper$(OBJSUFFIX)")
end
incs = [
`pkg-config --cflags sdl SDL_ttf SDL_image SDL_mixer`.chomp,
`smpeg-config --cflags`.chomp,
"-I#{Formula["jpeg"].include}",
"-I#{Formula["lua"].opt_include}/lua",
]
libs = [
`pkg-config --libs sdl SDL_ttf SDL_image SDL_mixer`.chomp,
`smpeg-config --libs`.chomp,
"-ljpeg",
"-lbz2",
"-L#{Formula["lua"].opt_lib} -llua",
]
defs = %w[
-DUSE_CDROM
-DUSE_LUA
-DUTF8_CAPTION
-DUTF8_FILESYSTEM
]
defs << "-DMACOSX" if OS.mac?
ext_objs = ["LUAHandler.o"]
k = %w[INCS LIBS DEFS EXT_OBJS]
v = [incs, libs, defs, ext_objs].map { |x| x.join(" ") }
args = k.zip(v).map { |x| x.join("=") }
platform = OS.mac? ? "MacOSX" : "Linux"
system "make", "-f", "Makefile.#{platform}", *args
bin.install %w[onscripter sardec nsadec sarconv nsaconv]
end
test do
assert shell_output("#{bin}/onscripter -v").start_with? "ONScripter version #{version}"
end
end