class Onscripter < Formula desc "NScripter-compatible visual novel engine" homepage "https://onscripter.osdn.jp/" url "https://onscripter.osdn.jp/onscripter-20181218.tar.gz" sha256 "724bd96c3687f2848292f5308d0a39d702957be22f0fe790f404522efcce113f" bottle do cellar :any sha256 "b6abab7894db68812623cbdc53658979f7315fcac7ca5348fcc109112abbd7f6" => :mojave sha256 "fb948f3d991f248a3ff0186088ecd2f72e935f254c025a991ee74e84857e0662" => :high_sierra sha256 "5b113d4313b15493f4b8ab05911bc8c5ec7a9d6d0c81246139205a0d7ee9b222" => :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