67 lines
2.6 KiB
Ruby
67 lines
2.6 KiB
Ruby
class Corsixth < Formula
|
|
desc "Open source clone of Theme Hospital"
|
|
homepage "https://github.com/CorsixTH/CorsixTH"
|
|
url "https://github.com/CorsixTH/CorsixTH/archive/v0.63.tar.gz"
|
|
sha256 "9016ce0a22e0e800937970a91b48aaf536fc901c98d3edd1e11bf97590523d81"
|
|
head "https://github.com/CorsixTH/CorsixTH.git"
|
|
|
|
bottle do
|
|
sha256 "61fc2f45fa162f5f83620081655667041bf1d8afd933a67c2e9bde711c384472" => :catalina
|
|
sha256 "42ffa795dfc4749f31e753c224fd8f7ce1373631fb0f231db0ea8990d2eda064" => :mojave
|
|
sha256 "6af1f1845c4a56747cd4663ef0774f976b57a9954f7b1524da2b268bf819ea4c" => :high_sierra
|
|
sha256 "2dd1c75f87d4dda6a2becebd48109dcf0b4b28bae903e5fa54db913557bacbde" => :sierra
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "luarocks" => :build
|
|
depends_on :xcode => :build
|
|
depends_on "ffmpeg"
|
|
depends_on "freetype"
|
|
depends_on "lua"
|
|
depends_on "sdl2"
|
|
depends_on "sdl2_mixer"
|
|
|
|
resource "lpeg" do
|
|
url "http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-1.0.2.tar.gz"
|
|
mirror "https://sources.voidlinux.org/lua-lpeg-1.0.2/lpeg-1.0.2.tar.gz"
|
|
sha256 "48d66576051b6c78388faad09b70493093264588fcd0f258ddaab1cdd4a15ffe"
|
|
end
|
|
|
|
resource "luafilesystem" do
|
|
url "https://github.com/keplerproject/luafilesystem/archive/v1_7_0_2.tar.gz"
|
|
sha256 "23b4883aeb4fb90b2d0f338659f33a631f9df7a7e67c54115775a77d4ac3cc59"
|
|
end
|
|
|
|
def install
|
|
ENV["TARGET_BUILD_DIR"] = "."
|
|
ENV["FULL_PRODUCT_NAME"] = "CorsixTH.app"
|
|
|
|
luapath = libexec/"vendor"
|
|
ENV["LUA_PATH"] = "#{luapath}/share/lua/5.3/?.lua"
|
|
ENV["LUA_CPATH"] = "#{luapath}/lib/lua/5.3/?.so"
|
|
|
|
resources.each do |r|
|
|
r.stage do
|
|
system "luarocks", "build", r.name, "--tree=#{luapath}"
|
|
end
|
|
end
|
|
|
|
system "cmake", ".", "-DLUA_INCLUDE_DIR=#{Formula["lua"].opt_include}/lua",
|
|
"-DLUA_LIBRARY=#{Formula["lua"].opt_lib}/liblua.dylib",
|
|
"-DLUA_PROGRAM_PATH=#{Formula["lua"].opt_bin}/lua",
|
|
"-DCORSIX_TH_DATADIR=#{prefix}/CorsixTH.app/Contents/Resources/",
|
|
*std_cmake_args
|
|
system "make"
|
|
cp_r %w[CorsixTH/CorsixTH.lua CorsixTH/Lua CorsixTH/Levels CorsixTH/Campaigns CorsixTH/Graphics CorsixTH/Bitmap], "CorsixTH/CorsixTH.app/Contents/Resources/"
|
|
prefix.install "CorsixTH/CorsixTH.app"
|
|
|
|
env = { :LUA_PATH => ENV["LUA_PATH"], :LUA_CPATH => ENV["LUA_CPATH"] }
|
|
(bin/"CorsixTH").write_env_script(prefix/"CorsixTH.app/Contents/MacOS/CorsixTH", env)
|
|
end
|
|
|
|
test do
|
|
app = prefix/"CorsixTH.app/Contents/MacOS/CorsixTH"
|
|
assert_includes MachO::Tools.dylibs(app),
|
|
"#{Formula["lua"].opt_lib}/liblua.5.3.dylib"
|
|
end
|
|
end
|