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.4", :revision => "dba57b2ca9aaab5bd0d90a7cf8b5cf93b6b21604" head "https://github.com/sass/libsass.git" bottle do cellar :any sha256 "2e7eed733ad88eadfc7f1a4d514b014bbfbc2771243ea2e1d6bebf38d95d0061" => :sierra sha256 "71fe112942b4e8c6825d51fc4363aeb5d74ce18bbb317cb6f3897fd1d33a6d7c" => :el_capitan sha256 "a48a3af046a54c2a7b72d3ad72fbc4bed706f6bb3b4d3f5a6869d0b7a4512fd1" => :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 #include 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