206 lines
7.2 KiB
Ruby
206 lines
7.2 KiB
Ruby
class Sile < Formula
|
|
desc "Modern typesetting system inspired by TeX"
|
|
homepage "https://sile-typesetter.org"
|
|
url "https://github.com/sile-typesetter/sile/releases/download/v0.14.5/sile-0.14.5.tar.xz"
|
|
sha256 "2f0d6bb49efdf38a44f322ccc7cdb5bb9c2207fdbb44f67aa362ea0963068e07"
|
|
license "MIT"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_ventura: "b1ec8a69f69bec2fde86d310994642f2b47dbcc7a5523b780b5dd9f5e1a3dd17"
|
|
sha256 cellar: :any, arm64_monterey: "173fa5e31a65fb208bfd27dff30e3bedb7115105679c5f75b1e7d396e68fc437"
|
|
sha256 cellar: :any, arm64_big_sur: "509e7218127ad380a0ca7628bdca7c200be4134b5b7a7f77a4ccb882052d0343"
|
|
sha256 cellar: :any, ventura: "0d7bc022a47e22b81845f0b7ca9cca64538a259f8bd68c253c1310d3570464d2"
|
|
sha256 cellar: :any, monterey: "f1e8cc09a3d2259047ff0922fca9ed595273f01b84f018bd180158a7dbfedc9a"
|
|
sha256 cellar: :any, big_sur: "5521f377b47e5da50f89dd1fbb59fcfe0ef98d40b9999358359acb31b9566f25"
|
|
sha256 cellar: :any, catalina: "f592d76567d2a0bd440f3767dbc68e8add9bba65f9ba72be995800099ed8bcf4"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "561b25ec149b24c4e094a9f62561a3af055c7abe223c7b509bb0e3cffafaa406"
|
|
end
|
|
|
|
head do
|
|
url "https://github.com/sile-typesetter/sile.git", branch: "master"
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "fontconfig"
|
|
depends_on "harfbuzz"
|
|
depends_on "icu4c"
|
|
depends_on "libpng"
|
|
depends_on "lua"
|
|
depends_on "luarocks"
|
|
depends_on "openssl@1.1"
|
|
|
|
uses_from_macos "unzip" => :build
|
|
uses_from_macos "expat"
|
|
uses_from_macos "zlib"
|
|
|
|
resource "bit32" do
|
|
url "https://luarocks.org/manifests/siffiejoe/bit32-5.3.5.1-1.src.rock"
|
|
sha256 "0e273427f2b877270f9cec5642ebe2670242926ba9638d4e6df7e4e1263ca12c"
|
|
end
|
|
|
|
resource "linenoise" do
|
|
url "https://luarocks.org/manifests/hoelzro/linenoise-0.9-1.rockspec"
|
|
sha256 "e4f942e0079092993832cf6e78a1f019dad5d8d659b9506692d718d0c0432c72"
|
|
end
|
|
|
|
resource "lpeg" do
|
|
url "https://luarocks.org/manifests/gvvaughan/lpeg-1.0.2-1.src.rock"
|
|
sha256 "e0d0d687897f06588558168eeb1902ac41a11edd1b58f1aa61b99d0ea0abbfbc"
|
|
end
|
|
|
|
# depends on lpeg
|
|
resource "cosmo" do
|
|
url "https://luarocks.org/manifests/mascarenhas/cosmo-16.06.04-1.src.rock"
|
|
sha256 "9c83d50c8b734c0d405f97df9940ddb27578214033fd0e3cfc3e7420c999b9a9"
|
|
end
|
|
|
|
resource "loadkit" do
|
|
url "https://luarocks.org/manifests/leafo/loadkit-1.1.0-1.src.rock"
|
|
sha256 "6a631cb08a78324cb5f92b1cb8e2f59502d7113407d0d9b0d95045d8a4febccb"
|
|
end
|
|
|
|
resource "lua_cliargs" do
|
|
url "https://luarocks.org/manifests/amireh/lua_cliargs-3.0-2.src.rock"
|
|
sha256 "3c79981292aab72dbfba9eb5c006bb37c5f42ee73d7062b15fdd840c00b70d63"
|
|
end
|
|
|
|
resource "lua-zlib" do
|
|
url "https://luarocks.org/manifests/brimworks/lua-zlib-1.2-1.rockspec"
|
|
sha256 "3c61e946b5a1fb150839cd155ad6528143cdf9ce385eb5f580566fb2d25b37a3"
|
|
end
|
|
|
|
resource "luaexpat" do
|
|
url "https://luarocks.org/manifests/lunarmodules/luaexpat-1.4.1-1.src.rock"
|
|
sha256 "b2b31f62fd09252d7ec0218d083cf9b8d9fc6a20f4594559f96649beee172233"
|
|
end
|
|
|
|
# depends on lpeg
|
|
resource "luaepnf" do
|
|
url "https://luarocks.org/manifests/siffiejoe/luaepnf-0.3-2.src.rock"
|
|
sha256 "7abbe5888abfa183878751e4010239d799e0dfca6139b717f375c26292876f07"
|
|
end
|
|
|
|
resource "luafilesystem" do
|
|
url "https://luarocks.org/manifests/hisham/luafilesystem-1.8.0-1.src.rock"
|
|
sha256 "576270a55752894254c2cba0d49d73595d37ec4ea8a75e557fdae7aff80e19cf"
|
|
end
|
|
|
|
resource "luarepl" do
|
|
url "https://luarocks.org/manifests/hoelzro/luarepl-0.10-1.rockspec"
|
|
sha256 "a3a16e6e5e84eb60e2a5386d3212ab37c472cfe3110d75642de571a29da4ed8b"
|
|
end
|
|
|
|
resource "luasocket" do
|
|
url "https://luarocks.org/manifests/lunarmodules/luasocket-3.1.0-1.src.rock"
|
|
sha256 "f4a207f50a3f99ad65def8e29c54ac9aac668b216476f7fae3fae92413398ed2"
|
|
end
|
|
|
|
# depends on luasocket
|
|
resource "luasec" do
|
|
url "https://luarocks.org/manifests/brunoos/luasec-1.1.0-1.src.rock"
|
|
sha256 "534e16ead4bcddb9d536869fdaf0cac049c8bc710a01749f99df3b63b68e2e24"
|
|
end
|
|
|
|
# depends on luafilesystem
|
|
resource "penlight" do
|
|
url "https://luarocks.org/manifests/tieske/penlight-1.13.1-1.src.rock"
|
|
sha256 "fa028f7057cad49cdb84acdd9fe362f090734329ceca8cc6abb2d95d43b91835"
|
|
end
|
|
|
|
# depends on penlight
|
|
resource "cldr" do
|
|
url "https://luarocks.org/manifests/alerque/cldr-0.2.0-0.src.rock"
|
|
sha256 "965e2917b2d06b1c416935be4d7a59aa438e9bad5015b2aefd055f0efdd79758"
|
|
end
|
|
|
|
# depends on cldr, luaepnf, penlight
|
|
resource "fluent" do
|
|
url "https://luarocks.org/manifests/alerque/fluent-0.2.0-0.src.rock"
|
|
sha256 "ea915c689dfce2a7ef5551eb3c09d4620bae60a51c20d48d85c14b69bf3f28ba"
|
|
end
|
|
|
|
# depends on luafilesystem, penlight
|
|
resource "cassowary" do
|
|
url "https://luarocks.org/manifests/simoncozens/cassowary-2.3.2-1.src.rock"
|
|
sha256 "2d3c3954eeb8b5da1d7b1b56c209ed3ae11d221220967c159f543341917ce726"
|
|
end
|
|
|
|
resource "luautf8" do
|
|
url "https://luarocks.org/manifests/xavier-wang/luautf8-0.1.4-1.src.rock"
|
|
sha256 "4c530792e2a6143c19214f299dd17addea5f57a839407cc74aea882cf2403686"
|
|
end
|
|
|
|
resource "vstruct" do
|
|
url "https://luarocks.org/manifests/deepakjois/vstruct-2.1.1-1.src.rock"
|
|
sha256 "fcfa781a72b9372c37ee20a5863f98e07112a88efea08c8b15631e911bc2b441"
|
|
end
|
|
|
|
def install
|
|
lua = Formula["lua"]
|
|
luaversion = lua.version.major_minor
|
|
luapath = libexec/"vendor"
|
|
|
|
paths = %W[
|
|
#{luapath}/share/lua/#{luaversion}/?.lua
|
|
#{luapath}/share/lua/#{luaversion}/?/init.lua
|
|
#{luapath}/share/lua/#{luaversion}/lxp/?.lua
|
|
]
|
|
|
|
ENV["LUA_PATH"] = paths.join(";")
|
|
ENV["LUA_CPATH"] = "#{luapath}/lib/lua/#{luaversion}/?.so"
|
|
|
|
ENV.prepend "CPPFLAGS", "-I#{lua.opt_include}/lua"
|
|
ENV.prepend "LDFLAGS", "-L#{lua.opt_lib}"
|
|
|
|
zlib_dir = expat_dir = "#{MacOS.sdk_path_if_needed}/usr"
|
|
if OS.linux?
|
|
zlib_dir = Formula["zlib"].opt_prefix
|
|
expat_dir = Formula["expat"].opt_prefix
|
|
end
|
|
|
|
args = %W[
|
|
ZLIB_DIR=#{zlib_dir}
|
|
EXPAT_DIR=#{expat_dir}
|
|
OPENSSL_DIR=#{Formula["openssl@1.1"].opt_prefix}
|
|
--tree=#{luapath}
|
|
--lua-dir=#{lua.opt_prefix}
|
|
]
|
|
|
|
resources.each do |r|
|
|
r.stage do
|
|
rock = Pathname.pwd.children(false).first
|
|
unpack_dir = Utils.safe_popen_read("luarocks", "unpack", rock).split("\n")[-2]
|
|
|
|
spec = "#{r.name}-#{r.version}.rockspec"
|
|
cd(unpack_dir) { system "luarocks", "make", *args, spec }
|
|
end
|
|
end
|
|
|
|
system "./bootstrap.sh" if build.head?
|
|
system "./configure", "--disable-debug",
|
|
"--disable-dependency-tracking",
|
|
"--disable-silent-rules",
|
|
"--with-system-luarocks",
|
|
"--with-lua=#{prefix}",
|
|
"--prefix=#{prefix}"
|
|
system "make"
|
|
system "make", "install"
|
|
|
|
env = {
|
|
LUA_PATH: "#{ENV["LUA_PATH"]};;",
|
|
LUA_CPATH: "#{ENV["LUA_CPATH"]};;",
|
|
}
|
|
|
|
(libexec/"bin").install bin/"sile"
|
|
(bin/"sile").write_env_script libexec/"bin/sile", env
|
|
end
|
|
|
|
test do
|
|
assert_match "SILE #{version.to_s.match(/\d\.\d\.\d/)}", shell_output("#{bin}/sile --version")
|
|
end
|
|
end
|