homebrew-core/Formula/onscripter.rb
2017-02-08 10:12:26 +00:00

73 lines
1.9 KiB
Ruby

class Onscripter < Formula
desc "NScripter-compatible visual novel engine"
homepage "https://onscripter.osdn.jp/"
url "https://onscripter.osdn.jp/onscripter-20161102.tar.gz"
sha256 "e9a39b1c45cc47c363eb15773a9944da7a29eff74261ccb656ff5ce4b5fdd5d8"
bottle do
cellar :any
sha256 "6d722b32bb2a3f120b8df06013d5876eb1484b68d40bdc6155bcde2cf88546fb" => :sierra
sha256 "b5d74322c46656129c0ac285b8702842ea0611ab3dc8f6ac7a2f385bd348387a" => :el_capitan
sha256 "89ec41fe247d1a90ca201a4906cc304480b2c3edc97dd1bf12ff1f0f90c59e02" => :yosemite
end
option "with-english", "Build with single-byte character mode"
depends_on "pkg-config" => :build
depends_on "sdl"
depends_on "sdl_ttf"
depends_on "sdl_image"
depends_on "sdl_mixer" => "with-libvorbis"
depends_on "smpeg"
depends_on "jpeg"
depends_on "lua" => :recommended
def install
incs = [
`pkg-config --cflags sdl SDL_ttf SDL_image SDL_mixer`.chomp,
`smpeg-config --cflags`.chomp,
"-I#{Formula["jpeg"].include}",
]
libs = [
`pkg-config --libs sdl SDL_ttf SDL_image SDL_mixer`.chomp,
`smpeg-config --libs`.chomp,
"-ljpeg",
"-lbz2",
]
defs = %w[
-DMACOSX
-DUSE_CDROM
-DUTF8_CAPTION
-DUTF8_FILESYSTEM
]
ext_objs = []
if build.with? "lua"
lua = Formula["lua"]
incs << "-I#{lua.include}"
libs << "-L#{lua.lib} -llua"
defs << "-DUSE_LUA"
ext_objs << "LUAHandler.o"
end
if build.with? "english"
defs += %w[
-DENABLE_1BYTE_CHAR
-DFORCE_1BYTE_CHAR
]
end
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