63 lines
2.3 KiB
Ruby
63 lines
2.3 KiB
Ruby
class Libsass < Formula
|
|
desc "C implementation of a Sass compiler"
|
|
homepage "https://github.com/sass/libsass"
|
|
url "https://github.com/sass/libsass.git",
|
|
tag: "3.6.4",
|
|
revision: "8d312a1c91bb7dd22883ebdfc829003f75a82396"
|
|
license "MIT"
|
|
head "https://github.com/sass/libsass.git"
|
|
|
|
livecheck do
|
|
url :stable
|
|
strategy :github_latest
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_big_sur: "2b1ac6cc0910f5e738fda693c8981289c465d891f061fb13765ed0a8330fb67f"
|
|
sha256 cellar: :any, big_sur: "4c85f5604989fa56a518e2e0fecd1d05e7046e4ea383998710ab5b51e1c83c7c"
|
|
sha256 cellar: :any, catalina: "a674d8155125a1659499c689b2c3ecc4d37c8196667a93b4463f65dfa77a686c"
|
|
sha256 cellar: :any, mojave: "45e5e4f4eb76253127712dcef15df520064db0bd712e3fea9f349fa6ebee79a5"
|
|
sha256 cellar: :any, high_sierra: "85722d303754f2d6d07c4c704cf81c9aa827473f7d6130c66d90da984862c47d"
|
|
end
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
|
|
def install
|
|
ENV.cxx11
|
|
system "autoreconf", "-fvi"
|
|
system "./configure", "--prefix=#{prefix}", "--disable-silent-rules",
|
|
"--disable-dependency-tracking"
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
# This will need to be updated when devel = stable due to API changes.
|
|
(testpath/"test.c").write <<~EOS
|
|
#include <sass/context.h>
|
|
#include <string.h>
|
|
|
|
int main()
|
|
{
|
|
const char* source_string = "a { color:blue; &:hover { color:red; } }";
|
|
struct Sass_Data_Context* data_ctx = sass_make_data_context(strdup(source_string));
|
|
struct Sass_Options* options = sass_data_context_get_options(data_ctx);
|
|
sass_option_set_precision(options, 1);
|
|
sass_option_set_source_comments(options, false);
|
|
sass_data_context_set_options(data_ctx, options);
|
|
sass_compile_data_context(data_ctx);
|
|
struct Sass_Context* ctx = sass_data_context_get_context(data_ctx);
|
|
int err = sass_context_get_error_status(ctx);
|
|
if(err != 0) {
|
|
return 1;
|
|
} else {
|
|
return strcmp(sass_context_get_output_string(ctx), "a {\\n color: blue; }\\n a:hover {\\n color: red; }\\n") != 0;
|
|
}
|
|
}
|
|
EOS
|
|
system ENV.cc, "-o", "test", "test.c", "-L#{lib}", "-lsass"
|
|
system "./test"
|
|
end
|
|
end
|