parent
b1efa178a8
commit
439f9dc9b0
|
@ -1,30 +1,71 @@
|
|||
class Corsixth < Formula
|
||||
desc "Open source clone of Theme Hospital"
|
||||
homepage "https://github.com/CorsixTH/CorsixTH"
|
||||
url "https://github.com/CorsixTH/CorsixTH/archive/v0.60.tar.gz"
|
||||
sha256 "f5ff7839b6469f1da39804de1df0a86e57b45620c26f044a1700e43d8da19ce9"
|
||||
head "https://github.com/CorsixTH/CorsixTH"
|
||||
revision 1
|
||||
head "https://github.com/CorsixTH/CorsixTH.git"
|
||||
|
||||
bottle :disable, "LuaRocks requirements preclude bottling"
|
||||
stable do
|
||||
url "https://github.com/CorsixTH/CorsixTH/archive/v0.60.tar.gz"
|
||||
sha256 "f5ff7839b6469f1da39804de1df0a86e57b45620c26f044a1700e43d8da19ce9"
|
||||
|
||||
# Applies the upstream patch prioritising newer Luas over older ones.
|
||||
patch do
|
||||
url "https://github.com/CorsixTH/CorsixTH/commit/46420b76.patch"
|
||||
sha256 "076639d0da1f29c263fe2dae96bc759029270d421d7d9388516ed8147defd722"
|
||||
end
|
||||
end
|
||||
|
||||
depends_on "cmake" => :build
|
||||
depends_on :xcode => :build
|
||||
|
||||
depends_on "ffmpeg"
|
||||
depends_on "freetype"
|
||||
depends_on "lua"
|
||||
depends_on "sdl2"
|
||||
depends_on "sdl2_mixer"
|
||||
|
||||
depends_on "lpeg" => :lua
|
||||
depends_on "luafilesystem" => :lua
|
||||
resource "lpeg" do
|
||||
url "https://ftp.openbsd.org/pub/OpenBSD/distfiles/lpeg-1.0.1.tar.gz"
|
||||
mirror "https://ftp.heanet.ie/mirrors/ftp.openbsd.org/distfiles/lpeg-1.0.1.tar.gz"
|
||||
sha256 "62d9f7a9ea3c1f215c77e0cadd8534c6ad9af0fb711c3f89188a8891c72f026b"
|
||||
end
|
||||
|
||||
resource "luafilesystem" do
|
||||
url "https://github.com/keplerproject/luafilesystem/archive/v_1_6_3.tar.gz"
|
||||
sha256 "5525d2b8ec7774865629a6a29c2f94cb0f7e6787987bf54cd37e011bfb642068"
|
||||
end
|
||||
|
||||
def install
|
||||
ENV["TARGET_BUILD_DIR"] = "."
|
||||
ENV["FULL_PRODUCT_NAME"] = "CorsixTH.app"
|
||||
|
||||
luapath = libexec/"vendor"
|
||||
ENV["LUA_PATH"] = "#{luapath}/share/lua/5.2/?.lua"
|
||||
ENV["LUA_CPATH"] = "#{luapath}/lib/lua/5.2/?.so"
|
||||
|
||||
resources.each do |r|
|
||||
r.stage do
|
||||
system "luarocks", "build", r.name, "--tree=#{luapath}"
|
||||
end
|
||||
end
|
||||
|
||||
# Ensures it uses the intended Lua (5.2) rather than 5.1/5.3 or
|
||||
# attempting to use a combination of two Luas, which can happen.
|
||||
inreplace "CMake/FindLua.cmake" do |s|
|
||||
s.gsub! "lua53 lua5.3 lua-5.3 liblua.5.3.dylib", ""
|
||||
s.gsub! "include/lua53 include/lua5.3 include/lua-5.3", "include"
|
||||
end
|
||||
|
||||
system "cmake", ".", *std_cmake_args
|
||||
system "make"
|
||||
prefix.install "CorsixTH/CorsixTH.app"
|
||||
bin.write_exec_script "#{prefix}/CorsixTH.app/Contents/MacOS/CorsixTH"
|
||||
|
||||
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.2.dylib"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue