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.1", :revision => "4d229af5500be1023883c38c4a675f0ed919839d" head "https://github.com/sass/libsass.git" bottle do cellar :any sha256 "e537c43fed3ee97113f8ad4f019fd68c474a7e4d7a318f77a442a74e1929041a" => :mojave sha256 "3fb6068985f5911476e132ab1e5e9c5850edd7806867fe4e117d18e7a4b9efb6" => :high_sierra sha256 "e9c7104789c533116f92c6115f8b311689f9987055da6eea7f4b4fc8cc4178ce" => :sierra 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 #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", "-L#{lib}", "-lsass" system "./test" end end