homebrew-core/Formula/libsass.rb
2016-04-20 01:59:58 -04:00

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.3.5", :revision => "dad30227fd3e6203a268bdd2901e9c4e2eec1f0b"
head "https://github.com/sass/libsass.git"
bottle do
cellar :any
sha256 "7fd37733c5784cd5785e000e37a19862ee98262cc97ede8b17325095904ee070" => :el_capitan
sha256 "efa2b502ca0c96d4509c255d0ece829774a6bd1d3ffb09596a34746c22ea0903" => :yosemite
sha256 "4e1d39972506d5f0893e4b967389a6ce2331d365001cc576be35be3ffd831fff" => :mavericks
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