class Onscripter < Formula desc "NScripter-compatible visual novel engine" homepage "https://onscripter.osdn.jp/" url "https://onscripter.osdn.jp/onscripter-20191116.tar.gz" sha256 "64c7e59ce2db424635699653c7af0f77f1eb36a1f20fb808a70cdd4406d8394d" bottle do cellar :any sha256 "45321b8f1937bcebc2fa9575573efe3b05894c95fd7b0b2fb4734112a81b2e14" => :catalina sha256 "88ea358b2edec9e4fe015109ef84d20cc24e9cf04c6947c5dd7fe9be4931c757" => :mojave sha256 "a6584397b6b4fdec037876159b200f13ce6836890139204a6fb14eeb2d65b8cf" => :high_sierra 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 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[ -DMACOSX -DUSE_CDROM -DUSE_LUA -DUTF8_CAPTION -DUTF8_FILESYSTEM ] 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("=") } system "make", "-f", "Makefile.MacOSX", *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