54 lines
2 KiB
Ruby
54 lines
2 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.4.0", :revision => "5b92405db76df2acf620fbaf37e3d1c3662af720"
|
|
head "https://github.com/sass/libsass.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "fcc15fe8462e1559cd87efaad9a080e9687e2726705d6fb8def72eb13712ebd1" => :sierra
|
|
sha256 "79be0774c3282325f2252e8fb8ae5b56ffe016311f972e46567fbd2792fd0775" => :el_capitan
|
|
sha256 "a25f3fb0fd1d8d3296c545d9cc6bb5b04dd81492ac3143f06aeffec289790e39" => :yosemite
|
|
end
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
needs :cxx11
|
|
|
|
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.undent
|
|
#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", "-lsass"
|
|
system "./test"
|
|
end
|
|
end
|